I'm trying to write an application using the UDP module included
in the inetmanet framework in omnetpp. The problem is that the files that I have to include don't get included in the linking phase.
The errors are:
opp_makemake
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$ opp_makemake --deep -f -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base
Creating Makefile in /home/bedo/omnetpp/samples/Basic-Broadcast-Simulation...
Makefile created, running "make depend" to add dependencies...
opp_makedep -Y --objdirtree -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base -I. -Igcc-debug -Igcc-debug/src -Igcc-debug/src/flooding -Isimulations -Isimulations/bitmaps -Isimulations/results -Isrc -Isrc/flooding -f Makefile -P\$O/ -- ./*.cc gcc-debug/*.cc gcc-debug/src/*.cc gcc-debug/src/flooding/*.cc simulations/*.cc simulations/bitmaps/*.cc simulations/results/*.cc src/*.cc src/flooding/*.cc
make
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$ make
g++ -c -g -Wall -fno-stack-protector -DHAVE_PCAP -DXMLPARSER=libxml -DWITH_PARSIM -DWITH_NETBUILDER -I../inet-sommer/src/transport/contract -I../inet-sommer/src/networklayer/contract -I../inet-sommer/src/base -I. -Igcc-debug -Igcc-debug/src -Igcc-debug/src/flooding -Isimulations -Isimulations/bitmaps -Isimulations/results -Isrc -Isrc/flooding -I/home/bedo/omnetpp/include -o out/gcc-debug//src/flooding/Flooding.o src/flooding/Flooding.cc
src/flooding/Flooding.cc: In member function ‘virtual void Flooding::handleLowerMsg(cMessage*)’:
src/flooding/Flooding.cc:82: warning: unused variable ‘m’
g++ -Wl,--export-dynamic -Wl,-rpath,/home/bedo/omnetpp/lib -Wl,-rpath,. -o out/gcc-debug//Basic-Broadcast-Simulation out/gcc-debug//src/flooding/Flooding.o -Wl,--whole-archive -Wl,--no-whole-archive -L"/home/bedo/omnetpp/lib/gcc" -L"/home/bedo/omnetpp/lib" -u _tkenv_lib -lopptkenvd -loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird -loppsimd -ldl -lstdc++
out/gcc-debug//src/flooding/Flooding.o: In function `Flooding::setupLowerLayer()':
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:50: undefined reference to `UDPControlInfo::UDPControlInfo()'
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:52: undefined reference to `UDPSocket::generateSocketId()'
out/gcc-debug//src/flooding/Flooding.o: In function `Flooding::sendMessage()':
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:101: undefined reference to `UDPControlInfo::UDPControlInfo()'
/home/bedo/omnetpp/samples/Basic-Broadcast-Simulation/src/flooding/Flooding.cc:103: undefined reference to `IPAddress::ALL_HOSTS_MCAST'
collect2: ld returned 1 exit status
make: *** [out/gcc-debug//Basic-Broadcast-Simulation] Error 1
bedo#ethereal:~/omnetpp/samples/Basic-Broadcast-Simulation$
I really don't know why they get included, and my module compile fine, but in the linking phase I get "undefined reference".
Any idea?
You can run nm on on all libraries you link with to see which library undefined symbols like this:
nm liboppcmdenvd.(so/a) | c++filt | grep UDPControlInfo
(c++filt demangles C++ symbols).
Library that requires the symbol will get output something like (U for Undefined):
00000000007f90a0 U UDPControlInfo
Library that defines/has the symbol will get output something like:
00000000007f90a0 T UDPControlInfo
This can be T or t
Of course, libraries you link with are indicated by arguments with starting by -l:
-lopptkenvd -loppenvird -lopplayoutd -u _cmdenv_lib -loppcmdenvd -loppenvird
liboppcmdenvd liboppenvird liboppsimd libUDPControlInfo
Solved. I modified the makefile in the root directory to a simpler one, leaving all the compile and linking duties to the src's makefile.
Thanks everyone
Related
I'm trying to configure and make festvox, but when I attempt making it, g++ shows errors with things such as -fpermissive and how it cannot locate the library "sub". How can I get the library?
Here is a part of the logs:
making in src/vc/src/analysis ...
g++ -o analysis main.o analysis_sub.o -L../lib -lsub -lsp
/usr/bin/ld: cannot find -lsub
collect2: error: ld returned 1 exit status
make[4]: *** [Makefile:65: analysis] Error 1
making in src/vc/src/extdim ...
g++ -o extdim main.o -L../lib -lsub -lsp
/usr/bin/ld: cannot find -lsub
I have already tried using apt-get to see if the library resides in the repo, but I can't be sure that any of them actually stop the issue.
I instead got Festival through apt. I felt at first that it would outdated, but it seems to be as up to date on there as on the website.
sudo apt install festival
I'm struggling to compile SDL_Gfx with cygwin.
The configure script worked without issues.
Here's the last makefile command:
/bin/sh ./libtool --tag=CC --mode=link gcc -g -O2 -I/usr/local/include/SDL2 -Dmain=SDL_main -no-undefined -release 1.0 -version-info 0:1:0 -o libSDL2_gfx.la -rpath /usr/local/lib SDL2_framerate.lo SDL2_gfxPrimitives.lo SDL2_imageFilter.lo SDL2_rotozoom.lo -L/usr/lib -lcygwin -lSDL2main -lSDL2
libtool: link: warning: library `/usr/lib/libSDL2.la' was moved.
And here's the linker "warning" message.
*** Warning: linker path does not have real file for library -lSDL2main.
*** I have the capability to make that library automatically link in when
*** you link to this library. But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libSDL2main and none of the candidates passed a file format test
*** using a file magic. Last file checked: /lib/libSDL2main.a
If i try to ignore this, I'm getting this error when I try to use the library inside my application:
In function `pixel':
/usr/local/lib/SDL2_gfx-1.0.1/SDL2_gfxPrimitives.c:75: undefined reference to `SDL_RenderDrawPoint'
/usr/local/lib/SDL2_gfx-1.0.1/SDL2_gfxPrimitives.c:75:(.text+0x11): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `SDL_RenderDrawPoint'
UPDATE: I tried to switch compiler to use mingw64 instead of cywin. I'm having a similar issue, I think this is related to libtool since I can compile an external programs with similar c/l flags without issues.
I don't know what I can try I ran out of ideas, please help.
Thank you
I am having some issues compiling flex from source. The configure is being passed
CC=/home/mybin/bin/gcc CPPFLAGS=-I/home/mybin/include LDFLAGS=-L/home/mybin/lib.
Within ../include i have two files containing references
regex.h:110:#define regerror TclReError
regcustom.h:78:#define regerror TclReError
when running config, no error is produced and nothing of interest in the logs, however make throws an error
/bin/sh ../libtool --tag=CC --mode=link /home/mybin/bin/gcc -g -O2 -L/home/mybin/lib -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o ../lib/libcompat.la -lm
libtool: link: /home/mybin/bin/gcc -g -O2 -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o -L/home/_bin/lib ../lib/.libs/libcompat.a -lm
regex.o: In function `flex_regcomp':
/home/tmp/flex-2.6.0/src/regex.c:66: undefined reference to `TclReError'
collect2: error: ld returned 1 exit status
make[2]: *** [flex] Error 1
in configure --help no reference is made to explicit flags
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
LT_SYS_LIBRARY_PATH
User-defined run-time library search path.
CPP C preprocessor
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
I have also tried exporting directly with export CPPFLAGS="-I/home/mybin/include"
extended searches on SO and google have returned noting obvious, any pointers on what I am missing?
you set them as an environment variable; configure determines LDFLAGS and CPPFLAGS by checking config files and the environment. You can try like this.
export CPPFLAGS='-I/home/mybin/include'
export LDFLAGS='-L/home/mybin/lib'
./configure
or as a one-liner:
env CPPFLAGS='-I/home/mybin/include' LDFLAGS='-L/home/mybin/lib' ./configure
Please try this...
I try to use VeridisBiometricSDK_5.0_Linux which is free Biometric library which has samples I tired to compile MatchingExample by doing exactly what the Readme file said :
make MatchingExample.cpp
but I have this error result:
root#localhost MatchingExample]# make MatchingExample
g++ -Wall -g MatchingExample.cpp -o ../../../bin/MatchingExample -I../../../include/ -L../../../lib/ -lVrBio -lpthread -ludev -lusb -lusb-1.0 -ldl
MatchingExample.cpp: In function ‘int main()’:
MatchingExample.cpp:47: warning: deprecated conversion from string constant to ‘char*’
MatchingExample.cpp:55: warning: deprecated conversion from string constant to ‘char*’
/usr/bin/ld: warning: libtiff.so.4, needed by ../../../lib//libVrBio.so, not found (try using -rpath or -rpath-link)
../../../lib//libVrBio.so: undefined reference to `TIFFWriteScanline'
../../../lib//libVrBio.so: undefined reference to `TIFFDefaultStripSize'
../../../lib//libVrBio.so: undefined reference to `__fdelt_chk#GLIBC_2.15'
../../../lib//libVrBio.so: undefined reference to `_TIFFmalloc'
../../../lib//libVrBio.so: undefined reference to `memcpy#GLIBC_2.14'
../../../lib//libVrBio.so: undefined reference to `TIFFClose'
../../../lib//libVrBio.so: undefined reference to `TIFFSetErrorHandler'
../../../lib//libVrBio.so: undefined reference to `TIFFGetField'
../../../lib//libVrBio.so: undefined reference to `_TIFFfree'
../../../lib//libVrBio.so: undefined reference to `TIFFClientOpen'
../../../lib//libVrBio.so: undefined reference to `TIFFSetField'
../../../lib//libVrBio.so: undefined reference to `TIFFReadDirectory'
../../../lib//libVrBio.so: undefined reference to `TIFFSetWarningHandler'
../../../lib//libVrBio.so: undefined reference to `TIFFReadRGBAImageOriented'
collect2: ld returned 1 exit status
make: *** [MatchingExample] Error 1
==================================================
this is the Makefile codes:
# ------------------ Compilation options ------------------------
# Loads libraries.
LIBS = -lVrBio -lpthread -ludev -lusb -lusb-1.0 -ldl
# Flags for the C compiler:
# -Wall for strict gcc warnings (requires prototypes for all functions).
# -g to produce debug data for gdb
# -O for optimization
CFLAGS = -Wall -g
CC = g++
# --------------------- Directory Paths ----------------------------
INC_DIRS = -I../../../include/
LIB_DIRS = -L../../../lib/
BIN_DIR = ../../../bin/
# --------------------- Code modules ----------------------------
# Object files
#OBJ =
# Definitions
#DEFS =
# ------------------------ Rules --------------------------------
$#.cpp: $#.cpp
${CC} $(CFLAGS) $#.cpp -o $(BIN_DIR)$# $(INC_DIRS) $(LIB_DIRS) $(LIBS)
==========================
aslo this is the ReadMe file content
In the AsyncCaptureExample folder there is a Makefile. This Makefile can be used for all the
other cpp examples.
To compile use: make
For example: make AsyncCaptureExample
The output will be generated in the bin folder.
also this is the VeridisBiometricSDK_5.0 ReadMe file:
1 - install necessary packages:
*libudev
*libusb
*libusb-1.0
*fxload
2 - In the misc folder there are files necessary for the program access the USB with the extension .rules. Copy them
to /etc/udev/rules.d folder or equivalent
3 - mkdir /usr/share/usb and copy the .hex files of the misc folder there
4 - Set LD_LIBRARY_PATH as the path to the .so files
5 - copy the file UFLicense.dat, which is in the misc folder, to the folder of your application
if you use suprema readers.
would you please help me?
UPDATE
I am so close to solve my problem:
First, I found solution for installing libtiff.so.4 for Ubuntu on this the following link:
https://askubuntu.com/questions/457011/why-is-libtiff-so-4-not-recognized
Second, I convert the same Ubuntu library package into centos rpm using alien tool as the following:
alien -r -g libtiff4_3.9.7-2ubuntu1_amd64.deb
Third, I Installed libtiff4-3.9.7-3.x86_64.rpm (which is result from alien converting) on my Centos 6.7 it installed successfully but when try make my samples I supersized that libtiff.so.4 requires 2 library which are
[root#localhost]# readelf -d /usr/lib/x86_64-linux-gnu/libtiff.so.4
0x0000000000000001 (NEEDED) Shared library: [libjbig.so.0]
0x0000000000000001 (NEEDED) Shared library: [libjpeg.so.8]
I installed libjpeg.so.8 from source code library from jpegsrc.v8.tar.gz and it worked well
But I couldn’t find any suitable package to fix missing libbig.so.0 library
So would you help me to fix this missing library…
By way the when I fixed my problem, I will explain the all solution so it will be useful for any one
Finally I solved my problem
if you read my problem you would know that my problem is missing libtiff.so.4
I fixed it,
my solutions steps as follows
first
if you dipslay current libtiff.so by using this command
[yaserco#localhost Desktop]$ locate libtiff.so
/usr/lib64/libtiff.so.3
so I made symble link to libtiff.so.3
ln -s /usr/lib64/libtiff.so.3 /usr/lib64/libtiff.so.4
after I tested my sample it diplayed this 2 error messages
tried this solution: first create symbolic link ln -s /usr/lib64/libtiff.so.3.9.4 /usr/lib64/libtiff.so.4 then I did the command [root#localhost MatchingExample]# make MatchingExample it had an error result as:
MatchingExample.cpp: In function ‘int main()’:
MatchingExample.cpp:47: warning: deprecated conversion from
string constant to ‘char*’ MatchingExample.cpp:55: warning: deprecated
conversion from string constant to ‘char*’ ../../../lib//libVrBio.so:
undefined reference to __fdelt_chk#GLIBC_2.15' ../../../lib//libVrBio.so:
undefined reference to memcpy#GLIBC_2.14'
second
I solved this error by installing
A-
glibc for (GLIBC_2.14) as the follows:
cd /tmp
wget http://ftp.gnu.org/gnu/glibc/glibc-2.16.0.tar.gz
tar -xvzf glibc-2.16.0.tar.gz
cd glibc-2.16.0
mkdir glibc-build
cd glibc-build
../configure --prefix='/usr'
B-
We have to fix a little typo, so run:
nano +171 ../scripts/test-installation.pl
and replace if (/$ld_so_name/) { with if (/\Q$ld_so_name\E/) {
:
make
sudo make install
see more form this link
https://github.com/FezVrasta/ark-server-tools/wiki/Install-of-required-versions-of-glibc-and-gcc-on-RHEL-CentOS
then when I compile my sample it worked well
I have written a few programs and while trying to compile them using g++,as thus,
$ g++ minIni.c device_datum.cpp fanuc_axis.cpp fanuc_path.cpp service.cpp condition.cpp cutting_tool.cpp string_buffer.cpp logger.cpp client.cpp server.cpp adapter.cpp fanuc_adapter.cpp FanucAdapter.cpp -L/usr/local/lib/ -lfwlib32 -lpthread -o adapter
I keep getting the following error:
/usr/bin/ld: cannot find -lfwlib32
collect2: error: ld returned 1 exit status
fwlib32.h is the library I am trying to include. The shared object file libfwlib32.so is present in /usr/local/lib as well as /usr/lib. But I am unable link to it. I have tried all the solutions offered by similar questions including
$ export LIBRARY_PATH=/usr/local/lib/
$ export LD_LIBRARY_PATH=/usr/local/lib
I have done the above for /usr/lib as well, but still the same error.
I have tried using the -L option in the command line but I still get the error.
I even created a new folder called lib, pasted libfwlib32.so.1.0.1 into it and ran
$ ln -s ~/lib/libfwlib32.so.1.0.1 ~/lib/libfwlib32.so
on the console to create a new .so file and gave ~/lib as argument to -L option on the command line. It made no difference. I am at the point of tearing my hair out so any help will be appreciated.
Thanks alot!
You should put -l option in the very last as:
$ g++ minIni.c device_datum.cpp fanuc_axis.cpp fanuc_path.cpp service.cpp condition.cpp cutting_tool.cpp string_buffer.cpp logger.cpp client.cpp server.cpp adapter.cpp fanuc_adapter.cpp FanucAdapter.cpp -L/usr/local/lib/ -o adapter -lfwlib32 -lpthread
Note: Please make sure that all the header and source file are in the same folder.
Note that specifying -L~/lib won't work as the ~ will not be expanded by the shell. Also you can't add a space between -L and ~/lib. Instead you must specify it as a relative or absolute path.
Have you checked that the libfwlib32.so symlink exists in /usr/local/lib (or /usr/lib) in addition to the libfwlib32.so.1.0.1 file?
Another possibility is that the library is the wrong architecture (ie. 32-bit while your system is 64-bit), but then ld should print a message about skipping incompatible library. You can check the architecture of the library by running 'file libfwlib32.so.1.0.1'.
The error message suggests that -lfwlib32 is being interpreted as a filename not as a -l parameter. Put all the parameters before the files to be compiled
g++ -m32 -L/usr/local/lib/ -lfwlib32 -lpthread -o adapter minIni.c device_datum.cpp fanuc_axis.cpp fanuc_path.cpp service.cpp condition.cpp cutting_tool.cpp string_buffer.cpp logger.cpp client.cpp server.cpp adapter.cpp fanuc_adapter.cpp FanucAdapter.cpp
As has been pointed out by #Erik Johannessen, libfwlib32.so is a 32bit library, so you need to add -m32 to build a 32bit executable.