mesonbuild/meson

Meson doesn't set LD_LIBRARY_PATH when executables in builddir are used to run custom_target

オープン

#2,881 opened on 2018/01/05

 (9 件のコメント) (0 件のリアクション) (0 人の担当者)Python (1,465 件のフォーク)batch import
OS:*BSDbugcompilersgeneratorshelp wanted

Repository metrics

Stars
 (4,978 個のスター)
PR merge metrics
 (平均マージ 139d 13h) (30d で 51 merged PRs)

説明

colord uses custom_target to run cd-create-profile to generate icc files during the build. cd-create-profile is an executable built from the same source tree, which should have RPATH set by Meson. However, FreeBSD configures its compiler to pass --enable-new-dtags to the linker, so RPATH are converted to RUNPATH. If users have LD_LIBRARY_PATH set in the environment, it will override RUNPATH and cause cd-create-profile to fail to run because the runtime linker picks the already installed libcolordprivate.so.2 from LD_LIBRARY_PATH instead of the one built in builddir.

$ ninja
[108/215] Generating AppleRGB.icc with a custom command.
FAILED: data/profiles/AppleRGB.icc 
/home/lantw44/gnome/build/colord/client/cd-create-profile --output=data/profiles/AppleRGB.icc data/profiles/AppleRGB.iccprofile.xml
/home/lantw44/gnome/build/colord/client/cd-create-profile: Undefined symbol "cd_icc_set_created"
[109/215] Generating AdobeRGB1998.icc with a custom command.
FAILED: data/profiles/AdobeRGB1998.icc 
/home/lantw44/gnome/build/colord/client/cd-create-profile --output=data/profiles/AdobeRGB1998.icc data/profiles/AdobeRGB1998.iccprofile.xml
/home/lantw44/gnome/build/colord/client/cd-create-profile: Undefined symbol "cd_icc_set_created"
[111/215] Generating BestRGB.icc with a custom command.
FAILED: data/profiles/BestRGB.icc 
/home/lantw44/gnome/build/colord/client/cd-create-profile --output=data/profiles/BestRGB.icc data/profiles/BestRGB.iccprofile.xml
/home/lantw44/gnome/build/colord/client/cd-create-profile: Undefined symbol "cd_icc_set_created"
$ chrpath /home/lantw44/gnome/build/colord/client/cd-create-profile
/home/lantw44/gnome/build/colord/client/cd-create-profile: RUNPATH=$ORIGIN/../lib/colord

It seems there are some similar issues for tests: #1383, #1635.

I know I can workaround it by using a shell script to set LD_LIBRARY_PATH and run cd-create-profile, but it will become a problem if I have to patch all projects using uninstalled executables to run custom_target.

コントリビューターガイド