I am using Linux Mint 12 (based on Ubuntu 11.10) and installed clang compiler with the command:
$ sudo apt-get install clang
What installs a system-wide clang-2.9. But when i try compile something with it, I get this error:
$ clang -o hello hello.c
/usr/bin/ld: cannot find crt1.o: No such file or directory
/usr/bin/ld: cannot find crti.o: No such file or directory
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is the linker invocation I get using the -v flag:
"/usr/bin/ld" --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o teste crt1.o crti.o /usr/lib/gcc/i686-linux-gnu/4.6.1/crtbegin.o -L/usr/lib/gcc/i686-linux-gnu/4.6.1 -L/usr/lib/gcc/i686-linux-gnu/4.6.1/../../.. /tmp/cc-oYpj2E.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i686-linux-gnu/4.6.1/crtend.o crtn.o
So, what is this problem and how can I work around it?
Related
I'm trying to compile an app with static openssl. I compiled openssl with mingw options and now my lib directory has: libcrypto.a libssl.a libcrypto.dll.a libssl.dll.a
I used the correct -L compiler options and still I get these errors:
x86_64-w64-mingw32-gcc main.c -lws2_32 -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -static -L/rw/usrlocal/lib/ -I/rw/usrlocal/include/ -lssl -lcrypto
~~~~~~~~^~~~~
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libssl.a when searching for -lssl
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lssl
/usr/bin/x86_64-w64-mingw32-ld: skipping incompatible /rw/usrlocal/lib//libcrypto.a when searching for -lcrypto
/usr/bin/x86_64-w64-mingw32-ld: cannot find -lcrypto
collect2: error: ld returned 1 exit status
Can someone here tell me why mingw is using the libcrypto.a and not libcrypto.dll.a? And what's more important: How I can change that?
Greetings
It literally says "skipping incompatible", which leads me to think the libraries are not targetting the same platform. Are you sure you're not mixing 32-bit and 64-bit Windows?
Run the file command with the .dll file of openssl to see if they are also targetting x86_64.
When building openssl you should specify mingw64 with the ./Configure command.
I am trying to link an application with gc on Ubuntu 18.04. ld cannot find the libjasper library. I installed it manually with these commands:
sudo apt update
sudo apt install libjasper1 libjasper-dev
but got this error:
/usr/bin/ld: cannot find -llibjasper
I tried this command to add the library but didn't work:
gcc -o cnn connected_layer.c connected_layer.h convolutional_layer.c convolutional_layer.h image.c image.h maxpool_layer.c maxpool_layer.h network.c network.h tests.c -Wall `pkg-config --cflags --libs opencv` -flto -ffast-math -L /usr/lib/x86_64-linux-gnu -l libjasper
Replace
-l libjasper
by
-l jasper
lib is just a mandatory suffix to library files, which is ignored when specifying the name to the linker.
I am running CentOS 6.4, I have just installed GLFW 3.0.4 for some software package for CFD L-B visualisation. That's not my issue, the issue is that I was following instructions to test of GLFW was installed properly, I ran into some issues.
I began by
g++ -c main.cpp
Which has outputted main.o file, and went onto run this with the help of advice of another thread :
g++ main.o -o main.exec `pkg-config --libs glfw3` -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldlD
which has then given me this error code:
Package glfw3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glfw3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glfw3' found
/usr/bin/ld: cannot find -lglfw3
collect2: ld returned 1 exit status
Have tried adding -L or -B to the path of glfw3.pc and no use,
Can you please advise on how I can get this to work properly?
I was trying to compile my fortran code
following error generated
sfanwer#genesis ~/WORK/NNF/anwar/re40_n1 $ ifort new_nnfsossip.for -o new.x
ld: cannot find /usr/lib64/crti.o: No such file or directory
ld: cannot find -lm
ld: cannot find -lpthread
ld: cannot find -lc
ld: cannot find -ldl
ld: cannot find -lc
ld: cannot find /usr/lib64/crtn.o: No such file or directory
i tried to check whether ifort is installed or not
sfanwer#genesis ~/WORK/NNF/anwar/re40_n1 $ ifort -v
ifort version 15.0.3
Hence it is installed
Your IntelFortran Compiler is installed but you need to link the library.You should check the help for ld command.
ld --help
For example
ifort -o fcode fcode.f -L/usr/local/lib -llapack -lblas
You must install LAPACK and BLAS on local systems.Also you should try to write a simple makefile.
I hope this method could solve your problem.
sudo apt-get install build-essential
I want to compile a .c file to 32-bit executable using gcc option -m32 with libpcap
the machine is linux 64bit fedora 16
however, I get the following error
[root#fdf source]# gcc -m32 -o test_tcp test_tcp.c -lpcap
/usr/bin/ld: skipping incompatible /usr/lib64/libpcap.so when searching for -lpcap
/usr/bin/ld: cannot find -lpcap
collect2: ld returned 1 exit status
I installed
yum install libpcap.i686
and then try to compile, but still get errors:
root#ddh-4.0# gcc -m32 -o test_tcp test_tcp.c -lpcap
/usr/bin/ld: skipping incompatible /usr/lib64/libpcap.so when searching for -lpcap
/usr/bin/ld: cannot find -lpcap
You need the development package in addition to the runtime library. So do
yum install libpcap-devel.i686