Bug 16003

Summary: samba4 will not build for x86
Product: buildroot Reporter: Roland Franke <fli4l>
Component: OtherAssignee: unassigned
Status: RESOLVED MOVED    
Severity: normal CC: buildroot, yann.morin.1998
Priority: P5    
Version: 2024.02   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Host: Target:
Build:
Attachments: used uclibc.config-x86

Description Roland Franke 2024-03-18 18:46:42 UTC
On my system (Debian 11 X86_64) i will try to build as cross-compile 
the samba4 package.
Setup is near similar to the setup as x86_64 system what is build samba4
without problems.
So when i try to build samba4 i run in the error:
[1659/4058] Compiling source4/lib/socket/connect_multi.c
/home/roland/.fbr/fbr-4.0-test_1_2024-x86/buildroot/output/per-package/samba4/host/bin/../lib/gcc/i586-buildroot-linux-uclibc/12.3.0/../../../../i586-buildroot-linux-uclibc/bin/ld: /home/roland/.fbr/fbr-4.0-test_1_2024-x86/buildroot/output/per-package/samba4/host/i586-buildroot-linux-uclibc/sysroot/usr/lib/uclibc_nonshared.a(ssp-local.os): in function `__stack_chk_fail_local':
buildroot/build/uclibc-1.0.45/libc/sysdeps/linux/common/ssp-local.c:35: undefined reference to `__stack_chk_fail'
collect2: error: ld returned 1 exit status

../../lib/krb5_wrap/krb5_samba.c: In function 'smb_krb5_salt_principal_str':
../../lib/krb5_wrap/krb5_samba.c:712:9: warning: 'krb5_free_unparsed_name' is deprecated [-Wdeprecated-declarations]
  712 |         krb5_free_unparsed_name(krb5_ctx, salt_principal_malloc);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../third_party/heimdal/lib/krb5/krb5.h:1019,
                 from ../../lib/replace/system/kerberos.h:33,
                 from ../../lib/krb5_wrap/krb5_samba.h:41,
                 from ../../lib/krb5_wrap/krb5_samba.c:25:
third_party/heimdal/lib/krb5/krb5-protos.h:3774:1: note: declared here
 3774 | krb5_free_unparsed_name (
      | ^~~~~~~~~~~~~~~~~~~~~~~
../../lib/krb5_wrap/krb5_samba.c: In function 'smb_krb5_unparse_name':
../../lib/krb5_wrap/krb5_samba.c:892:17: warning: 'krb5_free_unparsed_name' is deprecated [-Wdeprecated-declarations]
  892 |                 krb5_free_unparsed_name(context, utf8_name);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~
third_party/heimdal/lib/krb5/krb5-protos.h:3774:1: note: declared here
 3774 | krb5_free_unparsed_name (
      | ^~~~~~~~~~~~~~~~~~~~~~~
../../lib/krb5_wrap/krb5_samba.c:895:9: warning: 'krb5_free_unparsed_name' is deprecated [-Wdeprecated-declarations]
  895 |         krb5_free_unparsed_name(context, utf8_name);
      |         ^~~~~~~~~~~~~~~~~~~~~~~
third_party/heimdal/lib/krb5/krb5-protos.h:3774:1: note: declared here
 3774 | krb5_free_unparsed_name (
      | ^~~~~~~~~~~~~~~~~~~~~~~

Waf: Leaving directory `/home/roland/.fbr/fbr-4.0-test_1_2024-x86/buildroot/output/build/samba4-4.19.5/bin/default'
Build failed
 -> task in 'cluster' failed with exit status 1 (run with -v to display more information)

Any suggestion what will not work here?
Comment 1 Peter Seiderer 2024-03-20 21:33:24 UTC
Please read '22.6. Reporting issues/bugs or getting help' ([1]) and '8.2. Understanding when a full rebuild is necessary' ([2]), please try to provide and (minimal) .config or defconfig file reproducing your failure on a complete build (e.g. 'make clean && make samba4')...

[1] https://buildroot.org/downloads/manual/manual.html#reporting-bugs
[2] https://buildroot.org/downloads/manual/manual.html#full-rebuild
Comment 2 Roland Franke 2024-03-21 17:06:31 UTC
I work with a Debian 11 (Bullseye) X86_64 host.
There will be the standard-version of GCC, C++, and all other need packages installed.
I will work here with the buildroot 2024.02 Version what is the actually official version. I will be build ing here with uClibc and GCC (Not musl) .I have here a few additional packages installed, but the main packages be complete the identical version as come with the 2024.02 version.
Note that i normal work with BR2_PER_PACKAGE_DIRECTORY=y

my .config is stored at: https://pastes.io/wqa8jsvgsg

As soon as i try to activate the samba4 package, i will run in the named fault.
It take her no matter, if i try this after an complete clean and build the whole buildroot. It stuck also when i had a full build and activate samba4 after that and try to build this after. It stuck also when i will try to build samba4 alone.

On the same system, i have a second configuration for building for a x86_64 system. Here the samba4 package will be build fine in all conditions.
That is the point why i made the request here.
Maybe the actual samba4 will not longer work with a x86 system?
Comment 3 Peter Seiderer 2024-03-21 17:48:57 UTC
Sorry, given .config fails with:

Kconfig file or fragment 'package/uclibc/uclibc.config-x86' for 'uclibc' does not exist
Comment 4 Roland Franke 2024-03-21 20:43:49 UTC
Created attachment 9730 [details]
used uclibc.config-x86

Used uclibc.config-x86 of my system
Comment 5 Roland Franke 2024-03-21 20:44:36 UTC
(In reply to Roland Franke from comment #4)
I hav add as attachemend the used uclibc.config-x86 from my system
Comment 6 Bernd Kuhls 2024-03-21 21:08:40 UTC
Using this defconfig based on Roland's config

BR2_x86_pentium_mmx=y
BR2_TOOLCHAIN_BUILDROOT_UCLIBC=y
BR2_KERNEL_HEADERS_6_1=y
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_PTHREAD_DEBUG=y
BR2_TOOLCHAIN_BUILDROOT_USE_SSP=y
BR2_BINUTILS_VERSION_2_40_X=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_CCACHE=y
BR2_PER_PACKAGE_DIRECTORIES=y
BR2_SSP_REGULAR=y
BR2_RELRO_PARTIAL=y
BR2_PACKAGE_SAMBA4=y

I could reproduce the build error (Debian 12 x86_64).
According to some findings it seems to occur only on x86, reason unknown:
https://avidemux.org/smif/index.php?msg=70245
https://bz.apache.org/ooo/show_bug.cgi?id=127139#c6

Please add this hack in package/samba4/samba4.mk

ifeq ($(BR2_i386)$(BR2_TOOLCHAIN_HAS_SSP),yy)
SAMBA4_LDFLAGS += -lc -Wl,--as-needed
endif
Comment 7 Peter Seiderer 2024-03-21 21:57:10 UTC
Can confirm the extra '-lc' fixes the linking problem...
Comment 8 Roland Franke 2024-03-22 18:26:38 UTC
I will also confirm that the build from samba4 with the additional -lc fix the build.

Thank you.
Comment 9 Yann E. MORIN 2024-06-15 15:23:02 UTC
Thank you for your report.

The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
    https://gitlab.com/buildroot.org/buildroot/-/issues

We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.

Thank you!