LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 04-02-2005, 04:34 PM   #1
markelo
Member
 
Registered: Mar 2004
Distribution: Red hat 9 -> 64bit fedora
Posts: 190

Rep: Reputation: 30
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.
 
Old 04-14-2005, 03:20 PM   #2
markelo
Member
 
Registered: Mar 2004
Distribution: Red hat 9 -> 64bit fedora
Posts: 190

Original Poster
Rep: Reputation: 30
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?
 
Old 04-14-2005, 04:11 PM   #3
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
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".
 
Old 04-14-2005, 04:20 PM   #4
markelo
Member
 
Registered: Mar 2004
Distribution: Red hat 9 -> 64bit fedora
Posts: 190

Original Poster
Rep: Reputation: 30
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

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?
 
Old 04-15-2005, 12:07 AM   #5
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
What does "cpp -x c++ -v" say?
 
Old 04-15-2005, 12:34 AM   #6
markelo
Member
 
Registered: Mar 2004
Distribution: Red hat 9 -> 64bit fedora
Posts: 190

Original Poster
Rep: Reputation: 30
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.
 
Old 04-15-2005, 02:01 AM   #7
Harmaa Kettu
Member
 
Registered: Apr 2005
Location: Finland
Posts: 196

Rep: Reputation: 30
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).
 
Old 04-15-2005, 12:59 PM   #8
markelo
Member
 
Registered: Mar 2004
Distribution: Red hat 9 -> 64bit fedora
Posts: 190

Original Poster
Rep: Reputation: 30
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

Anyway my compiler trouble case is now closed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
fedora core 4 is loading both x86_64 and i386 packages which screws up apt. radmaxntx Fedora 1 10-05-2005 12:43 PM
x86_64 and i386 neouto Suse/Novell 3 09-08-2005 06:15 AM
GCC 2.95.3 won't compile, Fedora Core 4 x86_64 slantoflight Linux - Software 3 08-31-2005 08:21 PM
i386 or x86_64? rssguy Linux - Newbie 2 04-20-2005 08:42 AM
ut2003 + AMD64 + Fedora core3 x86_64 Game speed too high qwijibow Linux - General 0 12-29-2004 03:02 PM


All times are GMT -5. The time now is 06:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration