Bug 14132 - waf install --destdir= --targets= isn't working anymore
Summary: waf install --destdir= --targets= isn't working anymore
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.10.0
Hardware: All All
: P5 major with 1 vote (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-09-18 13:10 UTC by andieq
Modified: 2020-06-18 12:04 UTC (History)
3 users (show)

See Also:


Attachments
samba build - installation fails to install anything useful (638.17 KB, text/plain)
2019-10-18 21:44 UTC, Neil MacLeod
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description andieq 2019-09-18 13:10:11 UTC
We cross-compile samba4 for openwrt and therefor have to set a custom --destdir. We also specify what targets we want, depending on configuration needs.

Since 4.10/11 the waf install behavior changed and now only installs some minor script files and headers this way. In 4.9 all the bins/libs where installed correctly and we could copy from the --destdir.

In 4.10/11 we now need to manually grab the bins/libs from the build-dir/samba4/bin and samba4/bin/shared path.
Comment 1 Neil MacLeod 2019-10-18 21:44:03 UTC
Created attachment 15556 [details]
samba build - installation fails to install anything useful

Sorry for the "me too" but, well... now that I've finally managed to successfully cross-compile 4.10.x I've hit this installation issue too.

I can't confirm if this issue exists in 4.11.x, due to #14164.

With 4.19.3, 

./buildtools/bin/waf install --destdir=$SYSROOT_PREFIX --targets=smbclient

would install the following files:

toolchain/armv7ve-libreelec-linux-gnueabi/sysroot/usr/lib/pkgconfig/smbclient.pc
toolchain/armv7ve-libreelec-linux-gnueabi/sysroot/usr/include/samba-4.0/libsmbclient.h
toolchain/armv7ve-libreelec-linux-gnueabi/sysroot/usr/lib/libsmbclient.so
toolchain/armv7ve-libreelec-linux-gnueabi/sysroot/usr/lib/libsmbclient.so.0
toolchain/armv7ve-libreelec-linux-gnueabi/sysroot/usr/lib/libsmbclient.so.0.4.0

Now with 4.10.9, it installs only the following 2 files:

toolchain/armv7ve-libreelec-linux-gnueabi/sysroot/usr/lib/pkgconfig/smbclient.pc
toolchain/armv7ve-libreelec-linux-gnueabi/sysroot/usr/include/samba-4.0/libsmbclient.h

It's a similar situation with other targets and custom --destdir, eg.

./buildtools/bin/waf install --destdir=$INSTALL --targets="smbclient,client/smbclient,smbtree,nmblookup,testparm,smbd/smbd,nmbd,smbpasswd"

All the binaries and shared object libraries for the targets are not installed to $INSTALL - I'm not actually sure where they're installed, it looks like they're not actually installed.

I'm attaching a complete V=1 build log. The build instructions are here[1].

1. https://github.com/LibreELEC/LibreELEC.tv/blob/78647c7ea57e4312e3292a8e88e6f201cfa7077e/packages/network/samba/package.mk
Comment 2 Neil MacLeod 2019-10-19 06:00:05 UTC
Confirming this is still an issue with 4.11.1 when "cross-compiling" x86_64 -> x86_64 (this build is "successful" as bug #14164 isn't fatal when the host and target arch is the same). Despite the 4.11.1 build completing, no binary or shared object library files are installed.
Comment 3 Andrew Bartlett 2019-12-02 03:34:59 UTC
Most normal linux packages use DESTDIR=... rather than a waf option, but looking at the code that does the same thing.

So I think this is related to the --targets, which is much less used. 

Even fake cross-compiling isn't required, just 'waf install --targets=smbclient --destdir=/tmp/install-samba' will do.

I've checked DESTDIR and the results are not any better.
Comment 4 andieq 2019-12-02 09:49:46 UTC
(In reply to Andrew Bartlett from comment #3)

We at OpenWrt use --targets as a "sane" way to just compile the minimal fileserver package, which is what most users want, without needing to worry about what shared libs belong to which binary/target.

I mean look at the crazy alpine buildfile:
https://github.com/alpinelinux/aports/blob/master/main/samba/APKBUILD

They do a full build and than manually select which shared lib belongs to which target, for there install packages.

We also set DESTDIR=, but the buggy make wrapper does not correctly support setting our --targets.
Comment 5 andieq 2020-06-18 12:04:32 UTC
Just tested 4.12.3 and same issue, libs/bins are not installed via:
./buildtools/bin/waf install \
	--destdir="$(PKG_INSTALL_DIR)" \
	--targets=smbd/smbd

All i get is usr/bin/findsmb and lib/samba/libreplace-samba4.so, instead of all the libs and sbin/smbd.