I am trying to compile a 64 program in 32 bit. It compiles in 64 bit, but gives a few warnings.
The output is:
errol@fermi:~/Desktop/desktop_cleanup/WEGtest$ ./compile5.sh
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.3/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.3/libstdc++.a when searchi
ng for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.3/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.3/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.3.3/…/…/…/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/libstdc++.so when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
I am using it on an Ubuntu 9.04 system. It compiles in 64 bit and does not in 32 bit. The 64 bit compile gives a few warnings, but that is all. I am using Ubuntu 9.04 and it is a 64 bit version on a 64 bit computer. I believe it compiles just fine as a 32 bit gcc only system. it only fails when I include 32 bit CUDA elements.
What is going on here and how can i get it to compile?
I posted a similar question last week on Ubuntu Forum and got suggestions, but none worked.
What library has - -lstdc++ and what directory is it located.
The complier seems to be skipping all libraries that might have -lstdc++. It should not be a surprise that it cannot find .-lstdc++.
libstdc++ is a library. The linker is telling you it cannot find a 32 bit version of the c++ standard library (libstc++) to link against , probably because one is not installed. If you want to compile for 32 bit targets on a 64 bit machine, you need to have the 32 bit versions of those libraries installed. On 64 bit Ubuntu 9.04, the 32bit compatible C++ standard library is provided by the lib32stdc++6 package. Install it and the problem should go away.
I have compiled in 32 and 64 bit on my 64 bit 9.04 with no problem. I simply change the option -m32 or -m64 depending on whether I wanted 32 or 64, respectively. I compiled some 32 bit programs this morning. I know you said something about 32 bit software not running on 64 bit. I have run 32 bit this morning. I believe you told me several months ago how.
If you have not realized it by now (or read the nvcc manual), nvcc uses the C++ compiler to compiler CUDA C code by default. If you want to cross compile using nvcc, you must have a functional C++ (not C) build system for the architecture you are compiling for. Clearly you don’t.
I said no such thing. I warned you that CUDA device code compiled for 32 bit or 64 bit host targets were not interchangeable (despite running on the same card) because the pointer size compiled into the GPU code changes from architecture to architecture. Although this will mean nothing to you, on the device sizeof(void *) = 8 when the host is 64 bits, while sizeof(void *4) =4 if the host is 32 bit. This is despite the fact that current GPUs are 32 bit.
If you cross compile correctly, it will work OK on the target architecture, but the 32 bit program cannot run on the 64 bit host or vice versa, even with the correct libraries. This is not the same as for host code.
Please understand that what you said sounds reasonable. I installed libstdc++6 this morning.
My LD_LIBRARY_PATH is:/usr/local/cuda/lib:
Maybe i , the compiler, is not finding it.
I used the synaptic package manager to install lib32stdc++6 package.on the host computer. I am using it remotely. It should help.
I can only guess at two things. The package was not installed or not installed correctly and/or it was installed and the compiler cannot find it. Hence, the questions as to where the libstdc++6 package is residing.
There is no lib32stdc++6 library in there. So I am assuming the the synaptic package manager must not have installed libstdc++6. I do not know what to think now. I cannot find the library file and the synaptic package manager says it is installed. I assume if I cannot locate on the disk, it is not installed on the disk.
It shouldn’t be - it has nothing to do with CUDA. It is a 32 bit version of the standard library for the C++ compiler. See my earlier post about where to find them.