cross-compile and pkgconfig

malet jean-luc alias cityhunter jlm_devel at
Fri Sep 16 09:09:55 PDT 2005

Enrico Weigelt a écrit :

>* malet jean-luc <jean.luc.malet at> schrieb:
>>in my mind : crosscompiling
>>usually you do a
>>./configure --prefix=/usr
>>export DESTDIR=/path/to/embedded/FS
>>make install
>>this insure that all libtool and pkgconfig contain the right value (so 
>>that you can boot on the target and compile new package fine) but the 
>>issue is that querying the pkg-config about flags returns.... Host 
>>directory.... which means that everything will fail awfully....
>For clean crosscompiling you should use a sysroot'ed toolchain.
>(crosstool is your friend for creating one).
this might be not a good idea..... because with crosstool you have only 
one sysroot per compile chain.... but you often need lot more.... if you 
work into a company you have to work with others.... there is often a 
"reference tree" that contains the applications integrated, and 
"development trees" (you can even have several devel trees if working on 
lot of small functionalities that aren't related, or sharing some devel 
trees...) that why often software are compiled with --nostdinc with 
rights -I and -L.... it's personal experience I'm talking about....

>You can adjust pkg-config's search pathes (PKG_CONFIG_LIBDIR,
>PKG_CONFIG_PATH). And of you probly have to filter the output of 
>pkg-config to add the sysroot prefix.
>See attached script - you can use it as pkg-config frontend by 
>setting the PKG_CONFIG variable (most packges should understand that)
but some don't.... filtering is good but I think that the best thing is 
to include it into pkg-config directly (it should be really easy)
one way is to move pkg-config elsewhere and to replace it with you 
script (renamed pkg-config) but again I find this not satisfying....

>>so I think that a good behaviour is to getenv(DESTDIR)
>>and to change prefix to DESTDIR/prefix when outputing result....
>No, that's a very bad way. $DESTDIR is *NOT* the place where we 
>have to take everything from - it's the place where the freshly 
>built package goes to. I personally use $SYSROOT instead.
if you want.... I taken DESTDIR beacause it was the name of a variable 
everyone knows about....
SYSROOT is fine with me I think this is a really good name....
thanks for the script....
I'll see if I can make a patch to pkgconfig to use SYSROOT directly.... 
without wrapper.... so that people won't ask themself the questions that 
taken me lot of time to answer.....


More information about the pkg-config mailing list