On 2017-12-22 11:01 +0000, Wookey wrote:
> On 2017-12-21 09:40 +0100, Christian Kandeler wrote:
> And finally, running tests.
> 
> currently my test-case has a product for the library and a
> 'dewalls-test' product for the test binary. But
> 
>         qbs run --settings-dir /tmp --no-build -p dewalls-test \
>            modules.qbs.installRoot:$(PWD)/debian/tmp \
>            project.libDir:lib/$(DEB_HOST_MULTIARCH) \
>            profile:deb qbs-build
> 
> only works if the package is actually installed on the build system,
> otherwise the library is not found:
> 
> qbs run --settings-dir /tmp --no-build -p dewalls-test \
>    
> modules.qbs.installRoot:/home/wookey/packages/cavewhere/dewalls/debian/dewalls-1.0.0/debian/tmp
>  \
>    project.libDir:lib/x86_64-linux-gnu \
>    profile:deb qbs-build
> Restoring build graph from disk
> Installing
> Starting target 
> '/home/wookey/packages/cavewhere/dewalls/debian/dewalls-1.0.0/qbs-build/dewalls-test.deb.384b8e5c/dewalls-test'.
> /home/wookey/packages/cavewhere/dewalls/debian/dewalls-1.0.0/qbs-build/dewalls-test.deb.384b8e5c/dewalls-test:
>  error while loading shared libraries: libdewalls.so.1: cannot open shared 
> object file: No such file or directory
> debian/rules:36: recipe for target 'override_dh_auto_build' failed

It turns out that an rpath is being put in, but it is the final system
rpath: /usr/lib/x86_64-linux-gnu/ which would be good if we were
installing this binary as aprt of the package, but we are not - it's
just a test binary to be run at build-time.

So I fixed this by explicitly setting the rpath:
cpp.rpaths: ["qbs-build/install-root/usr/lib/x86_64-linux-gnu/"]
(because 'qbs run' is run with $PWD in the source dir and that's 
where rpaths have to be relative to).

A better version is:
cpp.rpaths: ["qbs-build/install-root/" + qbs.installPrefix + project.libDir]

but that still has the build dir in it, which seems ugly, so doing it relative 
to the binary seems better still:
cpp.rpaths: ["$ORIGIN/../install-root/" + qbs.installPrefix + project.libDir]

But isn't this exactly what Qbs could be doing for me?  
I suspect I am doing this wrong, and there is a better way.

In the debian build context where we have control of the profile and
build-dir in use this does work fine, but seems clunky.

Wookey
-- 
Principal hats:  Linaro, Debian, Wookware, ARM
http://wookware.org/

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Qbs mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs

Reply via email to