Skip to contentSkip to conversation

meson: Set up runpath for installed executables

PATCH In review Petri Latvala 4 participants 7 messages Jan 19, 2018 – Mar 12, 2018 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meson: Set up runpath for installed executables

Meson builds libigt as a shared library, and executables naturally have to find it at runtime. Using default options puts the library to a normal search paths, but any modifications to the directory options or a non-conventional prefix setting makes using LD_LIBRARY_PATH or other library search means mandatory.

Add a build option 'use_rpath' (default: false) that makes meson set up DT_RUNPATH at install time, pointing to the library with a path relative to the executable, using $ORIGIN. That way the installed executables find the library even when not installed to exactly the build-time configured prefix path, a setup CI occasionally uses.

Cc Tomi Sarvela <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
---
 meson_options.txt |  4 ++++
 tests/meson.build | 26 ++++++++++++++++++++++++++
 tools/meson.build | 26 ++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 meson_options.txt
meson_options.txt new file +4 -0
new file mode 100644
index 00000000..41be35e0
@@ -0,0 +1,4 @@
+option('use_rpath',
+       type : 'boolean',
+       value : false,
+       description : 'Set runpath on installed executables for libigt.so')
tests/meson.build +26 -0
index 2322217d..b764b7f7 100644
@@ -255,24 +255,49 @@ if alsa.found() and gsl.found()
 	test_deps += alsa
 endif
 
+if get_option('use_rpath')
+	# Set up runpath for the test executables towards libigt.so.
+	# The path should be relative to $ORIGIN so the library is
+	# still found properly even if installed to a path other than
+	# prefix.
+
+	# libdir and libexecdir are pathnames relative to
+	# prefix. meson enforces this.
+
+	# Start from the executable
+	rpathdir = '$ORIGIN'
+	# Executables are installed in libexecdir. Add a .. for each
+	# directory name in it.
+	foreach p : libexecdir.split('/')
+		rpathdir = join_paths(rpathdir, '..')
+	endforeach
+	# Add relative path to libdir
+	rpathdir = join_paths(rpathdir, libdir)
+else
+	rpathdir = ''
+endif
+
 test_executables = []
 
 foreach prog : test_progs
 	test_executables += executable(prog, prog + '.c',
 		   dependencies : test_deps,
 		   install_dir : libexecdir,
+		   install_rpath : rpathdir,
 		   install : true)
 endforeach
 
 test_executables += executable('perf_pmu', 'perf_pmu.c',
 	   dependencies : test_deps + [ lib_igt_perf ],
 	   install_dir : libexecdir,
+	   install_rpath : rpathdir,
 	   install : true)
 test_progs += 'perf_pmu'
 
 executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
 	   dependencies : test_deps,
 	   install_dir : libexecdir,
+	   install_rpath : rpathdir,
 	   install : true)
 test_progs += 'testdisplay'
 
@@ -292,6 +317,7 @@ endforeach
 executable('gem_stress', 'gem_stress.c',
 	   install : true,
 	   install_dir : libexecdir,
+	   install_rpath : rpathdir,
 	   dependencies : igt_deps)
 
 # IMPORTANT: These tests here are all disabled because the result in sometime
tools/meson.build +26 -0
index acd9242d..98366a09 100644
@@ -50,9 +50,32 @@ if libdrm_intel.found()
 	tool_deps += zlib
 endif
 
+if get_option('use_rpath')
+	# Set up runpath for the test executables towards libigt.so.
+	# The path should be relative to $ORIGIN so the library is
+	# still found properly even if installed to a path other than
+	# prefix.
+
+	# libdir and bindir are pathnames relative to prefix. meson
+	# enforces this.
+
+	# Start from the executable
+	rpathdir = '$ORIGIN'
+	# Executables are installed in bindir. Add a .. for each
+	# directory name in it.
+	foreach p : bindir.split('/')
+		rpathdir = join_paths(rpathdir, '..')
+	endforeach
+	# Add relative path to libdir
+	rpathdir = join_paths(rpathdir, libdir)
+else
+	rpathdir = ''
+endif
+
 foreach prog : tools_progs
 	executable(prog, prog + '.c',
 		   dependencies : tool_deps,
+		   install_rpath : rpathdir,
 		   install : true)
 endforeach
 
@@ -63,18 +86,21 @@ if libudev.found()
 	]
 	executable('intel_dp_compliance', sources : intel_dp_compliance_src,
 		   dependencies : [tool_deps, libudev],
+		   install_rpath : rpathdir,
 		   install : true)
 endif
 
 intel_l3_parity_src = [ 'intel_l3_parity.c', 'intel_l3_udev_listener.c' ]
 executable('intel_l3_parity', sources : intel_l3_parity_src,
 	   dependencies : tool_deps,
+	   install_rpath : rpathdir,
 	   install : true)
 
 intel_reg_src = [ 'intel_reg.c', 'intel_reg_decode.c', 'intel_reg_spec.c' ]
 executable('intel_reg', sources : intel_reg_src,
 	   dependencies : tool_deps,
 	   install : true,
+	   install_rpath : rpathdir,
 	   c_args : [
 	     '-DIGT_DATADIR="@0@"'.format(datadir),
 	   ])
Signature · 6 lines
2.14.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#1 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/1] meson: Set up runpath for installed executables

== Series Details ==

== Series Details ==

Series: series starting with [1/1] meson: Set up runpath for installed executables
URL : https://patchwork.freedesktop.org/series/36787/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 51b2ce5f09a58f364e9aa289075ffa8280f23e05 intel_vbt_decode: Typo fixes

with latest DRM-Tip kernel build CI_DRM_3656
6a58f7b0566b drm-tip: 2018y-01m-19d-10h-32m-15s UTC integration manifest

Testlist changes:
+igt@vc4_create_bo@create-bo-0 +igt@vc4_create_bo@create-bo-4096 +igt@vc4_create_bo@create-bo-zeroed +igt@vc4_dmabuf_poll@poll-read-waits-until-write-done +igt@vc4_dmabuf_poll@poll-write-waits-until-write-done +igt@vc4_label_bo@set-bad-handle +igt@vc4_label_bo@set-bad-name +igt@vc4_label_bo@set-kernel-name +igt@vc4_label_bo@set-label +igt@vc4_lookup_fail@bad-color-write +igt@vc4_tiling@get-after-free +igt@vc4_tiling@get-bad-flags +igt@vc4_tiling@get-bad-handle +igt@vc4_tiling@get-bad-modifier +igt@vc4_tiling@set-bad-flags +igt@vc4_tiling@set-bad-handle +igt@vc4_tiling@set-bad-modifier +igt@vc4_tiling@set-get +igt@vc4_wait_bo@bad-bo +igt@vc4_wait_bo@bad-pad +igt@vc4_wait_bo@unused-bo-0ns +igt@vc4_wait_bo@unused-bo-1ns +igt@vc4_wait_bo@used-bo +igt@vc4_wait_bo@used-bo-0ns +igt@vc4_wait_bo@used-bo-1ns +igt@vc4_wait_seqno@bad-seqno-0ns +igt@vc4_wait_seqno@bad-seqno-1ns

Test gem_exec_suspend:

        Subgroup basic-s4-devices:
                pass       -> INCOMPLETE (fi-bdw-5557u) fdo#104162

fdo#104162 https://bugs.freedesktop.org/show_bug.cgi?id=104162

fi-bdw-5557u     total:109  pass:105  dwarn:0   dfail:0   fail:0   skip:3  
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:441s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:383s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:519s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:296s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:501s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:507s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:504s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:482s
fi-elk-e7500     total:224  pass:168  dwarn:10  dfail:0   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:303s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:535s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:397s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:406s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:423s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:471s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:421s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:467s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:507s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:462s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:515s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:641s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:439s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:521s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:536s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:490s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:496s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:441s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:554s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:418s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:256  dwarn:0   dfail:0   fail:3   skip:26  time:572s
fi-glk-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:491s
fi-skl-guc       total:288  pass:216  dwarn:44  dfail:0   fail:0   skip:28  time:415s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_801/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#2 lore raw

[igt-dev] ✗ Fi.CI.IGT: failure for series starting with [1/1] meson: Set up runpath for installed executables

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: series starting with [1/1] meson: Set up runpath for installed executables
URL : https://patchwork.freedesktop.org/series/36787/
State : failure

== Summary ==

Test perf:

        Subgroup blocking:
                fail       -> PASS       (shard-hsw) fdo#102252 +1
        Subgroup oa-exponents:
                fail       -> PASS       (shard-apl) fdo#102254
Test kms_cursor_crc:
        Subgroup cursor-128x128-suspend:
                pass       -> SKIP       (shard-hsw) fdo#103540
        Subgroup cursor-256x256-suspend:
                incomplete -> PASS       (shard-hsw) fdo#103375
Test kms_frontbuffer_tracking:
        Subgroup fbc-1p-offscren-pri-shrfb-draw-blt:
                fail       -> PASS       (shard-snb) fdo#101623
        Subgroup fbc-1p-pri-indfb-multidraw:
                pass       -> FAIL       (shard-snb) fdo#103167
Test kms_3d:
                pass       -> FAIL       (shard-snb)
Test kms_sysfs_edid_timing:
                pass       -> WARN       (shard-apl) fdo#100047
Test gen7_forcewake_mt:
                pass       -> FAIL       (shard-hsw)
Test kms_flip:
        Subgroup 2x-plain-flip-fb-recreate:
                pass       -> INCOMPLETE (shard-hsw)
        Subgroup vblank-vs-suspend:
                pass       -> FAIL       (shard-hsw) fdo#100368
Test gem_eio:
        Subgroup in-flight:
                pass       -> FAIL       (shard-hsw) fdo#104676
Test gem_exec_schedule:
        Subgroup reorder-wide-vebox:
                fail       -> PASS       (shard-apl) fdo#102848
Test gem_tiled_swapping:
        Subgroup non-threaded:
                incomplete -> PASS       (shard-snb) fdo#104218 +1
Test kms_vblank:
        Subgroup wait-forked-busy:
                skip       -> PASS       (shard-snb)

fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102254 https://bugs.freedesktop.org/show_bug.cgi?id=102254
fdo#103540 https://bugs.freedesktop.org/show_bug.cgi?id=103540
fdo#103375 https://bugs.freedesktop.org/show_bug.cgi?id=103375
fdo#101623 https://bugs.freedesktop.org/show_bug.cgi?id=101623
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#104676 https://bugs.freedesktop.org/show_bug.cgi?id=104676
fdo#102848 https://bugs.freedesktop.org/show_bug.cgi?id=102848
fdo#104218 https://bugs.freedesktop.org/show_bug.cgi?id=104218

shard-apl        total:2780 pass:1716 dwarn:1   dfail:0   fail:20  skip:1042 time:14682s
shard-hsw        total:2734 pass:1682 dwarn:1   dfail:0   fail:15  skip:1033 time:13363s
shard-snb        total:2780 pass:1317 dwarn:1   dfail:0   fail:12  skip:1450 time:8092s

Blacklisted hosts:
shard-kbl total:2780 pass:1743 dwarn:94 dfail:1 fail:24 skip:918 time:11151s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_801/shards.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#3 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/1] meson: Set up runpath for installed executables

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: series starting with [1/1] meson: Set up runpath for installed executables
URL : https://patchwork.freedesktop.org/series/36787/
State : success

== Summary ==

IGT patchset tested on top of latest successful build 94bd67c5d6184c435c2fed0bfb39d75b3138b7a8 tools/intel_vbt_decode: update vbt defs from kernel

with latest DRM-Tip kernel build CI_DRM_3663
85f8773e7d77 drm-tip: 2018y-01m-19d-21h-19m-11s UTC integration manifest

No testlist changes.

Test debugfs_test:

        Subgroup read_all_entries:
                pass       -> DMESG-WARN (fi-elk-e7500) fdo#103989 +3
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103989 https://bugs.freedesktop.org/show_bug.cgi?id=103989
fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:428s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:437s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:383s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:526s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:296s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:500s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:505s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:496s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:486s
fi-elk-e7500     total:229  pass:172  dwarn:10  dfail:0   fail:0   skip:46 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:308s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:525s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:399s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:406s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:423s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:470s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:427s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:472s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:504s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:465s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:511s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:637s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:437s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:517s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:539s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:502s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:486s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:443s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:538s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:409s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:256  dwarn:0   dfail:0   fail:3   skip:26  time:567s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:424s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_804/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#4 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/1] meson: Set up runpath for installed executables

In reply to Petri Latvala
== Series Details ==

== Series Details ==

Series: series starting with [1/1] meson: Set up runpath for installed executables
URL : https://patchwork.freedesktop.org/series/36787/
State : success

== Summary ==

IGT patchset tested on top of latest successful build cb2e65dae7e8ca3f388f43aeec3e7d7dc5d2cfb4 man: Update for new igt-dev mailing list

with latest DRM-Tip kernel build CI_DRM_3671
06c8efda323a drm-tip: 2018y-01m-22d-17h-43m-26s UTC integration manifest

No testlist changes.

Test kms_pipe_crc_basic:

        Subgroup suspend-read-crc-pipe-b:
                incomplete -> PASS       (fi-snb-2520m) fdo#103713

fdo#103713 https://bugs.freedesktop.org/show_bug.cgi?id=103713

fi-bdw-5557u     total:288  pass:267  dwarn:0   dfail:0   fail:0   skip:21  time:422s
fi-bdw-gvtdvm    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:427s
fi-blb-e6850     total:288  pass:223  dwarn:1   dfail:0   fail:0   skip:64  time:373s
fi-bsw-n3050     total:288  pass:242  dwarn:0   dfail:0   fail:0   skip:46  time:497s
fi-bwr-2160      total:288  pass:183  dwarn:0   dfail:0   fail:0   skip:105 time:283s
fi-bxt-dsi       total:288  pass:258  dwarn:0   dfail:0   fail:0   skip:30  time:486s
fi-bxt-j4205     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:486s
fi-byt-j1900     total:288  pass:253  dwarn:0   dfail:0   fail:0   skip:35  time:471s
fi-byt-n2820     total:288  pass:249  dwarn:0   dfail:0   fail:0   skip:39  time:465s
fi-elk-e7500     total:224  pass:168  dwarn:9   dfail:1   fail:0   skip:45 
fi-gdg-551       total:288  pass:179  dwarn:0   dfail:0   fail:1   skip:108 time:282s
fi-glk-1         total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:516s
fi-hsw-4770      total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:393s
fi-hsw-4770r     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:405s
fi-ilk-650       total:288  pass:228  dwarn:0   dfail:0   fail:0   skip:60  time:411s
fi-ivb-3520m     total:288  pass:259  dwarn:0   dfail:0   fail:0   skip:29  time:460s
fi-ivb-3770      total:288  pass:255  dwarn:0   dfail:0   fail:0   skip:33  time:413s
fi-kbl-7500u     total:288  pass:263  dwarn:1   dfail:0   fail:0   skip:24  time:458s
fi-kbl-7560u     total:288  pass:269  dwarn:0   dfail:0   fail:0   skip:19  time:503s
fi-kbl-7567u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:452s
fi-kbl-r         total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:505s
fi-pnv-d510      total:288  pass:222  dwarn:1   dfail:0   fail:0   skip:65  time:585s
fi-skl-6260u     total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:432s
fi-skl-6600u     total:288  pass:261  dwarn:0   dfail:0   fail:0   skip:27  time:513s
fi-skl-6700hq    total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:532s
fi-skl-6700k2    total:288  pass:264  dwarn:0   dfail:0   fail:0   skip:24  time:487s
fi-skl-6770hq    total:288  pass:268  dwarn:0   dfail:0   fail:0   skip:20  time:483s
fi-skl-guc       total:288  pass:260  dwarn:0   dfail:0   fail:0   skip:28  time:419s
fi-skl-gvtdvm    total:288  pass:265  dwarn:0   dfail:0   fail:0   skip:23  time:434s
fi-snb-2520m     total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:526s
fi-snb-2600      total:288  pass:248  dwarn:0   dfail:0   fail:0   skip:40  time:410s
Blacklisted hosts:
fi-cfl-s2        total:288  pass:262  dwarn:0   dfail:0   fail:0   skip:26  time:567s
fi-glk-dsi       total:288  pass:257  dwarn:0   dfail:0   fail:1   skip:30  time:486s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_814/issues.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

Acked-by on v1 1/1
#5 lore raw
In reply to Petri Latvala
Quoted 12 lines · Petri Latvala

Meson builds libigt as a shared library, and executables naturally have to find it at runtime. Using default options puts the library to a normal search paths, but any modifications to the directory options or a non-conventional prefix setting makes using LD_LIBRARY_PATH or other library search means mandatory.

Add a build option 'use_rpath' (default: false) that makes meson set up DT_RUNPATH at install time, pointing to the library with a path relative to the executable, using $ORIGIN. That way the installed executables find the library even when not installed to exactly the build-time configured prefix path, a setup CI occasionally uses.

Quoted 3 lines
Cc Tomi Sarvela <[email protected]>
Cc Arkadiusz Hiler <[email protected]>

Not exactly the most knowledgeable person in this area, but still:

Quoted 145 lines
---
 meson_options.txt |  4 ++++
 tests/meson.build | 26 ++++++++++++++++++++++++++
 tools/meson.build | 26 ++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 meson_options.txt
meson_options.txt new file +4 -0
new file mode 100644
index 00000000..41be35e0
@@ -0,0 +1,4 @@
+option('use_rpath',
+       type : 'boolean',
+       value : false,
+       description : 'Set runpath on installed executables for libigt.so')
tests/meson.build +26 -0
index 2322217d..b764b7f7 100644
@@ -255,24 +255,49 @@ if alsa.found() and gsl.found()
 	test_deps += alsa
 endif
 
+if get_option('use_rpath')
+	# Set up runpath for the test executables towards libigt.so.
+	# The path should be relative to $ORIGIN so the library is
+	# still found properly even if installed to a path other than
+	# prefix.
+
+	# libdir and libexecdir are pathnames relative to
+	# prefix. meson enforces this.
+
+	# Start from the executable
+	rpathdir = '$ORIGIN'
+	# Executables are installed in libexecdir. Add a .. for each
+	# directory name in it.
+	foreach p : libexecdir.split('/')
+		rpathdir = join_paths(rpathdir, '..')
+	endforeach
+	# Add relative path to libdir
+	rpathdir = join_paths(rpathdir, libdir)
+else
+	rpathdir = ''
+endif
+
 test_executables = []
 
 foreach prog : test_progs
 	test_executables += executable(prog, prog + '.c',
 		   dependencies : test_deps,
 		   install_dir : libexecdir,
+		   install_rpath : rpathdir,
 		   install : true)
 endforeach
 
 test_executables += executable('perf_pmu', 'perf_pmu.c',
 	   dependencies : test_deps + [ lib_igt_perf ],
 	   install_dir : libexecdir,
+	   install_rpath : rpathdir,
 	   install : true)
 test_progs += 'perf_pmu'
 
 executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
 	   dependencies : test_deps,
 	   install_dir : libexecdir,
+	   install_rpath : rpathdir,
 	   install : true)
 test_progs += 'testdisplay'
 
@@ -292,6 +317,7 @@ endforeach
 executable('gem_stress', 'gem_stress.c',
 	   install : true,
 	   install_dir : libexecdir,
+	   install_rpath : rpathdir,
 	   dependencies : igt_deps)
 
 # IMPORTANT: These tests here are all disabled because the result in sometime
tools/meson.build +26 -0
index acd9242d..98366a09 100644
@@ -50,9 +50,32 @@ if libdrm_intel.found()
 	tool_deps += zlib
 endif
 
+if get_option('use_rpath')
+	# Set up runpath for the test executables towards libigt.so.
+	# The path should be relative to $ORIGIN so the library is
+	# still found properly even if installed to a path other than
+	# prefix.
+
+	# libdir and bindir are pathnames relative to prefix. meson
+	# enforces this.
+
+	# Start from the executable
+	rpathdir = '$ORIGIN'
+	# Executables are installed in bindir. Add a .. for each
+	# directory name in it.
+	foreach p : bindir.split('/')
+		rpathdir = join_paths(rpathdir, '..')
+	endforeach
+	# Add relative path to libdir
+	rpathdir = join_paths(rpathdir, libdir)
+else
+	rpathdir = ''
+endif
+
 foreach prog : tools_progs
 	executable(prog, prog + '.c',
 		   dependencies : tool_deps,
+		   install_rpath : rpathdir,
 		   install : true)
 endforeach
 
@@ -63,18 +86,21 @@ if libudev.found()
 	]
 	executable('intel_dp_compliance', sources : intel_dp_compliance_src,
 		   dependencies : [tool_deps, libudev],
+		   install_rpath : rpathdir,
 		   install : true)
 endif
 
 intel_l3_parity_src = [ 'intel_l3_parity.c', 'intel_l3_udev_listener.c' ]
 executable('intel_l3_parity', sources : intel_l3_parity_src,
 	   dependencies : tool_deps,
+	   install_rpath : rpathdir,
 	   install : true)
 
 intel_reg_src = [ 'intel_reg.c', 'intel_reg_decode.c', 'intel_reg_spec.c' ]
 executable('intel_reg', sources : intel_reg_src,
 	   dependencies : tool_deps,
 	   install : true,
+	   install_rpath : rpathdir,
 	   c_args : [
 	     '-DIGT_DATADIR="@0@"'.format(datadir),
 	   ])
Signature · 6 lines
2.14.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Reviewed-by Tested-by on v1 1/1
#6 lore raw
In reply to Petri Latvala
Quoted 48 lines · Petri

Meson builds libigt as a shared library, and executables naturally have to find it at runtime. Using default options puts the library to a normal search paths, but any modifications to the directory options or a non-conventional prefix setting makes using LD_LIBRARY_PATH or other library search means mandatory.

Add a build option 'use_rpath' (default: false) that makes meson set up DT_RUNPATH at install time, pointing to the library with a path relative to the executable, using $ORIGIN. That way the installed executables find the library even when not installed to exactly the build-time configured prefix path, a setup CI occasionally uses.

Cc Tomi Sarvela <[email protected]>
Cc Arkadiusz Hiler <[email protected]>
---
 meson_options.txt |  4 ++++
 tests/meson.build | 26 ++++++++++++++++++++++++++
 tools/meson.build | 26 ++++++++++++++++++++++++++
 3 files changed, 56 insertions(+)
 create mode 100644 meson_options.txt
meson_options.txt new file +4 -0
new file mode 100644
index 00000000..41be35e0
@@ -0,0 +1,4 @@
+option('use_rpath',
+       type : 'boolean',
+       value : false,
+       description : 'Set runpath on installed executables for libigt.so')
tests/meson.build +8 -0
index 2322217d..b764b7f7 100644
@@ -255,24 +255,49 @@ if alsa.found() and gsl.found()
 	test_deps += alsa
 endif
 
+if get_option('use_rpath')
+	# Set up runpath for the test executables towards libigt.so.
+	# The path should be relative to $ORIGIN so the library is
+	# still found properly even if installed to a path other than
+	# prefix.
+
+	# libdir and libexecdir are pathnames relative to
+	# prefix. meson enforces this.

tests/meson.build if alsa.found() and gsl.found() · line 275

Quoted 10 lines
tests/meson.build +10 -0
+
+	# Start from the executable
+	rpathdir = '$ORIGIN'
+	# Executables are installed in libexecdir. Add a .. for each
+	# directory name in it.
+	foreach p : libexecdir.split('/')
+		rpathdir = join_paths(rpathdir, '..')
+	endforeach
+	# Add relative path to libdir
+	rpathdir = join_paths(rpathdir, libdir)

Theoretically there is $LIB which:
"They will be replaced by [...] or either lib - for 32-bit binaries - or lib64 - for 64-bit binaries - in the case of $LIB"

But I think I like current soultion more.

I'll push it in a minute.

I've learend something today, thanks!

Signature · 6 lines
Cheers,
Arek
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev