Bug 208767 - net/samba43: error, linker failure : smbspool_krb5_wrapper.c:198: undefined reference to `clearenv'
Summary: net/samba43: error, linker failure : smbspool_krb5_wrapper.c:198: undefined r...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Timur I. Bakeyev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-13 08:52 UTC by O. Hartmann
Modified: 2016-04-23 12:08 UTC (History)
5 users (show)

See Also:
bugzilla: maintainer-feedback? (timur)


Attachments
clearenv fix (1.04 KB, patch)
2016-04-13 18:15 UTC, Mikael Urankar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description O. Hartmann 2016-04-13 08:52:17 UTC
The recent update of net/samba43 fails to build due to a linker error:

smbspool_krb5_wrapper.c:198: undefined reference to `clearenv',

see below.


[...]

cc: warning: argument unused during compilation: '-undefined dynamic_lookup'
[3340/3873] Linking default/source3/lib/pthreadpool/pthreadpooltest
runner cc default/source3/utils/log2pcaphex_214.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/log2pcap -L/usr/local/lib -fstack-protector -pie -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Wl,-Bdynamic -lreplace-samba4 -lrt -lcrypt -ltalloc -lpopt
runner cc default/source3/utils/debug2html_218.o default/source3/utils/debugparse_218.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/debug2html -L/usr/local/lib -fstack-protector -pie -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Wl,-Bdynamic -lreplace-samba4 -lrt -lcrypt -ltalloc -lpopt
[3341/3873] Linking default/source3/lib/asys/asystest
[3342/3873] Linking default/lib/util/libgenrand-samba4.so
[3343/3873] Linking default/lib/util/libsamba-debug-samba4.so
[3344/3873] Linking default/source3/libmsghdr-samba4.so
runner cc default/source3/script/tests/timelimit_226.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/timelimit -L/usr/local/lib -fstack-protector -pie -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private
runner cc default/source3/lib/pthreadpool/pthreadpool_1.o default/source3/lib/pthreadpool/tests_2.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/lib/pthreadpool/pthreadpooltest -L/usr/local/lib -fstack-protector -pie -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Wl,-Bdynamic -lreplace-samba4 -lrt -lcrypt
default/source3/client/smbspool_krb5_wrapper_170.o: In function `main':
/usr/ports/net/samba43/work/samba-4.3.8/bin/../source3/client/smbspool_krb5_wrapper.c:198: undefined reference to `clearenv'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
runner cc default/source3/lib/asys/tests_2.o default/source3/lib/asys/asys_1.o default/source3/lib/pthreadpool/pthreadpool_1.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/lib/asys/asystest -L/usr/local/lib -fstack-protector -pie -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Wl,-Bdynamic -lreplace-samba4 -lrt -lcrypt
runner cc default/lib/crypto/crc32_1.o default/lib/crypto/hmacmd5_1.o default/lib/crypto/md4_1.o default/lib/crypto/arcfour_1.o default/lib/crypto/sha256_1.o default/lib/crypto/sha512_1.o default/lib/crypto/hmacsha256_1.o default/lib/crypto/aes_1.o default/lib/crypto/rijndael-alg-fst_1.o default/lib/crypto/aes_cmac_128_1.o default/lib/crypto/aes_ccm_128_1.o default/lib/crypto/aes_gcm_128_1.o default/lib/util/genrand_15.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/lib/util/libgenrand-samba4.so -L/usr/local/lib -fstack-protector -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -shared -Wl,--version-script=/usr/ports/net/samba43/work/samba-4.3.8/bin/default/lib/util/genrand.vscript -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Ldefault/lib/util -Wl,-Bdynamic -ltime-basic-samba4 -lsocket-blocking-samba4 -lreplace-samba4 -lrt -lmd -ltalloc -lcrypt
runner cc default/source3/lib/msghdr_123.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/libmsghdr-samba4.so -L/usr/local/lib -fstack-protector -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -shared -Wl,--version-script=/usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/msghdr.vscript -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Ldefault/lib/util -Wl,-Bdynamic -liov-buf-samba4 -lreplace-samba4 -lrt -lcrypt
runner cc default/lib/util/close_low_fd_7.o default/lib/util/debug_8.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/lib/util/libsamba-debug-samba4.so -L/usr/local/lib -fstack-protector -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -shared -Wl,--version-script=/usr/ports/net/samba43/work/samba-4.3.8/bin/default/lib/util/samba-debug.vscript -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Ldefault/lib/util -Wl,-Bdynamic -ltime-basic-samba4 -lsocket-blocking-samba4 -lreplace-samba4 -lrt -lcrypt -ltalloc
Waf: Leaving directory `/usr/ports/net/samba43/work/samba-4.3.8/bin'
Build failed:  -> task failed (err #1): 
        {task: cc_link dynconfig_1.o,smbspool_krb5_wrapper_170.o -> smbspool_krb5_wrapper}
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/net/samba43
*** Error code 1
Comment 1 O. Hartmann 2016-04-13 09:00:39 UTC
This problem occurs when option CUPS is enabled in make config! 

As a workaround, disable CUPS. But this is nonesense, since the printer support is essential.
Comment 2 Mikael Urankar freebsd_committer 2016-04-13 18:15:54 UTC
Created attachment 169295 [details]
clearenv fix

Same here, the attached patch fixes the build
Comment 3 Gerard Seibert 2016-04-16 09:38:52 UTC
(In reply to ohartman from comment #1)

I am having the same problem whether "CUP" is set or not.
Comment 4 O. Hartmann 2016-04-16 09:59:02 UTC
You are correct, I was mistaken and there was a confusion. This port suffers now for aeons from an unclean build: it fails on some boxes, when net/samba{43|42} is already installed and about to be updated (pkg deleting the port helps) or it fails in case of an installation of the outdated and still used port samba36-smbclient, which has also to be deleted. This happens in our case mostly on boxes with not-only the system compiler installed, but also clang/llvm/gcc from ports. So I guess there is a bug in the resolution of the paths when searching for libraries expected to be taken from the port build but the linker finds first those from the regular installed port ...

The patch provided here helped in my case! I look forward to see it committed soon.
Comment 5 O. Hartmann 2016-04-16 10:53:43 UTC
After some struggle with update on one box I decided to deinstall the whole port and perform a "portmaster -f net/samba43". The result (patch applied as given here) is another strange error. This is boring:

[...]

../source3/lib/netapi/tests/netshare.c:57:29: warning: comparison of constant 234 with expression of type 'NET_API_STATUS' is always false [-Wtautological-constant-out-of-range-compare]
                if (status == 0 || status == ERROR_MORE_DATA) {
                                   ~~~~~~ ^  ~~~~~~~~~~~~~~~
../source3/lib/netapi/tests/netshare.c:106:18: warning: comparison of constant 234 with expression of type 'NET_API_STATUS' is always false [-Wtautological-constant-out-of-range-compare]
        } while (status == ERROR_MORE_DATA);
                 ~~~~~~ ^  ~~~~~~~~~~~~~~~
../source3/lib/netapi/tests/netshare.c:127:24: error: variable has incomplete type 'struct SHARE_INFO_502'
        struct SHARE_INFO_502 i502;
                              ^
../source3/lib/netapi/tests/netshare.c:127:9: note: forward declaration of 'struct SHARE_INFO_502'
        struct SHARE_INFO_502 i502;
               ^
../source3/lib/netapi/tests/netshare.c:192:24: warning: comparison[3272/3873] Compiling source3/lib/netapi/examples/join/getjoinableous.c


[...]
Comment 6 dewayne 2016-04-18 15:46:23 UTC
(In reply to mikael.urankar from comment #2)
Thank you Mikael.  Confirmed fix on 10.3-Stable i386 & amd64.

Oliver, yes the number of warning messages is disconcerting, particularly the tautological errors on an i386 platform!  I often wonder if the upstream folks read their build logs. Fortunately Timur does a great job keeping Samba functioning on FreeBSD :)
Comment 7 commit-hook freebsd_committer 2016-04-21 02:20:30 UTC
A commit references this bug:

Author: timur
Date: Thu Apr 21 02:19:31 UTC 2016
New revision: 413713
URL: https://svnweb.freebsd.org/changeset/ports/413713

Log:
  Fixed problem with the undeclared clearenv() that broke the build.
  Applied additional patches to fix problem with talloc 2.1.6 and failed provisioning, thanks to Andrey Kramarenko for pointing me to the patches and support.

  PR:		208767
  		208767

Changes:
  head/net/samba43/Makefile
  head/net/samba43/files/extra-patch-talloc
  head/net/samba43/files/patch-source3_client_smbspool_krb5_wrapper.c
  head/net/samba43/pkg-plist
Comment 8 Gerard Seibert 2016-04-22 12:27:42 UTC
(In reply to commit-hook from comment #7)
I am still experiencing a problem trying to get samba 43 installed. It now terminates with the following message.

/usr/local/lib/libtevent-util.so: undefined reference to `map_nt_error_from_unix_common@SAMBA_4.3.3'
/usr/local/lib/libtevent-util.so: undefined reference to `ntstatus_to_werror@SAMBA_4.3.3'
[3376/3871] Linking default/source3/libsmbd-conn-samba4.so
cc: error: linker command failed with exit code 1 (use -v to see invocation)
runner cc default/source3/smbd/conn_87.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/libsmbd-conn-samba4.so -L/usr/local/lib -fstack-protector -Wl,-z,relro,-z,now -lpthread -Wl,-no-undefined -Wl,--export-dynamic -Wl,--as-needed -shared -Wl,--version-script=/usr/ports/net/samba43/work/samba-4.3.8/bin/default/source3/smbd_conn.vscript -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared -Wl,-rpath,/usr/ports/net/samba43/work/samba-4.3.8/bin/shared/private -Ldefault/lib/replace -Ldefault/lib/util -Ldefault/source3 -Wl,-Bdynamic -lsamba3-util-samba4 -lsamba-util -lreplace-samba4 -ltime-basic-samba4 -lutil-setid-samba4 -lsamba-debug-samba4 -lgenrand-samba4 -lsocket-blocking-samba4 -lcrypt -lrt -lmd -liconv -ltevent -ltalloc -lexecinfo
Waf: Leaving directory `/usr/ports/net/samba43/work/samba-4.3.8/bin'
Build failed:  -> task failed (err #1): 
	{task: cc_link async_sock_1.o,async_connect_send_test_2.o -> async_connect_send_test}
===> Compilation failed unexpectedly.
Try to set MAKE_JOBS_UNSAFE=yes and rebuild before reporting the failure to
the maintainer.
*** Error code 1

Stop.
make[1]: stopped in /usr/ports/net/samba43
*** Error code 1

Stop.
make: stopped in /usr/ports/net/samba43

The entire build log is located here: http://www.seibercom.net/net_samba43.log
Comment 9 Timur I. Bakeyev freebsd_committer 2016-04-23 12:08:17 UTC
(In reply to Gerard Seibert from comment #8)

Hi, Gerard!

It's unrelated issue, caused by injection of the old samba libraries into the build path. Hm.. Saying that that tipped me how to enforce it in the future...

But anyhow, the problem comes from the start of the configure script:

Checking uname sysname type              : runner cc -pipe -fno-omit-frame-pointer -DLIBICONV_PLUG -fno-color-diagnostics -g -fstack-protector -DLDAP_DEPRECATED -fno-strict-aliasing -MD -I/usr/local/include -DLIBICONV_PLUG -Idefault -I.. -Idefault -I.. -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H=1 ../test.c -c -o default/test_1.o
runner cc default/test_1.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/.conf_check_0/testbuild/default/testprog -L/usr/local/lib -fstack-protector
Even at that stage we get evil '-L/usr/local/lib' injected into the linking flags.

So, can you provide me with the:

/etc/make.conf
'cc -v' output
list of installed packages
samba43/work/samba-4.3.8/bin/config.log
port config options


For me, for example, configure gives:

Checking uname sysname type              : runner cc -pipe -fno-omit-frame-pointer -DLIBICONV_PLUG -fno-color-diagnostics -g -fstack-protector -DLDAP_DEPRECATED -fno-strict-aliasing -MD -DLIBICONV_PLUG -Idefault -I.. -Idefault -I.. -D_SAMBA_BUILD_=4 -DHA
VE_CONFIG_H=1 ../test.c -c -o default/test_1.o
runner cc default/test_1.o -o /usr/ports/net/samba43/work/samba-4.3.8/bin/.conf_check_0/testbuild/default/testprog -fstack-protector


Note the absence of 'evil' -L/usr/local/lib