Cross compiling with pkg-config

Keith Packard keithp at keithp.com
Mon Oct 6 04:59:45 EEST 2003


Around 13 o'clock on Oct 5, Sven Neumann wrote:

> Since people are successfully cross-compiling software based on
> pkg-config, there seems to exist a sufficient solution already. I can
> ask the build-sys people at convergence how they are doing it...

Maybe I just don't understand how this should work then; it seems 
essentially impossible to cross-compile a shared library that provides a 
.pc file and then build additional packages on top of that one and then 
install the whole mess on the target machine so that future native 
compiles can use the resulting system.

In my cross compile environment, I expect to install all of the files in 
some separate directory (e.g. /usr/arm-linux) so that they don't conflict 
with native packages for the build machine.  Therefore, when using a .pc 
file in a cross-compile environment, that .pc file must point at this 
separate directory when reporting --libs and --cflags.

Now, take that same built library and move it to the target machine for 
native compilation.  Now the .pc file must point at the native directories.

So, I can't build a single set of files for the shared library which can 
be used for both cross and native compilation.  And, building them 
separately seems like a really bad idea -- not using the same files in 
each build environment is likely to lead to accidental incompatibilities.  
Of the whole library, only the .pc file has this property, and it seems 
prudent to make that work rather than going down the other path.

-keith





More information about the xdg mailing list