snapcraft can't find modules installed under 'stage' dir

Bug #1541620 reported by Cemil Azizoglu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Invalid
Medium
Sergio Schvezov

Bug Description

A module in a package specified under "stage-packages", for example,

stage-packages:
    - libmirserver-dev

cannot be found, when CMakeLists.txt of a part refers to it by

find_package(PkgConfig)
pkg_check_modules(
    MIRSERVER REQUIRED mirserver
)

I believe pkg-config is looking for it in the system directories, not in the stage directory.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

This requires find_package and pkg_check_modules to be commented out and also

include_directories(
    ${MIRSERVER_INCLUDE_DIRS}
 )

be changed to

include_directories(
    ../stage/usr/include/mirserver
    ../stage/usr/include/mircommon
)

to get things work.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

Note that, to repro the issue, you'll need to revert the yaml back to its original form.

Revision history for this message
Cemil Azizoglu (cemil-azizoglu) wrote :

It may be worth noting that this happened in a clean lxd xenial container.

Changed in snapcraft:
milestone: none → next
Changed in snapcraft:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

|-- sergiusens@lindon:~/source/mir-server-snapcraft2.1 --|
$ PKG_CONFIG_PATH=/home/sergiusens/source/mir-server-snapcraft2.1/stage/lib/pkgconfig:/home/sergiusens/source/mir-server-snapcraft2.1/stage/lib/x86_64-linux-gnu/pkgconfig:/home/sergiusens/source/mir-server-snapcraft2.1/stage/usr/lib/pkgconfig:/home/sergiusens/source/mir-server-snapcraft2.1/stage/usr/lib/x86_64-linux-gnu/pkgconfig:/home/sergiusens/source/mir-server-snapcraft2.1/stage/usr/share/pkgconfig:/home/sergiusens/source/mir-server-snapcraft2.1/stage/usr/local/lib/pkgconfig:/home/sergiusens/source/mir-server-snapcraft2.1/stage/usr/local/lib/x86_64-linux-gnu/pkgconfig:/home/sergiusens/source/mir-server-snapcraft2.1/stage/usr/local/share/pkgconfig: PKG_CONFIG_SYSROOT_DIR=/home/sergiusens/source/mir-server-snapcraft2.1/stage pkg-config mirserver --cflags
Package mirclient was not found in the pkg-config search path.
Perhaps you should add the directory containing `mirclient.pc'
to the PKG_CONFIG_PATH environment variable
Package 'mirclient', required by 'mirserver', not found

I added libmirclient-dev to the stage-packages for server and was able to snap these parts together.

May I suggest a clearer error message in /usr/share/cmake-3.2/Modules/FindPkgConfig.cmake ?

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Does it work for you? Please change the status accordingly

Changed in snapcraft:
status: Triaged → Incomplete
assignee: nobody → Sergio Schvezov (sergiusens)
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

Marking as invalid as I build multiple times just fine.
I'm working on a PR to make this work with build-packages doing some pkg-config fu that might interest you

Changed in snapcraft:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.