pkg-config file cross-compile troubles

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Somebody raised this issue on the OpenWrt telephony issue tracker. When
you cross-compile from inside a buildroot you always need to watch out
that no includes and whatnot from the host system are added. So the
pkg-config files need to be OK to use for cross-compile. For instance we
use a pkg-config script which calls the real pkg-config like this:

pkg-config.real --define-variable=prefix=${STAGING_PREFIX} --define-variable=exec_prefix=${STAGING_PREFIX} --define-variable=bindir=${STAGING_PREFIX}/bin $@

This way we update some variables commonly used in the .pc files.

The default libpjproject.pc file that gets installed contains this:

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib
includedir=/usr/include

Name: libpjproject
Description: Multimedia communication library
URL: http://www.pjsip.org
Version: 2.9
Libs: -L${libdir} -lpjsua2 -lpjsua -lpjsip-ua -lpjsip-simple -lpjsip -lpjmedia-codec -lpjmedia -lpjmedia-videodev -lpjmedia-audiodev -lpjmedia -lpjnath -lpjlib-util   -lsrtp2 -lpj -lssl -lcrypto -luuid -lm -lrt -lpthread
Cflags: -I${includedir}   -I/usr/include -DPJ_AUTOCONF=1   -DPJ_IS_BIG_ENDIAN=1 -DPJ_IS_LITTLE_ENDIAN=0 -fPIC -I/home/sk/tmp/openwrt/staging_dir/target-mips_24kc_musl/usr/include

So it contains a hardcoded libdir and includedir and also adds a
hardcoded -I/usr/include into the CFLAGS.

The attached patch fixes all that for us. I'm wondering if this can be
included upstream? If not that's fine, happy to carry the patch locally.

Kind regards,
Seb
--- a/libpjproject.pc.in
+++ b/libpjproject.pc.in
@@ -2,8 +2,8 @@

 prefix=@PREFIX@
 exec_prefix=${prefix}
-libdir=@LIBDIR@
-includedir=@INCLUDEDIR@
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include

 Name: libpjproject
 Description: Multimedia communication library
--- a/build.mak.in
+++ b/build.mak.in
@@ -310,8 +310,7 @@ export PJ_LIBXX_FILES := $(APP_LIBXX_FIL
 # And here are the variables to use if application is using the
 # library from the install location (i.e. --prefix)
 export PJ_INSTALL_DIR := @prefix@
-export PJ_INSTALL_INC_DIR := @includedir@
 export PJ_INSTALL_LIB_DIR := @libdir@
-export PJ_INSTALL_CFLAGS := -I$(PJ_INSTALL_INC_DIR) -DPJ_AUTOCONF=1 @CFLAGS@
+export PJ_INSTALL_CFLAGS := -DPJ_AUTOCONF=1 @CFLAGS@
 export PJ_INSTALL_CXXFLAGS := @CXXFLAGS@ $(PJ_INSTALL_CFLAGS)
 export PJ_INSTALL_LDFLAGS := -L$(PJ_INSTALL_LIB_DIR) $(APP_LDLIBS)
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux