Project

General

Profile

Bug #1165

POPT_LIBS and POPT_CFLAGS ignored by configure and the build

Added by Rolf Theunissen about 1 year ago. Updated 3 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
05/24/2018
Due date:
% Done:

100%

Estimated time:

Description

With LTTng-tools 2.10.x

Setting the POPT_LIBS variable is ignored, the configure always checks for '-lpopt' instead of the value specified in POPT_LIBS.

The POPT_CFLAGS options are not added in the compiler options, resulting in '<popt.h>' file not found exceptions.

BTW: The libxml2_LIBS and libxml2_CFLAGS are handled correctly


Files

config.log (341 KB) config.log Rolf Theunissen, 02/14/2019 08:31 AM
0001-RFC-Add-POPT_CFLAGS-to-lttng_CFLAGS.patch (2.91 KB) 0001-RFC-Add-POPT_CFLAGS-to-lttng_CFLAGS.patch Yannick Lamarre, 02/14/2019 05:14 PM

Associated revisions

Revision f541e771 (diff)
Added by Yannick Lamarre 3 months ago

Fix: Add POPT_CFLAGS to lttng_CFLAGS

The generated makefile was ignoring POPT_CFLAGS when compiling
lttng, but was adding POPT_LIBS to lttng_LDADD. With this commit,
make now honors both settings for applications and tests.

Fixes: #1165

Signed-off-by: Yannick Lamarre <>
Signed-off-by: Jérémie Galarneau <>

Revision b6151646 (diff)
Added by Yannick Lamarre 3 months ago

Enforce DL_LIBS value instead of hard coded -ldl

Generated makefiles would ignore DL_LIBS value selected by configure
script and use the hard coded value -ldl. Generated makefiles will
now use DL_LIBS.

Refs: #1165

Signed-off-by: Yannick Lamarre <>
Signed-off-by: Jérémie Galarneau <>

History

#1

Updated by Yannick Lamarre 4 months ago

Hi,
Do you have pkg-config on your system? Also, could you share the generated config.log
Thanks,
YL

#2

Updated by Rolf Theunissen 4 months ago

pkg-config is installed, but pkg data is not available for popt and libxml2. Therefore the configuration is manually specified:

export POPT_CFLAGS="-I/home/user/lttng_source/include"
export POPT_LIBS="-l:libpopt.so.0"

export libxml2_CFLAGS="-I/home/user/lttng_source/include/libxml2"
export libxml2_LIBS="-l:libxml2.so.2"

make finishes with this error:

/opt/windriver/toolchain/bin/../lib/gcc/i686-wrs-linux-gnu/4.8.1/../../../../i686-wrs-linux-gnu/bin/ld: cannot find -lpopt
collect2: error: ld returned 1 exit status
make3: * [lttng] Error 1
make3: Leaving directory `/home/user/lttng_source/lttng-tools-2.10.4/src/bin/lttng'
make2:
[all-recursive] Error 1
make2: Leaving directory `/home/user/lttng_source/lttng-tools-2.10.4/src/bin'
make1:
[all-recursive] Error 1
make1: Leaving directory `/home/user/lttng_source/lttng-tools-2.10.4/src'
make: *
[all-recursive] Error 1

See also the resulting config.log attached

Specifying the following workaround before make works:
export CFLAGS="-g -02 -I/home/user/lttng_source/include"

#3

Updated by Yannick Lamarre 4 months ago

1) Looking through the config.log, it seems that POPT_CFLAGS was not set prior running configure hence why it calls pkg-config to try to set it, fails (because of the missing .pc) and falls back on -lpopt overriding the POPT_LIBS setting. The generated Makefile will use the settings used at configure time. You'll have to rerun configure if you want to change these values and make sure POPT_CFLAGS is non-null if you don't want your settings overriden.
2) I've also investigated the missing POPT_CFLAGS and libpopt is not the only one where some of the flags are assumed and/or unused. So, I'll patch those too before sending a patch.

#4

Updated by Yannick Lamarre 4 months ago

Here is the patch for POPT. This patch HAS TO be applied to code coming from a git-tree (pre-bootstrap code). Can you test it before it is submitted for integration?

#5

Updated by Jonathan Rajotte Julien 4 months ago

  • Status changed from New to Needs feedback
#6

Updated by Rolf Theunissen 4 months ago

To bootstrap in my environment, I had to run:

autoreconf -vi -I /usr/share/pkgconfig/ -I ./m4

After that, the build runs corretly, with the POPT_LIBS and POPT_CFLAGS varialbes taken into account.

#7

Updated by Rolf Theunissen 4 months ago

Rolf Theunissen wrote:

To bootstrap in my environment, I had to run:

autoreconf -vi -I /usr/share/pkgconfig/ -I ./m4

After that, the build runs corretly, with the POPT_LIBS and POPT_CFLAGS varialbes taken into account.

Of course with the patch applied

#8

Updated by Yannick Lamarre 3 months ago

  • % Done changed from 0 to 100
  • Status changed from Needs feedback to Resolved

Also available in: Atom PDF