Bug#697695: dpkg-cross fails to match include directories in cflags values of pkg-config files.

Neil Williams <[email protected]>
Newsgroups gmane.linux.debian.devel.embedded
Message-ID <[email protected]>
Package: dpkg-cross
Version: 2.5.8
Severity: normal

The current dpkg-cross conversion of pkg-config files is failing to catch some instances
of /usr/include in the CFLAGS section of the .pc file. This isn't often a problem but
when libraries rely on assembly code (like Qt), the presence of /usr/include in the
command line passed to the cross-compiler preprocessor can cause i386 assembly to be
included into the file to be armel cross compiler:

arm-linux-gnueabi-g++ -c -pipe -g -DQT_SHARED -I/usr/include/qt4 
-I/usr/arm-linux-gnueabi/include/qt4/QtCore 
-Wall -W -D_REENTRANT -fPIC -DQT_DBUS_LIB -DQT_CORE_LIB -I../armel 
-I. -I/usr/arm-linux-gnueabi/include/qt4/QtCore 
-I/usr/arm-linux-gnueabi/include/qt4/QtDBus -I/usr/arm-linux-gnueabi/include/qt4 -I. 
-I/usr/arm-linux-gnueabi/include -o confdata.o confdata.cpp
{standard input}: Assembler messages:
{standard input}:167: Error: bad instruction `lock'
{standard input}:168: Error: bad instruction `incl [r3,#0]'
{standard input}:169: Error: bad instruction `setne [fp,#-5]'
{standard input}:217: Error: bad instruction `lock'
{standard input}:218: Error: bad instruction `decl [r3,#0]'
{standard input}:219: Error: bad instruction `setne [fp,#-5]'

This happens because neither the QJson.pc nor the QtCore.pc files are converted correctly.

The fix needs to handle both the includedir and the Cflags values.

Fixed version of the QJson.pc:

prefix=/usr/arm-linux-gnueabi
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: QJson
Description: QJson is a qt-based library that maps JSON data to QVariant objects
Version: 0.7.1
Requires: QtCore
Libs: -L${libdir} -lqjson
Cflags: -I${includedir}

Fixed version of the QtCore.pc file:

prefix=/usr/arm-linux-gnueabi
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/qt4/QtCore
qt_config=lex yacc warn_on uic resources qt warn_on release incremental
link_prl arm-linux-gnueabi no_mocdepend release stl qt_no_framework
cross_compile system-sqlite release shared dll embedded largefile stl
exceptions_off dylib create_prl link_prl depend_includepath QTDIR_build
nostrip use_libmysqlclient_r qt_install_headers qt warn_on
depend_includepath qmake_cache target_qt create_libtool create_pc
explicitlib moc thread shared dll
moc_location=/usr/bin/moc-qt4
uic_location=/usr/bin/uic-qt4

Name: Qtcore
Description: Qtcore Library
Version: 4.6.3
Libs: -L${libdir} -lQtCore 
Libs.private: -L/usr/lib -L/usr/arm-linux-gnueabi/lib/ -L/usr/lib  -lsqlite3 -ldbus-1 -lpthread -lrt -lpthread -lz -lm -ldl -lrt  
Cflags: -DQT_SHARED -I/usr/arm-linux-gnueabi/include/qt4 -I${includedir}



-- Package-specific info:

-- /etc/dpkg-cross/cross-compile --

#
# /etc/dpkg-cross/cross-compile: configuration for dpkg-cross
#

# default architecture for dpkg-cross (to avoid always typing the -a option
# if you do cross installations only for one architecture)
# Note: default_arch is managed by debconf - it can be overridden
# if ~/.dpkg-cross/cross-compile exists or by specifying an
# architecture on the command line.
# Use '[sudo] dpkg-reconfigure dpkg-cross' to change this value.
#default_arch = 

# All subsequent variables may be removed (and/or become
# unsupported) at any time.

#
# general section: paths of cross compiling environment
#
# you can set the following variables here:
#  crossprefix: prefix for cross compiling binaries; default: $(DEB_HOST_GNU_SYSTEM)-
#  crossbase  : base prefix for the following; default: /usr
#  crossdir   : base directory for architecture; default:
#               $(CROSSBASE)/$(DEB_HOST_GNU_TYPE)
#  crossbin   : dir for binaries; default: $(CROSSDIR)/bin
#  crosslib   : dir for libraries; default: $(CROSSDIR)/lib
#  crossinc   : dir for headers; default: $(CROSSDIR)/include
#  maintainer : maintainer name to pass to original dpkg-buildpackage
#               in -m option. If not set at all, don't pass a -m, thus
#               dpkg-buildpackage will use the name from the changelog
#               file. If set to the special string CURRENTUSER,
#               dpkg-buildpackage will use the name from the
#               changelog, too, but signing the .changes will be done
#               as the current user (default key).
#  removedeps : comma-separated list of package names that should be removed
#               from depends/conflicts/etc fields
#  keepdeps   : comma-separated list of package names that should be kept
#               in depends/conflicts/etc fields as is, without adding
#               -arch-cross.
#
# In preparation for merging dpkg-cross into dpkg, the previous
# defaults have been removed.

-- System Information:
Debian Release: 6.0.6
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-0.bpo.3-686-pae (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dpkg-cross depends on:
ii  binutils-multiarch     2.20.1-16         Binary utilities that support mult
ii  debconf [debconf-2.0]  1.5.36.1          Debian configuration management sy
ii  dpkg-dev               1.16.1.2~bpo60+1  Debian package development tools
ii  libconfig-auto-perl    0.20-2            Magical config file parser
ii  libdebian-dpkgcross-pe 2.5.8             functions to aid cross-compiling D
ii  perl                   5.10.1-17squeeze3 Larry Wall's Practical Extraction 

Versions of packages dpkg-cross recommends:
ii  fakeroot                      1.14.4-1   Gives a fake root environment

dpkg-cross suggests no packages.

-- debconf information:
  dpkg-cross/default-arch: None


-- 


Neil Williams
=============
http://www.linux.codehelp.co.uk/
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAlDsQfoACgkQk7DVr6iX/QLf2gCfWHpnDIOmncM7tpsTsiSFig9G
8NgAoIuO/X3qGE5GfgeTtIMZZ5oYeLEs
=HcBd
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.