Open MPI logo

Hardware Locality Users' Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Users mailing list

Subject: Re: [hwloc-users] "-lnuma" missing from pkg-config information?
From: Erik Schnetter (schnetter_at_[hidden])
Date: 2013-01-04 21:57:50


Brice

No, in this case I am not building with --static, and I am not passing
--static to pkg-config either. However, there may be systems where I don't
know whether the compiler (behind my back) uses --static, e.g. Cray or Blue
Gene systems. Is it safe to always use --static with pkg-config?

I determine include paths, library paths, and libraries with the following
shell code:

export
PKG_CONFIG_PATH=${HWLOC_DIR}/lib/pkgconfig:${PCIUTILS_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH}

HWLOC_INC_DIRS="$(echo '' $(pkg-config hwloc --cflags) '' | sed -e 's+
-I/include + +g;s+ -I/usr/include + +g;s+ -I/usr/local/include + +g' | sed
-e 's/ -I/ /g')"
HWLOC_LIB_DIRS="$(echo '' $(pkg-config hwloc --libs) '' | sed -e 's/ -l[^
]*/ /g' | sed -e 's+ -L/lib + +g;s+ -L/lib64 + +g;s+ -L/usr/lib + +g;s+
-L/usr/lib64 + +g;s+ -L/usr/local/lib + +g;s+ -L/usr/local/lib64 + +g' |
sed -e 's/ -L/ /g')"
HWLOC_LIBS="$(echo '' $(pkg-config hwloc --libs) '' | sed -e 's/ -[^l][^
]*/ /g' | sed -e 's/ -l/ /g')"

The sed magic remove /usr/include and similar system paths if they are
present, because having these present can lead to build problems. This does
not affect whether -lnuma is present and not. The magic also removes the
-I, -L, and -l prefixes that my build system insists on adding again (for
historic reasons).

-erik

On Fri, Jan 4, 2013 at 5:30 PM, Brice Goglin <Brice.Goglin_at_[hidden]> wrote:

> What's your compile line and how do you use package config?
> Are you building with --static without passing --static to pkg-config?
> @HWLOC_LIBS@ should only be needed for static linking so putting it in
> Libs.private should be fine (it's returned by "pkg-config --libs --static
> hwloc").
>
> Brice
>
>
>
> Le 04/01/2013 23:25, Erik Schnetter a écrit :
>
> Brice
>
> No, this did not actually work. I was confused. It seems that
> Libs.private is ignored.
>
> Instead, I am now applying the following patch:
>
> --- hwloc-1.6.orig/hwloc.pc.in 2012-11-12 06:33:14.000000000 -0500
> +++ hwloc-1.6/hwloc.pc.in 2013-01-04 10:09:54.000000000 -0500
> @@ -9,4 +9,4 @@
> Requires.private: @HWLOC_REQUIRES@
> Cflags: -I${includedir}
> -Libs: -L${libdir} -lhwloc
> +Libs: -L${libdir} -lhwloc @HWLOC_LIBS@
> Libs.private: @LIBS@
>
> This seems to work.
>
> -erik
>
>
>
> On Fri, Jan 4, 2013 at 10:47 AM, Erik Schnetter <schnetter_at_[hidden]>wrote:
>
>> Brice
>>
>> Yes, this did the trick. Thanks!
>>
>> -erik
>>
>>
>> On Fri, Jan 4, 2013 at 1:33 AM, Brice Goglin <Brice.Goglin_at_[hidden]>wrote:
>>
>>> Hello Erik
>>> I am not a pkgconfig expert but my feeling is that this has buggy for a
>>> long time. hwloc.pc.in should likely use HWLOC_LIBS instead of LIBS. On
>>> my machine, it makes Libs.private change from -dl to -lm -lnuma here (with
>>> -lpci -lxml2 depending on the config). We also need to check whether -ldl
>>> should be kept because of plugin support too.
>>> Can you change LIBS instead HWLOC_LIBS in hwloc.pc.in, rerun configure,
>>> and try again?
>>> Brice
>>>
>>>
>>>
>>> Le 04/01/2013 04:50, Erik Schnetter a écrit :
>>>
>>> I just installed hwloc 1.6 on a Linux Red Hat system. libnuma is
>>> required for linking -- I receive linker errors if I omit -lnuma, and I see
>>> that -lnuma is listed in libhwloc.la under "dependency_libs". However,
>>> pkgconfig/hwloc.pc does not mention libnuma. It does mention libpci, though.
>>>
>>> Does this sound like an error when hwloc.pc is generated, or am I
>>> misunderstanding how pkg-config works? If you give me a pointer, I'd be
>>> happy to try an provide a patch.
>>>
>>> -erik
>>>
>>>
>>> --
>>> Erik Schnetter <schnetter_at_[hidden]>
>>> http://www.perimeterinstitute.ca/personal/eschnetter/
>>>
>>>
>>> _______________________________________________
>>> hwloc-users mailing listhwloc-users_at_[hidden]http://www.open-mpi.org/mailman/listinfo.cgi/hwloc-users
>>>
>>>
>>>
>>
>>
>> --
>> Erik Schnetter <schnetter_at_[hidden]>
>> http://www.perimeterinstitute.ca/personal/eschnetter/
>>
>
>
>
> --
> Erik Schnetter <schnetter_at_[hidden]>
> http://www.perimeterinstitute.ca/personal/eschnetter/
>
>
>

-- 
Erik Schnetter <schnetter_at_[hidden]>
http://www.perimeterinstitute.ca/personal/eschnetter/