[cfe-dev] Generating 32-bit Code on 64-bit Linux System

John Criswell criswell at illinois.edu
Tue Sep 13 14:22:59 PDT 2011


On 9/13/11 4:15 PM, Victor Bogado da Silva Lins wrote:
>
> John Criswell<criswell at illinois.edu>  wrote:
>
>> Dear All,
>>
>> I'm trying to compile a "Hello, world!" C++ program on a 64-bit Linux
>> machine into a 32-bit ELF program using Clang as follows:
>>
>> clang++ -o test -m32 test.cpp
>>
>> Unfortunately, I get the following error:
>>
>> /usr/bin/ld: skipping incompatible
>> /usr/lib/gcc/x86_64-redhat-linux6E/4.4.4/libstdc++_nonshared.a when
>> searching for -lstdc++_nonshared
>> /usr/bin/ld: cannot find -lstdc++_nonshared
>>
>> Am I using the correct flags to get clang++ to generate 32-bit code?
>> If
>> so, does anyone know what the problem might be?  Omitting the -m32
>> generates a 64-bit executable correctly.
>>
>> On a related note, is there an LLVM configure option that will generate
>>
>> a clang executable that always generates 32-bit code?
>>
> You probably dont have the 32bit version of the standard lib installed

I think I do:

% yum list libstdc++
...
Installed Packages
libstdc++.i386                       4.1.2-50.el5                      
installed
libstdc++.x86_64                     4.1.2-50.el5                      
installed

Is it possible that the Clang build isn't finding this library?  Does 
anyone know how Clang finds the standard C++ library?

-- John T.

>
>> -- John T.
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list