LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   i386 compile with fedora-core3 x86_64? (https://www.linuxquestions.org/questions/programming-9/i386-compile-with-fedora-core3-x86_64-a-309029/)

markelo 04-02-2005 03:34 PM

i386 compile with fedora-core3 x86_64?
 
What packages have to be installed that I can compile i386 binaries using gcc -m32 option? Are there any problems if 32-bit libraries coexists with 64-bit libraries? And same question for headers also?

And now some information about my OS. I installed fc-3 x86_64 heidelberg ( DVD ) with default workstation setup. I only changed partitions. After that I installed ( not upgraded my previous gcc 3.3.x ) gcc 3.4.2. Now I have gcc 3.3.x and 3.4.2 installed. I installed gcc 3.4.2 with rpm using --force option. Was this a wrong procedure and will it cause troubles later? If so how I can go back to state when gcc 3.4.2 wasn't installed?

Thank you for your help.

markelo 04-14-2005 02:20 PM

I found my problem. I have to use -Xlinker -melf_i386 for g++ which instructs linker to use elf_i386 script instead of default script.
But this behavior brings up other questions. Why doesn't -m32 option also change used linking script?
And makefiles...I have nice makefile which causes every cpp-file in make invoked directory to be built as executables. But I can't make that -Xlinker option to work in makefiles. Amu suggestions?

Harmaa Kettu 04-14-2005 03:11 PM

Quote:

Why doesn't -m32 option also change used linking script?
It does. A quick test "gcc -m32 -o hello hello.c" produces a working executable (with multilib gcc 3.4.3).

Your makefile probably does compiling and linking in separate steps, so gcc and CFLAGS are not used in the linking step. Try LD="ld -m elf_i386" or LDFLAGS="-m elf_i386".

markelo 04-14-2005 03:20 PM

Quote:

Originally posted by Harmaa Kettu
It does. A quick test "gcc -m32 -o hello hello.c" produces a working executable (with multilib gcc 3.4.3).

Your makefile probably does compiling and linking in separate steps, so gcc and CFLAGS are not used in the linking step. Try LD="ld -m elf_i386" or LDFLAGS="-m elf_i386".

Will try those gray fox :D

At the momemt here is my command
g++ -m32 -ansi -Wall -Xlinker -melf_i386 -o testi32 -I/usr/include/c++/3.4.2/i386-redhat-linux testi.cpp

Strange thing is that I have to use that -I/usr/include/c++/3.4.2/i386-redhat-linux option for finding headers. It is same for 64-bit compiles also. Is there something wrong with my gcc configuration?

Harmaa Kettu 04-14-2005 11:07 PM

What does "cpp -x c++ -v" say?

markelo 04-14-2005 11:34 PM

Quote:

Originally posted by Harmaa Kettu
What does "cpp -x c++ -v" say?
Code:

Reading specs from /usr/lib/gcc/x86_64-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++,objc,java,f77 --enable-java-awt=gtk --host=x86_64-redhat-linux
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
 /usr/libexec/gcc/x86_64-redhat-linux/3.4.2/cc1plus -E -quiet -v -D_GNU_SOURCE - -mtune=k8
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../include/c++/3.4.2/x86_64-redhat-linux"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../include/c++/3.4.2
 /usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../include/c++/3.4.2/backward
 /usr/local/include
 /usr/lib/gcc/x86_64-redhat-linux/3.4.2/include
 /usr/include
End of search list.

And then it seems to hangup. Have press ctrl+C to quit.

Harmaa Kettu 04-15-2005 01:01 AM

OK,you probably noticed the problem there, x86_64 instead of i386. You need a 64-bit version of the package that contains those headers (libstdc++-devel or something like that).

markelo 04-15-2005 11:59 AM

Quote:

Originally posted by Harmaa Kettu
OK,you probably noticed the problem there, x86_64 instead of i386. You need a 64-bit version of the package that contains those headers (libstdc++-devel or something like that).
Yep. You was right. I now upgraded my gcc 3.4.2 to 3.4.3 and also installed libstdc++.x86_64 and libstdc++-devel.x86_64 3.4.3-22.fc3 versions and then that red-hat-i386 directory was gone but I now have /usr/include/c++/3.4.3/x86_64-redhat-linux directory and compiling works just fine now with only -m32 option used. No more need to add that -Xlinker stuff and -I/usr/blaa/blaa/blaa.

Now I have find a way to make a makefile which would compile every cpp-file in directory and produce 32-bit and 64-bit executables of every source :D

Anyway my compiler trouble case is now closed.


All times are GMT -5. The time now is 04:12 AM.