LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 10-07-2009, 05:20 AM   #1
pankajdev
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Rep: Reputation: 0
Compiling 32 bit sample program on 64 bit fedora using -m32 option


I have Fedoara 11 install on my PC. I want to compile program as 32 by g++ option -m32. I have 32 bit library install on my machine which present in path

/usr/lib/gcc/x86_64-linux-gnu/4.4.0/32
and 64 bit library is on path
/usr/lib/gcc/x86_64-linux-gnu/4.4.0

When i compile my sample program with -c & -m32 option it compile correctly
c++ -c -m32 Sample.cpp
but when i am trying to create executable by command
c++ Sample.o -m32 -o Sample
then it gives linking error as

/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/libstdc++.a when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/libstdc++.so when searching for -lstdc++
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.4.0/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status

Can anybody please tell me solution for this problem
 
Old 10-07-2009, 05:28 AM   #2
weibullguy
ReliaFree Maintainer
 
Registered: Aug 2004
Location: Kalamazoo, Michigan
Distribution: Slackware-current, Cross Linux from Scratch, Gentoo
Posts: 2,701
Blog Entries: 1

Rep: Reputation: 219Reputation: 219Reputation: 219
You have to explicitly tell the linker to use the libstdc++ in /usr/lib/gcc/x86_64-linux-gnu/4.4.0/32.
 
Old 10-07-2009, 07:42 AM   #3
pankajdev
LQ Newbie
 
Registered: Jul 2009
Posts: 4

Original Poster
Rep: Reputation: 0
How can i explicitly tell linker. I have set that path in LD_LIBRARY_PATH as well as i have given it in -L option while compiling it still it gives same error.

Last edited by pankajdev; 10-07-2009 at 09:29 AM.
 
  


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
[SOLVED] File size limitations of a 32 bit program running under a 64 bit kernel acerostech Linux - Server 1 04-19-2009 10:01 AM
compiling 64 bit kernel in 32 bit environment tytus Linux - Kernel 8 12-11-2008 10:24 AM
compiling 32 bit application on 64 bit linux(x86_64) uttam_h Linux - Software 16 07-19-2008 02:33 PM
32/64 bit libs - FC6/gcc 4.1.1 -m32 picking up 64 bit library marier Fedora 0 04-24-2007 12:57 PM
Assembling a 32 bit sample program in a 64 bit world debiant Programming 0 10-14-2006 02:52 PM


All times are GMT -5. The time now is 02:06 PM.

Main Menu
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