Target i686 on x86_64 platform

5 replies [Last post]
thirstler
User offline. Last seen 29 weeks 3 days ago. Offline
Joined: 2006-07-07
Posts:

Hello,
In the "./configure; make;" world I'm able to build 32-bit objects on a x86_64 host by setting the appropriate environment variables (CXXFLAGS,LDFLAGS,CPPFLAGS etc) to pass gcc the necessary flags. Using scons, as far as I can tell, the TARGET and ARCH arguments appear to be the way of doing this since scons doesn't use the usual variables (or any environment variables as I understand).

Anyway, if I set TARGET and ARCH ,it churns away showing the flags I specified in the compile lines but the build but dies a short way in, after issuing a g++ command without them. If I manually execute the line with the necessary flags it links up fine.

Death lines:

g++ -shared -o libs/soundtouch/libsoundtouch.so libs/soundtouch/AAFilter.os libs/soundtouch/FIFOSampleBuffer.os libs/soundtouch/FIRFilter.os libs/soundtouch/RateTransposer.os libs/soundtouch/SoundTouch.os libs/soundtouch/TDStretch.os libs/soundtouch/mmx_gcc.os libs/soundtouch/cpu_detect_x86_gcc.os
/usr/bin/ld: warning: i386 architecture of input file `libs/soundtouch/AAFilter.os' is incompatible with i386:x86-64 output

My scons command looks like this:

scons PREFIX=/usr/audio32 VST=1 FFT_ANALYSIS=1 ARCH="-m32 -march=k8 -O2 -pipe -L/usr/audio32/lib -I/usr/audio32/include" DIST_TARGET=i686

I'm not very (and by "very" by that I mean "at all") familiar with scons. Am I approaching this the wrong way?

paul
paul's picture
User offline. Last seen 8 hours 43 min ago. Offline
Joined: 2006-03-16
Posts:

you're approaching it the right way (bar a few minor comments i will make a the end). i believe that the issue here issue here is that our LDFLAGS settings inside scons do not include the flags specified by ARCH. this is a bug on our part, indicative of the rather obscure nature of what you're attempting to do :) we will try to fix it soon.

comments: there should really be no reason to specify the extra include dirs. if scons is not finding things that need to be found, thats probably because PKG_CONFIG_PATH has not been set correctly. we use pkg-config to detect most (though not all) libraries that we need (the exceptions are libs that don't supply .pc files for pkg-config to digest). i also do not understand why you set DIST_TARGET to i686 but -march=k8. these are not the same processors and anything that includes assembler that seeks to identify the processor its running on is likely to run into problems with this. obscure problems perhaps, but problems nevertheless.

what exactly is it that you're trying to do, btw?

thirstler
User offline. Last seen 29 weeks 3 days ago. Offline
Joined: 2006-07-07
Posts:

Well, I'm trying to experiment with VST on Linux without re-installing my x86_64 system :O) The DIST_TARGET I issued was not appropriate and shouldn't be there. My PKG_CONFIG_PATH is set correctly (to a 32-bit install area that includes all of the libraries and builds I'd like to use for audio work - currently occupied by the necessary dependencies for building ardour). The -I's and -L's are a by-product of my occupation, which involves the maintenance of piles of compilers, various MPI implementations and scientific software for a Linux cluster.

Will "-march=k8 -m32" really do what I want anyway? I get 32-bit objects I'm just experimenting here... :) Thanks,

allank
allank's picture
User offline. Last seen 6 weeks 4 days ago. Offline
Joined: 2006-12-07
Posts:

I'm pretty sure what you are trying to achieve needs to be done in a chroot environment.. This requires a bit more than simply compiling as 32-bit.

cheers

sampo
User offline. Last seen 11 weeks 2 days ago. Offline
Joined: 2006-03-16
Posts:

Paul, our build system supports these values for DIST_TARGET:

DIST_TARGET: Build target for cross compiling packagers (auto|i386|i686|x86_64|powerpc|tiger|panther|none)

i686 means a general processor class with SSE optimiziation. There is the one exception of early Athlon models which do not have SSE, but we decided not to care. If thirstler wants a 32 bit build on a k8, he should use "i686" as DIST_TARGET.

thirstler
User offline. Last seen 29 weeks 3 days ago. Offline
Joined: 2006-07-07
Posts:

Ah, so I was doing it backward. I'll use DIST_TARGET instead and see what happens. Thanks.