I am trying to cross compile samba server.
./config works just fine, but when I want to build with make the prompt says:
Linking shared library bin/libsmbclient.so.0
/opt/qnx630/host/linux/x86/usr/bin/ntoarm-ld: cannot find -lpthread
collect2: ld returned 1 exit status
make: *** [bin/libsmbclient.so.0] Error 1
Anyone knows a solution?
had this same problem w/mingw. got libpthreadGC2.a from ftp://sourceware.org/pub/pthreads-win32/dll-latest/lib/x86/, put it in C;\mingw\lib and renamed it to libpthread.a. i didn't know gcc's -l switch means "apprend 'lib' to the front and '.a' to the back" e.g. -lpthread = libpthread.a
Make sure that the pthread library is in the library search path of the linker.
Related
I built a cross-compiler for sh3eb-elf targets. Now I need a libc implementation. However, when I want to build newlib, configure fails.
Running configure:
../newlib-cygwin/configure --host=sh3eb-elf
It fails. A quick look into config.log:
configure:4435: sh3eb-elf-gcc conftest.c >&5
[...]/sh3eb-elf/sh3eb-elf/lib/gcc/sh3eb-elf/8.1.0/../../../../sh3eb-elf/bin/ld: cannot find -lc
collect2: error: ld returned 1 exit status
configure:4439: $? = 1
Obviously the linker does not find libc which is what I am trying to build here in the first place. I am confused... Are the parameters of configure wrong?
I'm not sure why, but as Chrono Kitsune pointed out, using --target=sh3eb-elf does the trick.
I'm trying to run a simple code that includes the fftw library. I know the code is right as it is provided as a test code by the authors. This is what I typed during compilation:
gcc my file.c -L/home/ankit/Desktop/fftw-3.3.6-pl2/lib/
-I/home/ankit/Desktop/fftw-3.3.6-pl2/include/ -lfftw -lm
I get the errors:
myfile.c: (.Text+0x2c):. undefined reference to 'fftw_plan_dft_2d'
collect2: ld returned 1 exit status
It wasn't a linking problem, installation was faulty and I had to use 'sudo make install' to get the permission for the installation to be successful. I could link it with 'gcc test.c -lfftw3 -lm' after. Thanks for your suggestions!
I'm trying to write a very small, very simple project using PJSIP. But I'm already stuck on the first step, incorporating PJSIP in my project. I'm trying to build and compile on a Ubuntu 14.04 system using an arm-linux-gnueabihf-gcc cross compiler. For the coding itself I'm using Eclipse CDT, but the crosscompiling part is working in a normal order.
I downloaded de pjproject-2.3 folder to my system, configured it with this command:
./configure --host=arm-linux-gnueabihf CFLAGS='--sysroot=/home/david/rpi/rootfs' LDFLAGS='--sysroot=/home/david/rpi/rootfs'
The /home/david/rpi/rootfs folder is where I copied the rootsystem of my Pi. I then ran 'make dep' and 'make'. I copied all the static libraries *.a to my Eclipse project folder and added the libraries to the linker (-l).
But when I want to build I get the following error:
Invoking: Cross G++ Linker
arm-linux-gnueabihf-g++ -L"/home/david/workspace/VoIPBenchmark" -L/home/david/rpi/rootfs/usr/lib -L/home/david/rpi/rootfs/usr/lib/arm-linux-gnueabihf --sysroot=/home/david/rpi/rootfs/ -o "VoIPBenchmark" ./src/SipImplemantation.o ./src/SipImplementationPJ.o ./src/Timer.o ./main.o -lpjsua2-arm-unknown-linux-gnueabihf -lpjsua-arm-unknown-linux-gnueabihf -lpjsip-ua-arm-unknown-linux-gnueabihf -lpjsip-simple-arm-unknown-linux-gnueabihf -lpjsip-arm-unknown-linux-gnueabihf -lpjsdp-arm-unknown-linux-gnueabihf -lpjmedia-audiodev-arm-unknown-linux-gnueabihf -lportaudio-arm-unknown-linux-gnueabihf -lpjmedia-codec-arm-unknown-linux-gnueabihf -lpjmedia-arm-unknown-linux-gnueabihf -lspeex-arm-unknown-linux-gnueabihf -lgsmcodec-arm-unknown-linux-gnueabihf -lsrtp-arm-unknown-linux-gnueabihf -lilbccodec-arm-unknown-linux-gnueabihf -lresample-arm-unknown-linux-gnueabihf -lpjnath-arm-unknown-linux-gnueabihf -lpjlib-util-arm-unknown-linux-gnueabihf -lpj-arm-unknown-linux-gnueabihf -lpthread -lm -lrt -lasound -llinphone
/home/david/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: /home/david/workspace/VoIPBenchmark/libsrtp-arm-unknown-linux-gnueabihf.a(ctr_prng.o)(.text+0x8c): unresolvable R_ARM_ABS32 relocation against symbol `ctr_prng'
/home/david/rpi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make: *** [VoIPBenchmark] Error 1
I googled some and tried to add -fPIC in the ./configure step above, recopied the libraries, but without result. Does anyone know what this message is saying me, and better yet, knows a solution?
This problem has been resolved. I was using a library that also linked to the srtp library, this evidently conflicted. So I am now not using the library that causes the problem.
I need to link a shared library (LuaSocket) I'm compiling against another special shared library, liblua5.1, that isn't in one of the normal locations. To do this I'm modifying the Makefile.
I cannot figure out what I'm doing wrong, but this particular step that I modified fails:
LIBRARY_PATH=/media/sda2/crank/lib gcc -O -shared -fpic -l liblua5.1 -o socket.so.2.0.2 [...]
(where [...] is a list of .o files that just got built). When I build, I get the error
/usr/lib/gcc/arm-poky-linux-gnueabi/4.8.1/../../../../arm-poky-linux-gnueabi/bin/ld: cannot find -lliblua5.1
collect2: error: ld returned 1 exit status
make: *** [socket.so.2.0.2] Error 1
Inspection of the LIBRARY_PATH confirms that the needed library is there:
# ls /media/sda2/crank/lib/
lgre.so libgre.so libgreio.a liblua.so liblua5.1.so libsbexternal.so
What am I doing wrong?
Change -l liblua5.1 to -llua5.1.
Also, instead of setting LIBRARY_PATH, why not use the -L option? Example: -L/media/sda2/crank/lib.
I am new to Ubuntu and I had the following questions.
When compiling a C or any other program one often writes a command such as gcc hello.c -lm
I am told the -lm option is for explicitly linking the math library during the compiling
phase. I wanted to know where the library 'foo' is supposed to be located if linked with - lfoo.
This is an error I get when I was trying to install a package named SUPERLU which in turn depends on the existence of a package named PARMETIS. (ending of the stuff after running make)
/usr/bin/ld: cannot find -lparmetis
collect2: ld returned 1 exit status
make[1]: * [pddrive] Error 1
make[1]: Leaving directory `/home/gaurish108/Desktop/ResearchMeetings/SUPERPETS/SuperLU_DIST_2.4/EXAMPLE'
make: * [example] Error 2
What should I do ???? I found that there is no ld folder in my /usr/bin/......Should I modify my make.inc file in some way?
Take a look here: http://www.network-theory.co.uk/docs/gccintro/gccintro_21.html. -lm says "search for libm.a in the search path". libm.a is found in /usr/lib/libm.a.