We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3575 - Configure uses wrong pkg-config when cross compiling
Summary: Configure uses wrong pkg-config when cross compiling
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: build (show other bugs)
Version: HG 2.1
Hardware: All Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-30 21:54 UTC by zub
Modified: 2019-03-17 00:40 UTC (History)
1 user (show)

See Also:


Attachments
Use host system pkg-config when (cross-)compiling (21.49 KB, patch)
2019-02-03 09:13 UTC, Hugh McMaster
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description zub 2017-01-30 21:54:08 UTC
SDL's configure script is hardcoded to use "pkg-config" when searching for packages. This can break cross compilation.

It is the case when e.g. cross-compiling on Debian: the native libraries can be found via pkg-config, and the target libraries can be found via ${HOST}-pkg-config. Using pkg-config in this case pulls in native (build system's) libraries.

Ideally SDL would use PKG_CHECK_MODULES Autotools macro. If this is not possible, please consider searching for "${HOST}-pkg-config" first and only then fall back to "pkg-config".

The issue can be seen for example here: http://hg.libsdl.org/SDL/file/c63a2f755921/configure.in#l888

It's possible to work around this issue by setting the environment variable PKG_CONFIG to the full path to the pkg-config executable to use.
Comment 1 Sam Lantinga 2017-08-11 17:57:40 UTC
Can you provide a tested patch that implements this?

Thanks!
Comment 2 Hugh McMaster 2019-02-03 09:13:56 UTC
Created attachment 3595 [details]
Use host system pkg-config when (cross-)compiling

Since this is still a problem, I've prepared a patch so that libsdl2 uses the host system's pkg-config when compiling.

The patch also converts the existing pkg-config calls to use the PKG_CHECK_MODULES macro.
Comment 3 Hugh McMaster 2019-03-03 09:18:58 UTC
Hi Sam,

Any chance of a review on this patch?

Thank you
Comment 4 Hugh McMaster 2019-03-05 12:59:45 UTC
Would it be more helpful if I submitted an archive of patches for each PKG_CHECK_MODULES conversion instead of one large patch?
Comment 5 Sam Lantinga 2019-03-17 00:40:16 UTC
Your patch is in:
https://hg.libsdl.org/SDL/rev/df6da910d4d8

I added the pkg-config macros here:
https://hg.libsdl.org/SDL/rev/1e4dd5933351

Thanks!