Results 1 to 7 of 7
Hello All,
I have an odd thing.
And thats the following:
I entered: gcc raw.c -m32 -g -static -o raw
And I got:
In file included from /usr/include/features.h:371:0,
from /usr/include/sys/socket.h:24,
...
- 05-14-2010 #1
Cross-Platform Compiling Problem (-m32 flag)
Hello All,
I have an odd thing.
And thats the following:
I entered: gcc raw.c -m32 -g -static -o raw
And I got:How do I fix this..?In file included from /usr/include/features.h:371:0,
from /usr/include/sys/socket.h:24,
from raw.c:2:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
compilation terminated.
I installed all bin32 libs I am on a x64 system.
Cheers,
Robin
- 05-14-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You are missing the header file, gnu/stubs-32.h. That should be in the standard header path, so something/someone has either moved or deleted it. You may need to reinstall your compiler suite.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-14-2010 #3
Hey, thanks well Currently I am trying to reinstall all these packages.
However I doubt It works. I think I am missing an package.Code:- lib32-glibc - lib32-libstdc++5 - lib32-glibc-devel - gcc - gcc-libs - cross32-gcc - cross32-binutils - lib32-gcc-libs
So, what package do I miss..? Or is there any compiler flags I am missing..?
Thanks =)
- 05-14-2010 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You are cross-compiling on what type of system (such as x86) for what target system? The -m32 just tells the compiler that you are building for a 32-bit environment, which is why it is trying to include the qnu/stubs-32.h; however, you haven't specified a target architecture, so the default would be for the same as you are building on.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-14-2010 #5
Ok, well that does kinda make sense.
I thought that -m32 did that.
So I did read the manual and some docs online and I figured I'd have to use the command target.Code:% gcc raw.c --target=elf_i386 -m32 -g -static -o raw cc1: error: unrecognized command line option "-ftarget=elf_i386" % uname -a Linux cocytus 2.6.33-ARCH #1 SMP PREEMPT Sun May 2 10:40:03 CEST 2010 x86_64 Pentium(R) Dual-Core CPU T4400 @ 2.20GHz GenuineIntel GNU/Linux
I tried to use x86, i686 and the one it says over there..
I just really need the 32bit version of this app. :/
Thanks =) already for the help.!
- 05-16-2010 #6Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
The man page for the version of gcc that I use, gcc (Debian 4.3.2-1.1) 4.3.2, does not mentionit does mention a stand-alone option:Code:--target= ...
andCode:--target-help
Here is my validation script for 32-bit compile, link, execute on a 64-bit platform, along with a short history of what I installed to get the 32-bit environment:Code:-b machine The argument machine specifies the target machine for compilation.
producing:Code:#!/usr/bin/env bash # @(#) s1 Demonstrate 32-bit compile, link, execute in 64-bit environment. # Infrastructure details, environment, commands for forum posts. set +o nounset LC_ALL=C ; LANG=C ; export LC_ALL LANG echo ; echo "Environment: LC_ALL = $LC_ALL, LANG = $LANG" echo "(Versions displayed with local utility \"version\")" c=$( ps | grep $$ | awk '{print $NF}' ) version >/dev/null 2>&1 && s=$(_eat $0 $1) || s="" [ "$c" = "$s" ] && p="$s" || p="$c" version >/dev/null 2>&1 && version "=o" $p specimen gcc ldd apt-cache policy binutils | head -2 set -o nounset echo FILE=${1-hi.c} # Sample file, with head & tail as a last resort. specimen 7 $FILE \ || { head -5 $FILE ; echo " --" ; tail -5 $FILE; } echo echo " Results:" gcc -m32 $FILE ./a.out echo echo " file a.out:" file a.out echo echo " Libraries used:" ldd a.out echo echo " /lib32 points to:" ls -ld /lib32 echo echo " Sample of items in /emul/ia32-linux/usr/lib/:" ls -1 /emul/ia32-linux/usr/lib/ | specimen 7 echo echo " Type of selected items, crt1.o, libc.so.6:" file /emul/ia32-linux/usr/lib/crt1.o file -L /lib32/libc.so.6 echo echo " Diary: installed 32-bit compatibility items:" cat <<-EOF apt-get install ia32-libs apt-get install lib32stdc++6 apt-get install libc6-dev-i386 apt-get install gcc-multilib apt-get install g++-multilib apt-get install libstdc++5 As noted in (except libstdc++5): http://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu/ EOF exit 0
Best wishes ... cheers, drlCode:% ./s1 Environment: LC_ALL = C, LANG = C (Versions displayed with local utility "version") OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64 Distribution : Debian GNU/Linux 5.0 GNU bash 3.2.39 specimen (local) 1.17 gcc (Debian 4.3.2-1.1) 4.3.2 ldd (GNU libc) 2.7 binutils: Installed: 2.18.1~cvs20080103-7 Whole: 7:0:7 of 7 lines in file "hi.c" #include <stdio.h> int main() { printf(" Hello, world from c.\n"); return( 0 ); } Results: Hello, world from c. file a.out: a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, not stripped Libraries used: linux-gate.so.1 => (0xf7fd6000) libc.so.6 => /lib32/libc.so.6 (0xf7e71000) /lib/ld-linux.so.2 (0xf7fd7000) /lib32 points to: lrwxrwxrwx 1 root root 20 May 27 2009 /lib32 -> /emul/ia32-linux/lib Sample of items in /emul/ia32-linux/usr/lib/: Edges: 7:0:7 of 347 lines in file "-" AuErrorDB Mcrt1.o Scrt1.o crt1.o crti.o crtn.o directfb-1.0-0 --- libz.so.1 libz.so.1.2.3.3 odbc pkgconfig sane sasl2 ssl Type of selected items, crt1.o, libc.so.6: /emul/ia32-linux/usr/lib/crt1.o: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.8, not stripped /lib32/libc.so.6: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.8, stripped Diary: installed 32-bit compatibility items: apt-get install ia32-libs apt-get install lib32stdc++6 apt-get install libc6-dev-i386 apt-get install gcc-multilib apt-get install g++-multilib apt-get install libstdc++5 As noted in (except libstdc++5): http://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu/Welcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 05-22-2010 #7


Reply With Quote