Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Wrongly I have install ia32-libs but my host system is 64 bit. Now whenever i try to compile c file i get a message

as: unrecognized option '--64'

I have uninstall th ia32-libs but I am getting same error. then I have uninstall the gcc,g++,multilib and build-essenstial using purge command. again install these packages using apt-get command but again same error. When i run "which gcc" command on terminal i get "/usr/bin/gcc " and "which ld" output is "/usr/bin/ld". I guess both outputs are correct.

When i run this command

g++ -v hello hello.c

then output is

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.6/cc1plus -quiet -v -imultilib . -imultiarch x86_64-linux-gnu -D_GNU_SOURCE he.c -quiet -dumpbase he.c -mtune=generic -march=x86-64 -auxbase he -version -fstack-protector -o /tmp/ccIQSmoy.s
GNU C++ (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (x86_64-linux-gnu)
    compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../x86_64-linux-gnu/include"
include "..." search starts here:
include <...> search starts here:
 /usr/include/c++/4.6
 /usr/include/c++/4.6/x86_64-linux-gnu/.
 /usr/include/c++/4.6/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.6/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C++ (Ubuntu/Linaro 4.6.3-1ubuntu5) version 4.6.3 (x86_64-linux-gnu)
    compiled by GNU C version 4.6.3, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 65b5171ac1bd7b3f07dbea6bdb24be3d
COLLECT_GCC_OPTIONS='-v' '-shared-libgcc' '-mtune=generic' '-march=x86-64'
 as --64 -o /tmp/ccXDnoi3.o /tmp/ccIQSmoy.s
**as: unrecognized option '--64'**

Can you tell me how to solve this problem??

share|improve this question
    
Can you add the outputs of which as and as --version as well please. Also your OS version (I'm guessing 12.04 based on the gcc version?) –  steeldriver Jul 25 at 13:17
    
which as output: "/usr/bin/as" as --version output: GNU assembler (GNU Binutils for Ubuntu) 2.22 Copyright 2011 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. This program has absolutely no warranty. This assembler was configured for a target of `arm-linux-gnueabi'. why target is pointing towards my cross compiler?? if this is a error how to correct it?? and, yes, OS is 12.04. –  Aqib Butt Jul 25 at 13:24
    
You could try to re install 'as' on your system with 'sudo apt-get install --reinstall binutils' –  jhilmer Jul 25 at 13:32
    
Please edit your question to add the new information. Yes somehow the arm-linux-gnueabi version of as has got installed as the default /usr/bin/as. How to fix it will depend why that occurred - if you don't actually use/need the ARM toolchain you could simply re-install the binutils package, which should overwrite it with the regular version. Otherwise you will need to do some more investigating - starting with whether /usr/bin/as is a simple file or a symbolic link. –  steeldriver Jul 25 at 13:32
    
Thnx..... By reinstalling binutils my problem is solved. –  Aqib Butt Jul 25 at 13:36

2 Answers 2

The options for gcc is '-m32' or '-m64' to generate code for a 32-bit or 64-bit environment. Not '--64'

share|improve this answer
    
How can i solve my problem? –  Aqib Butt Jul 25 at 13:09
    
i am not running --64 or -m64 as an option. –  Aqib Butt Jul 25 at 13:20
    
You probably have set it somewhere in your environmet. Check that with printenv | grep "\-\-64" –  imbaer Jul 25 at 13:22
    
i got nothing on terminal when i run your command. I run printenv command and check all environments. --64 is not written anywhere. –  Aqib Butt Jul 25 at 13:32
    
There is a problem with my assembler. By re-installing binutils my problem is SOlved –  Aqib Butt Jul 25 at 13:39

There was a problem with my assembler.

When I run as --version

GNU assembler (GNU Binutils for Ubuntu) 2.22 Copyright 2011 Free Software Foundation, Inc. 
This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or later. 
This program has absolutely no warranty. This assembler was configured for a target of `arm-linux-gnueabi'.

My assembler target is mistakenly pointing towards the arm-linux-gnueabi (which was a cross compiler in my case). So, by re-installing binutils my problem was solved.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.