Unlike bug 682560, this occurs even when sssd is being built against samba 4.10.6. The fix for this, which I have reported to upstream as well, is patching src/external/samba.m4 in order for the idmap test program to be buildable. However, stable releases such as 2.2.0 already generate a configure from that file, so patching is required as well for it. Adding libreplace-samba4 and libsmbd-shim-samba4 to the libs for the program to be built results in a working test which produces a result that is accepted by sssd's configure.
Upstream bug report: https://pagure.io/SSSD/sssd/issue/4072
I can't build this even with the patch, looks like my system (~amd64) utterly fails to find /usr/lib64/samba/libsmbd-shim-samba4.so when trying to run the conftest executable. Interestingly enough, an ldd of /usr/lib64/samba/libidmap-samba4.so shows /usr/lib64/samba/libsmbd-shim-samba4.so as not found. I'm re-emerging samba just in case there was something strange happening at link-time that a runpath wasn't set properly in Samba, or something.
Interesting. Re-emerging samba-4.10.8 fixed the strange linking problem. I can confirm I was able to merge sssd after adding the patch and re-emerging samba-4.10.8.
Odd. With sssd-2.2.2 and samba-4.11.1, re-emerging samba no longer fixes the problem. I made sure the patch for adding the extra dependencies applied for sssd-2.2.2. I recompiled the conftest binary using the command: x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe -fomit-frame-pointer -march=native -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I/usr/include/samba-4.0 -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -I/usr/include/samba-4.0 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -Wl,-O1 -Wl,--as-needed -Wl,--allow-shlib-undefined conftest.c -L/usr/lib64/samba -lidmap-samba4 -lreplace-samba4 -lsmbd-shim-samba4 -Wl,-rpath /usr/lib64/samba And ldd still reports: libsmbd-shim-samba4.so => not found If I explicitly add LD_LIBRARY_PATH=/usr/lib64/samba when calling ./conftest, it all works (as expected, I think).
Alright, this is interesting. After updating to samba-4.11.2, sssd compiled with the patches in the upstream bug report. I haven't tried to see if it compiles without the patches.
(In reply to Gabriel Marcano from comment #3) > Interesting. Re-emerging samba-4.10.8 fixed the strange linking problem. I > can confirm I was able to merge sssd after adding the patch and re-emerging > samba-4.10.8. Same here reemerge samba fixed it. There must be a problem with the samba build as ldd reports not found for both those libs even though RUNPATH is set. I suspect it happens going from samba 4.9.x to 4.10.x One even need to patch sssd once samba is rebuilt correctly The bug should be moved to samba-4.10 There is another problem with sssd I think, now I see: configure:21812: x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -I/usr/include/samba-4.0 -Wl,-O1 -Wl,--as-needed conftest.c -L/usr/lib64/samba -lidmap-samba4 -Wl,-rpath /usr/lib64/samba >&5 configure:21812: $? = 0 configure:21812: ./conftest Failed to register idmap module. The module was compiled against SMB_IDMAP_INTERFACE_VERSION 5, current SMB_IDMAP_INTERFACE_VERSION is 6. Please recompile against the current version of samba! Called with NULL pointer or empty name!
Added a $(use_with samba smb-idmap-interface-version=6) to sssd and then got: configure:21677: $? = 0 configure:21723: result: yes configure:21833: Samba's idmap interface version: 6 configure:21844: Samba version: 4 10 10 configure:21852: Samba's struct idmap_domain has dom_sid member
According to https://pagure.io/SSSD/sssd/issue/3741, as of samba 4.7.1 got IDMAP version 6
(In reply to Joakim Tjernlund from comment #6) > (In reply to Gabriel Marcano from comment #3) > > Interesting. Re-emerging samba-4.10.8 fixed the strange linking problem. I > > can confirm I was able to merge sssd after adding the patch and re-emerging > > samba-4.10.8. > > Same here reemerge samba fixed it. There must be a problem with the samba > build > as ldd reports not found for both those libs even though RUNPATH is set. > > I suspect it happens going from samba 4.9.x to 4.10.x > One even need to patch sssd once samba is rebuilt correctly > > The bug should be moved to samba-4.10 > > There is another problem with sssd I think, now I see: > configure:21812: x86_64-pc-linux-gnu-gcc -o conftest -O2 -pipe > -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE > -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 > -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 > -I/usr/include/samba-4.0 -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 > -DHAVE_IMMEDIATE_STRUCTURES=1 -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 > -D_GNU_SOURCE=1 -DHAVE_IMMEDIATE_STRUCTURES=1 -I/usr/include/samba-4.0 > -Wl,-O1 -Wl,--as-needed conftest.c -L/usr/lib64/samba -lidmap-samba4 > -Wl,-rpath /usr/lib64/samba >&5 > configure:21812: $? = 0 > configure:21812: ./conftest > Failed to register idmap module. > The module was compiled against SMB_IDMAP_INTERFACE_VERSION 5, > current SMB_IDMAP_INTERFACE_VERSION is 6. > Please recompile against the current version of samba! > Called with NULL pointer or empty name! I think the above msg is just part of the probing and version 6 is selected eventually
(In reply to Joakim Tjernlund from comment #7) > Added a $(use_with samba smb-idmap-interface-version=6) to sssd and then got: > I ran into the same problem after i was forced by net-fs/samba-4.11.6-r2 to add the "json" USE-flag because the following QUIRED_USE flag constraints are unsatisfied: addc? ( json ) After the USE-change and rebuild of Samba sys-auth/sssd-2.2.3 did not build because of this idmap-issue After adding the above "$(use_with ...)" to the ebuild sssd did build again.
(In reply to Stefan Trenker from comment #10) > (In reply to Joakim Tjernlund from comment #7) > > Added a $(use_with samba smb-idmap-interface-version=6) to sssd and then got: > > > > I ran into the same problem after i was forced by > net-fs/samba-4.11.6-r2 to add the "json" USE-flag because the following > QUIRED_USE flag constraints are unsatisfied: addc? ( json ) > > After the USE-change and rebuild of Samba sys-auth/sssd-2.2.3 did not build > because of this idmap-issue > > After adding the above "$(use_with ...)" to the ebuild sssd did build again. I belived the dynamic idmap test is broken, possibly only on Gentoo, so just tell sssd what version to use and the problem is gone.
just was upgraded to samba 4.11.6-r2 (-json on the use flags). then updating sssd 1.16.3-r3 (amd64) and 2.2.3 (~amd64) both died with this config error.
.... and reinstalling samba (emerge -1 samba) fixed this. was able to install either sssd 1.16.3-r3 and 2.2.3
correction... sssd 1.16.3-r3 dies in compilation due to ARRAY_SIZE being undefined. staying w/ 2.2.3.
I have the same problem with sssd 2.2.3. Recompiling samba to see if it works afterwards...
Yep, the issue is back for me as well, and recompiling samba multiple times isn't fixing it.
OK, I've done more poking around, since the issue hasn't gone away and sssd is getting in my way (emerge -acv won't do its job since it finds sssd still hasn't updated). The problem is in Samba, specifically, /usr/lib64/libsmbldap.so.2 should have its RUNPATH set to /usr/lib64/samba/ but it's not. Without that RUNPATH that .so doesn't know how to find the libraries it needs (libreplace-samba4.so and libsmbd-shim-samba4.so). Other samba .so files do have their RUNPATH set properly.
Created attachment 629606 [details, diff] smbldap-rpath.patch I'm attaching a patch for samba that fixes this particular issue. In essence, tell Samba that libsmbldap needs more dependencies (I'm not exactly sure how many it needs exactly, but the deps listed are the ones that were missing on my system). sssd still doesn't compile, it's choking on compilation, looks like Samba changed its ndr.h header recently, specifically by this commit (https://github.com/samba-team/samba/commit/e08461b2845183224b9775b54be4acaaba705ecd). The error I'm getting: src/providers/ad/ad_gpo_ndr.c:108:13: error: implicit declaration of function ‘ndr_pull_get_switch_value’; did you mean ‘ndr_pull_set_switch_value’?
Created attachment 629608 [details, diff] samba_ndr.patch Sorry for my crappy naming, but this patch is for sssd, it is necessary for SSSD in order for it to build against latest unstable Samba. It addresses my previous comments about NDR changing.
Created attachment 629610 [details, diff] krb5_pac_responder.patch While I'm at it, this is another fix to the build. Using latest mit-krb5, I noticed it wasn't being picked up properly during configure. It looks like SSSD's build system has a hard-coded list of mit-krb5 versions it looks up, and the latest 1.18 wasn't on that list. I'm not sure if adding the latest version breaks something down the road, but at the very least everything does compile and configure stops complaining.
I was able to compile samba and sssd by applying the three attached patches as user patches. In summary: samba needs: smbldap-rpath.patch sssd needs: samba_ndr.patch krb5_pac_responder.patch
(In reply to Gabriel Marcano from comment #19) > Created attachment 629608 [details, diff] [details, diff] > samba_ndr.patch > > Sorry for my crappy naming, but this patch is for sssd, it is necessary for > SSSD in order for it to build against latest unstable Samba. It addresses my > previous comments about NDR changing. FYI, looking at upstream sssd git, this fix seems to simple.
As another data point, as this problem seems very strange: I was having the same issue building sssd-2.2.3 against samba-4.11.6-r2, using gcc-9.2.0-r2 and binutils-2.32-r1 on amd64. If I did ldd on /usr/lib64/libidmap-samba4.so, it could not find libreplace-samba4.so nor libsmbd-shim-samba4.so. Rebuilding samba seemed to correct the linking to libreplace-samba4.so, but not to libsmbd-shim-samba4.so. However, I don't understand why because we are disabling rpath for the samba builds. I rebuilt several times, and the problem linking libsmbd-shim-samba4.so never went away. I also had gcc-9.3.0 and binutils-2.33.1-r1 installed on this system, but they were not yet default, due to depclean not running properly due to the old sssd still being installed. If I changed the default to these versions, and rebuilt samba, the linking for libidmap-samba4.so is now correct. And, I can build sssd successfully.
I just ran into this problem again, on a x86-32 build machine. This time, the binutils and gcc were already up-to-date -- so it somewhat disproves my earlier observations. In this case, the only way I could get the samba libraries to be linked in such a way to get the sssd configure script to find the idmap interface was to first unmerge samba and anything that was keeping its libraries preserved. When samba was fully removed, a new build of it resulted in libraries that were correctly linked. This seems to suggest that an installed version of samba interferes somehow with the correct linking process. I am going to try to reproduce this problem again, and then compare build logs between a non-working and working build to see if there are any differences.
Created attachment 641668 [details, diff] /etc/portage/patches/sys-auth/sssd/692800.patch hitting this issue again w/ samba 4.11.8 and sssd 2.2.3. re #c4 & #c17: lddtree shows all the library paths for samba libs as found whereas ldd sorta does... if you grep the not found names, they do get resolved properly when resolving via deps (why lddtree doesn't show anything not found, afaiu). here's an example: $ ldd /usr/lib64/libsmbldap.so.2 | grep libsmbd-shim-samba4 libsmbd-shim-samba4.so => not found libsmbd-shim-samba4.so => /usr/lib64/samba/libsmbd-shim-samba4.so (0x00007fcc2e65c000) $ ldd /usr/lib64/libsmbldap.so.2 | grep libreplace-samba4 libreplace-samba4.so => not found libreplace-samba4.so => /usr/lib64/samba/libreplace-samba4.so (0x00007fc929f29000) this all said, https://github.com/SSSD/sssd/issues/5040 is the right working fix for me given all this. i made this into a patch that i put in /etc/portage/patches/sys-auth/sssd to unblock things until that upstream issue is resolved.
Comment on attachment 641668 [details, diff] /etc/portage/patches/sys-auth/sssd/692800.patch --- a/src/external/samba.m4 2020-05-25 03:05:00.774374354 -0700 +++ b/src/external/samba.m4 2020-05-25 03:05:45.620224889 -0700 @@ -60,7 +60,7 @@ SAVE_CFLAGS=$CFLAGS SAVE_LIBS=$LIBS CFLAGS="$CFLAGS $SMBCLIENT_CFLAGS $NDR_NBT_CFLAGS $NDR_KRB5PAC_CFLAGS" - LIBS="$LIBS -L${sambalibdir} -lidmap-samba4 -Wl,-rpath ${sambalibdir}" + LIBS="$LIBS -L${sambalibdir} -lidmap-samba4 -lreplace-samba4 -lsmbd-shim-samaba4 -Wl,-rpath ${sambalibdir}" AC_RUN_IFELSE( [AC_LANG_SOURCE([ #include <stdlib.h>
Comment on attachment 641668 [details, diff] /etc/portage/patches/sys-auth/sssd/692800.patch autoconf strikes again. redoing patch..
Created attachment 641688 [details, diff] /etc/portage/patches/sys-auth/sssd/692800.patch corrected for autoconf shenanigans
Comment on attachment 641688 [details, diff] /etc/portage/patches/sys-auth/sssd/692800.patch ugh.. typo in patch. will repost with correct things once fully confirmed.
> > re #c4 & #c17: lddtree shows all the library paths for samba libs as found > whereas ldd sorta does... if you grep the not found names, they do get > resolved properly when resolving via deps (why lddtree doesn't show anything > not found, afaiu). here's an example: > > $ ldd /usr/lib64/libsmbldap.so.2 | grep libsmbd-shim-samba4 > libsmbd-shim-samba4.so => not found > libsmbd-shim-samba4.so => /usr/lib64/samba/libsmbd-shim-samba4.so > (0x00007fcc2e65c000) > > $ ldd /usr/lib64/libsmbldap.so.2 | grep libreplace-samba4 > libreplace-samba4.so => not found > libreplace-samba4.so => /usr/lib64/samba/libreplace-samba4.so > (0x00007fc929f29000) > > > this all said, https://github.com/SSSD/sssd/issues/5040 is the right working > fix for me given all this. i made this into a patch that i put in > /etc/portage/patches/sys-auth/sssd to unblock things until that upstream > issue is resolved. It is the missing RUNPATH in libsmbldap , ldd "excutes" on lib at at time and the first time no lib has runpath set to /usr/lib64/samba You should fix samba instead, use the patch in #18
(In reply to Joakim Tjernlund from comment #30) > > > > re #c4 & #c17: lddtree shows all the library paths for samba libs as found > > whereas ldd sorta does... if you grep the not found names, they do get > > resolved properly when resolving via deps (why lddtree doesn't show anything > > not found, afaiu). here's an example: > > > > $ ldd /usr/lib64/libsmbldap.so.2 | grep libsmbd-shim-samba4 > > libsmbd-shim-samba4.so => not found > > libsmbd-shim-samba4.so => /usr/lib64/samba/libsmbd-shim-samba4.so > > (0x00007fcc2e65c000) > > > > $ ldd /usr/lib64/libsmbldap.so.2 | grep libreplace-samba4 > > libreplace-samba4.so => not found > > libreplace-samba4.so => /usr/lib64/samba/libreplace-samba4.so > > (0x00007fc929f29000) > > > > > > this all said, https://github.com/SSSD/sssd/issues/5040 is the right working > > fix for me given all this. i made this into a patch that i put in > > /etc/portage/patches/sys-auth/sssd to unblock things until that upstream > > issue is resolved. > > It is the missing RUNPATH in libsmbldap , ldd "excutes" on lib at at time > and the first time no lib has runpath set to /usr/lib64/samba > > You should fix samba instead, use the patch in #18 as i keep digging, this is absolutely right. samba needs to be fixed. https://bugs.gentoo.org/702178 to follow up. thanks.
(In reply to razamatan from comment #26) > Comment on attachment 641668 [details, diff] [details, diff] > /etc/portage/patches/sys-auth/sssd/692800.patch > > --- a/src/external/samba.m4 2020-05-25 03:05:00.774374354 -0700 > +++ b/src/external/samba.m4 2020-05-25 03:05:45.620224889 -0700 > @@ -60,7 +60,7 @@ > SAVE_CFLAGS=$CFLAGS > SAVE_LIBS=$LIBS > CFLAGS="$CFLAGS $SMBCLIENT_CFLAGS $NDR_NBT_CFLAGS > $NDR_KRB5PAC_CFLAGS" > - LIBS="$LIBS -L${sambalibdir} -lidmap-samba4 -Wl,-rpath > ${sambalibdir}" > + LIBS="$LIBS -L${sambalibdir} -lidmap-samba4 -lreplace-samba4 > -lsmbd-shim-samaba4 -Wl,-rpath ${sambalibdir}" > AC_RUN_IFELSE( > [AC_LANG_SOURCE([ > #include <stdlib.h> I need to add -Wl,--no-as-needed or it will fail sometimes: --- ./src/external/samba.m4.org 2020-06-25 11:04:18.221147249 +0200 +++ ./src/external/samba.m4 2020-06-25 11:05:04.654862849 +0200 @@ -60,7 +60,7 @@ SAVE_CFLAGS=$CFLAGS SAVE_LIBS=$LIBS CFLAGS="$CFLAGS $SMBCLIENT_CFLAGS $NDR_NBT_CFLAGS $NDR_KRB5PAC_CFLAGS" - LIBS="$LIBS -L${sambalibdir} -lidmap-samba4 -Wl,-rpath ${sambalibdir}" + LIBS="$LIBS -L${sambalibdir} -Wl,--no-as-needed -lidmap-samba4 -lreplace-samba4 -lsmbd-shim-samba4 -Wl,-rpath ${sambalibdir}" AC_RUN_IFELSE( [AC_LANG_SOURCE([
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=284c019137cec6c437ed8056c5d5dfb99779122f commit 284c019137cec6c437ed8056c5d5dfb99779122f Author: Robert Förster <Dessa@gmake.de> AuthorDate: 2020-09-10 22:36:40 +0000 Commit: Matt Turner <mattst88@gentoo.org> CommitDate: 2020-09-23 20:18:36 +0000 sys-auth/sssd: fix samba, change to man USE, add autoconf dep - dep on newest stable autoconf for runstatedir support; fixes systemd units - change manpages use to man; more common - pass --with-sam-idmap-interface-version=6 to configure to work around broken check, has been 6 since samba 4.7 Closes: https://bugs.gentoo.org/692800 Package-Manager: Portage-3.0.6, Repoman-3.0.1 Signed-off-by: Robert Förster <Dessa@gmake.de> Closes: https://github.com/gentoo/gentoo/pull/17495 Signed-off-by: Matt Turner <mattst88@gentoo.org> sys-auth/sssd/metadata.xml | 1 + sys-auth/sssd/sssd-2.3.1.ebuild | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-)