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
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 followed instruction described http://www.cse.iitm.ac.in/~vplab/courses/CG/opengl_start.html that is as following -
OpenGL (GLUT) on Linux (Ubuntu) Installation
Install the following packages from the ubuntu repository:
1. freeglut3-dev
2. mesa-common-dev
sudo apt-get install freeglut3 freeglut3-dev mesa-common-dev
Check your /usr/include/GL folder to verify the installation of the openGL headers that you intend to use.
Compiling and Linking
You will have to use the -lglut linker option with gcc/g++ to compile a program with glut library.
For example, to compile the program cube.c that uses GLUT type, use
gcc -o cube cube.c -lglut -lGLU
to get the binary executable cube.
If you are not using GLUT and want to use the lower level libraries then use -lGL -lGLU also in the linker options.
But, this doesn't work for me.
$gcc -o cube cube.c -lglut -lGLU
/usr/bin/ld: /tmp/cc5OzQPt.o: undefined reference to symbol 'glVertex3fv'
//usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
And I didn't get the solution. Help me.
I want to write code in C and my environment is Ubuntu 14.04, Intel processor.
Try this -
gcc -o cube cube.c -lglut -lGLU -lGL
I need a special compiler. This is my call from eclipse:
powerpc-stw-linux-uclibc-g++ -L/usr/lib/i386-linux-gnu -L/usr/lib -L/usr/libx32 -L/var/lib -o "Test" ./src/Test.o -lz -lcurl
But now Eclipse throw this:
/opt/powerpc-gcc-4.4.3-uclib/bin/../lib/gcc/powerpc-stw-linux-uclibc/4.4.3/../../../../powerpc-stw-linux-uclibc/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libcurl.so when searching for -lcurl
/opt/powerpc-gcc-4.4.3-uclib/bin/../lib/gcc/powerpc-stw-linux-uclibc/4.4.3/../../../../powerpc-stw-linux-uclibc/bin/ld: skipping incompatible /usr/lib/i386-linux-gnu/libcurl.a when searching for -lcurl
/opt/powerpc-gcc-4.4.3-uclib/bin/../lib/gcc/powerpc-stw-linux-uclibc/4.4.3/../../../../powerpc-stw-linux-uclibc/bin/ld: cannot find -lcurl
I tried to compile under Ubuntu 14.04 x86. libcurl should be installed
$ curl-config --libs
-L/usr/lib/i386-linux-gnu -lcurl
Obviously, you are building for PowerPC, but linking with the lib for i386.
You need to download/build libcurl for PowerPC, and provide the correct path to it.
In other words, don't mix two different architectures.
I'm trying to compile a program for 32 bit on a 64 bit Kali Linux operating system.
Here is my system information:
root#kali:~/Desktop# cat /proc/version
Linux version 3.18.0-kali3-amd64 (debian-kernel#lists.debian.org) (gcc version 4.7.2 (Debian 4.7.2-5) ) #1 SMP Debian 3.18.6-1~kali2 (2015-03-02)
When I try to compile my C project, it cannot find -lgcc:
root#kali:~/Desktop/Project# make
cc -o libor libor.c -fno-stack-protector -z execstack -m32 -lpthread
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc.a when searching for -lgcc
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.7/libgcc_s.so when searching for -lgcc_s
/usr/bin/ld: cannot find -lgcc_s
collect2: error: ld returned 1 exit status
make: *** [all] Error 1
Note that I'm using the -m32 flag to force compilation for 32 bit.
Like suggested elsewhere, the 32 bit libraries should be installed which I did using the following command:
sudo apt-get install libc6-dev-i386
This however only changed the error message to the one seen above. I lost the previous one however I guess it no longer matters.
Please note that existing answers didn't help me so this is not a duplicate.
Try ensuring that your new 32-bit libraries are in the library search path. You can verify this by using the ldconfig command, and if the libraries' directories aren't listed, then use the tips in this web page: http://www.cyberciti.biz/faq/linux-setting-changing-library-path/
I don't know that the above is the cause of your problem, but it may be worth a try?
The problem is you likely only have the gcc for your current architecture and that's 64bit. You need the 32bit support files. For that, you need to install them
sudo apt install gcc-multilib
Once installed, run the below command to compile c-program to 32-bit binary executable
gcc -o libor libor.c -m32
Verify the binary is 32-bit or not by
file libor
apt-get install gcc-multilib
should do the trick.
I working on open source GHDL project for my project purpose installed ghdl-0.29-2.143svn.4.fc16.src.rpm consisting of ghdl 0.29 and gcc 4.3.4 through rpm -i and rpmbuild -ba command successfully.
In ghdl folder, I edited one ada program then I did make and make install : no errors but it creates problem changes in gcc version 4.6.3 (default) to 4.3.4 and no gcc program execution gave error:
error: C compiler cannot create executables
See `config.log' for more details."
In config.log file /usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
Thanks in advance
Regards
Raghu
Have you tried reinstalling glibc? That might work.