Let me explain.
I'm using webots in combination with aldebaran SDK. My operating system is Debian Squeeze amd64. Webots (64bit) will not work with aldebaran SDK because their libraries are compiled for 32bit. I do not have the source of the libs to recompile in 64bit.
While trying to compile the default nao controller under webots, i get the following error:
g++ -o naoqi_for_webots
naoqi_for_webots.o naoproxy.o
-L"/usr/local/webots/lib" -lController -L"/home/alex/naoqi-sdk-1.10.44-linux/lib"
-lnaoqiclient /usr/bin/ld: skipping incompatible
/home/vor73x/naoqi-sdk-1.10.44-linux/lib/libnaoqiclient.so
when searching for -lnaoqiclient
/usr/bin/ld: cannot find -lnaoqiclient
doing a
file libnaqoqiclient.so
tells me:
libnaoqiclient.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, not stripped
The default project in webots has a Makefile which among other things has:
additional libraries:
LIBRARIES=-L"$(AL_DIR)/lib" -lnaoqiclient
I have downloaded and installed the 32bit version of webots, which links fine with the libnaoqiclient.so but will not link with other webots libraries (libController.so) where again, ld complains about incompatible type.
Can I link using webots 64bit with the 32bit aldebaran sdk ?
Can I link using webots 32bit with the 32bit aldebaran ? (I should, but I still get errors).
How can I specify to ld (or through Makefile even better) that the library is 32bits ?
Or in the case of using webots 32bit how can I specify that I want a 32bit binary ?
I do not care if my binary is 32 or 64bit, I do not care if I use the 32 or 64bit version of webots, all I want is to be able to compile the controllers.
Well, you can't mix and match 32-bit and 64-bit code. If you compile all your code using -m32 (to make it build as 32-bit), you may be able to get your application to link if you have 32-bit versions of all your libraries available.
Related
I am using a sample program from https://www.npmjs.com/package/ffi-napi A Node.js Foreign Function Interface for N-API factorial.c is there a way to compile a sample C(factorial_lib.c) program as a windows 64Bit .DLL I am using gcc under windows( MinGW installed, not cygwin) ,
no luck: gives error, it seems the following is compiling it into 32BIT need to know how to change the gcc default compilation into 64bit windows DLL
gcc -c -DBUILD_DLL factorial_lib.c
gcc -shared -o factorial.dll factorial_lib.o
PLEASE HELP , I have tried MS VSC compile and ran into issues
MinGW does not support 64-bit Windows. MinGW-w64 does support both 32-bit and 64-bit Windows. You can download a standalone version from http://winlibs.com/.
I am trying to cross-compile a binary to use on an old Linux distribution (kernel 2.4.25, i586 architecture).
Steps I took
I have downloaded the landley i586 cross-compiler (http://landley.net/aboriginal/downloads/binaries/)
I downloaded the net-utils source: https://ftp.gnu.org/gnu/inetutils/ version 1.9.4
I included the cross-compiler in my path: export PATH=/root/Documents/cross-compiler-i586/bin/:$PATH
I then built the telnet binary as follows: LDFLAGS=”-static" ./configure --host=i586 --build=x86_64 --target=i586 --disable-ifconfig --with-ncurses-include-dir=/root/Documents/tnbuild --disable-hostname --disable-logger --disable-rcp --disable-rexec --disable-rlogin --disable-rsh --disable-tftp --disable-traceroute --disable-inetd --disable-rexecd --disable-syslogd --disable-tftpd
This successfully compiled, and checking (after stripping) the binary with the file command gives: telnet: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, stripped
I compared this with a binary which is already on the old Linux system, and the output is exactly the same: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter lib/ld-linux.so.2, for GNU/Linux 2.4.0, stripped
The problem I am facing
The telnet binary that I compiled is not working on the old Linux system. The error that is thrown is simply 'Segmentation Fault'. Googling this error learns that it is likely due to differences in architecture (i586?), but I have no clue anymore how to fix it, as the 'file' command outputs exactly the same for a working binary as well as for the failing binary.
I then stumbled across this topic: GCC Cross compile to a i586 architecture (Vortex86DX) , but as it is not pursued, I am not sure if I should indeed compile all toolchains for i586 and how exactly I would need to do that.
Is there a specific reason you want to cross-compile this rather than just compiling for generic 32-bit i386? You may need to disable some compiler optimizations if they are not supported by the CPU, but you probably don't need to create a staticly-linked binary.
These instructions for compiling 32-bit (-m 32) seem sufficient to create the telnet binary.
They boil down to:
apt-get install gcc-multilib;
./configure CFLAGS='-m32' -disable-ifconfig \
--with-ncurses-include-dir=/root/Documents/tnbuild \
--disable-hostname --disable-logger --disable-rcp \
--disable-rexec --disable-rlogin --disable-rsh \
--disable-tftp --disable-traceroute --disable-inetd \
--disable-rexecd --disable-syslogd --disable-tftpd
make
I can not find any built versions of the binutils that could be pushed to an Android device an then be executed from there. The Android NDK toolchain provides them but in the wrong format.
Devices need them in ELF 32bit executable for ARM , but the toolchain only provides :
compiledtoolchain/bin$ file arm-linux-androideabi-objdump
arm-linux-androideabi-objdump: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped
Does anyone know if and where to find objdump in a format so that it can be executed directly on an ARM android device ?
I haven't tried it on an Android device, but you might want to look at the pre-built binaries of my ELLCC cross compiler project: ftp://ellcc.org/pub (http://ellcc.org). Each tarball contains binaries for the clang/LLVM based C/C++ compiler, pre-built libraries, gdb, and the GNU binutils. All of the executables are statically linked so they don't rely on any shared libraries being available on the target system.
I'm trying to use the asmlibrary which I've obtained from here
I'm running in 64-bit, but the pre-compiled static library is build for 32-bit.
I don't really want to recompile the library, because I do not have OpenCV 1.0 installed, and don't really want to install such an old version of this piece of software.
My employer has told me that you may use ia32-libs which would allow me to use the library on a 64-bit machine. I have installed these libs using apt.
In netbeans, my IDE of choice, I'm now attempting to use the library. I keep getting the messages:
/usr/bin/ld: i386 architecture of input file
`../asmlib/libasmlibrary.a(asm_shape.o)' is incompatible with
i386:x86-64 output
Etc..
I have two questions:
1) Will ia32-libs allow me to use this library?
2) How must I "enable" it's use, either generally or preferably specific to netbeans (if applicable)
Thank you
An executable (including the libraries it depends on) has to be entirely 32 bits or 64 bits. You cannot mix and match object files of different types.
So to use a 32 bits library, you must compile your program as a 32 bits executable and link with a 32 bits version of libc and other core libraries. On debian you'll need packages like libc6-dev-i386 and ia32-libs-dev.
To compile foo.c as a 32 bits executable, use
gcc -m32 -o foo foo.c
How to do this with netbeans is left as an exercise.
I don't think that you are able to use ia32-libs to compile a 64-bit program, using 32-bit libraries. That isn't what ia32-libs is designed for...it's designed to run entirely 32-bit programs on 64-bit systems.
I think your best bet would be to compile as 32-bit software. If you were using the command line, you can just add the -m32 flag to gcc. With netbeans, in Project Properties > Build > C Compiler (or C++ compiler if that's what you are using), there is a dropdown to select architecture. If 32-bit is not available in that dropdown, you can add -m32 to the Additional Options box.
What is the best way to compile programs with DMD on a 64bit machine? It doesn't need to compile to 64Bit code. I know about GDC, but want to work with D2 also. There is also chroot, but am hoping for a simpler way.
The actual problem isn't with compiling, but linking. DMD calls on GCC to perform linking with system libraries. Could I get DMD to have GCC link against 32bit library? Or how would I do it manually?
I already have the ia32 libraries installed which is why I can run DMD.
Ask GCC to perform 32-bit link by passing it '-m32' flag.
It appears that DMD doesn't invoke gcc to perform the link, but rather invokes ld directly. The equivalent ld switch is '-melf_i386', and apparently the way to make DMD pass that option to the linker is with '-L-melf_i386' flag.
Note that many systems separate runtime and development libraries. 32-bit runtime packages are almost always installed by default, but 32-bit development packages may not be.
You need development 32-bit packages to build 32-bit programs. The fact that 32-bit DMD can run does not in itself prove that you have all the 32-bit libraries you need in order to build 32-bit programs.