Bug 9773 - -L/usr/local/lib is pulled in before internal
-L/usr/local/lib is pulled in before internal
Status: RESOLVED WONTFIX
Product: Samba 4.0
Classification: Unclassified
Component: Build
4.0.4
All OpenBSD
: P5 normal
: ---
Assigned To: Björn Jacke
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-09 11:22 UTC by Vadim Zhukov
Modified: 2013-04-25 21:36 UTC (History)
1 user (show)

See Also:


Attachments
gzipped config.log (305.05 KB, application/x-gunzip)
2013-04-09 11:24 UTC, Vadim Zhukov
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vadim Zhukov 2013-04-09 11:22:52 UTC
I'm currently working on Samba4 port for OpenBSD.

At some point, Samba built system picks up /usr/local/lib as library path that should be always used. It starts using it for tests here (excerpt from bin/config.log):

--------------------------------------------------------
Checking for HAVE_RPCSVC_YP_PROT_H
==>
#define CONFIG_H_IS_FROM_SAMBA 1
#define _SAMBA_BUILD_ 4
#define HAVE_CONFIG_H 1
#define BUILD_SYSTEM "OpenBSD persx201i.gnom.domain 5.3 X201I#46 i386"
#define HAVE_SYS_UTSNAME_H 1
#define SYSTEM_UNAME_SYSNAME "OpenBSD"
#define SYSTEM_UNAME_MACHINE "i386"
#define SYSTEM_UNAME_RELEASE "5.3"
#define SYSTEM_UNAME_VERSION "X201I#46"
#define HAVE_STDIO_H 1
#define HAVE_SIMPLE_C_PROG 1
#define INLINE_MACRO 1
#define _GNU_SOURCE 1
#define _XOPEN_SOURCE_EXTENDED 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STDDEF_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRING_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define HAVE_CTYPE_H 1
#define HAVE_STDBOOL_H 1
#define HAVE_STDARG_H 1
#define HAVE_LIMITS_H 1
#define HAVE_ASSERT_H 1
#define HAVE_LARGEFILE 1
#define STDC_HEADERS 1
#define HAVE_SYS_TIME_H 1
#define HAVE_TIME_H 1
#define TIME_WITH_SYS_TIME 1
#define SHLIBEXT "so"
/* #undef WORDS_BIGENDIAN */
#define HAVE_SIGNAL_H 1
/* #undef RETSIGTYPE_INT */
#define RETSIGTYPE void
#define HAVE_FUNCTION_MACRO 1
#define HAVE_VA_COPY 1
#define HAVE__VA_ARGS__MACRO 1
#define HAVE_LIBREPLACE 1
#define LIBREPLACE_NETWORK_CHECKS 1
#define HAVE_LOCALE_H 1
#define HAVE_FCNTL_H 1
#define HAVE_FNMATCH_H 1
#define HAVE_GLOB_H 1
#define HAVE_LANGINFO_H 1
#define HAVE_PWD_H 1
#define HAVE_SYS_DIR_H 1
#define HAVE_SYS_FCNTL_H 1
#define HAVE_SYS_FILIO_H 1
#define HAVE_SYS_IOCTL_H 1
#define HAVE_SYS_IPC_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_RESOURCE_H 1
#define HAVE_SYS_SHM_H 1
#define HAVE_SYS_STATVFS_H 1
#define HAVE_TERMIOS_H 1
#define HAVE_SYS_FILE_H 1
#define HAVE_SYS_WAIT_H 1
#define HAVE_MALLOC_H 1
#define HAVE_GRP_H 1
#define HAVE_SYS_SELECT_H 1
#define HAVE_SETJMP_H 1
#define HAVE_UTIME_H 1
#define HAVE_SYS_SYSLOG_H 1
#define HAVE_SYSLOG_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_SOCKET_H 1
#define HAVE_NETINET_IN_H 1
#define HAVE_NETDB_H 1
#define HAVE_ARPA_INET_H 1
#define HAVE_NETINET_IN_SYSTM_H 1
#define HAVE_NETINET_IP_H 1
#define HAVE_NETINET_TCP_H 1
#define HAVE_SYS_SOCKIO_H 1
#define HAVE_SYS_UN_H 1
#define HAVE_SYS_UIO_H 1
#define HAVE_IFADDRS_H 1
#define HAVE_DIRENT_H 1
#define HAVE_LIBINTL_H 1
#define HAVE_ERRNO_H 1
#define HAVE_GCRYPT_H 1
#define HAVE_GETOPT_H 1
#define HAVE_ICONV_H 1
#define HAVE_SASL_SASL_H 1
#define HAVE_ZLIB_H 1
#define HAVE_SYS_UNISTD_H 1
#define HAVE_RPC_RPC_H 1
#define HAVE_FLOAT_H 1
#define HAVE_RPCSVC_YPCLNT_H 1
#define HAVE_SYS_SYSCTL_H 1
#define HAVE_NETGROUP_H 1
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <stddef.h>
#include <memory.h>
#include <string.h>
#include <strings.h>
#include <inttypes.h>
#include <stdint.h>
#include <unistd.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdarg.h>
#include <rpc/rpc.h>

 int main(void) { ; return 0; }

<==
[1/2] Compiling test.c
['cc', '-O2', '-pipe', '-I/usr/ports/pobj/samba-4.0.4/samba-4.0.4/lib/replace', '-MD', '-Idefault', '-I..', '-Idefault', '-I..', '-I/usr/local/include', '-D_SAMBA_BUILD_=4', '-DHAVE_CONFIG_H=1', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '../test.c', '-c', '-o', 'default/test_1.o']
[2/2] Linking default/testprog
['cc', 'default/test_1.o', '-o', '/usr/ports/pobj/samba-4.0.4/samba-4.0.4/bin/.conf_check_0/testbuild/default/testprog', '-L/usr/local/lib']
ok

--------------------------------------------------------
Checking for header sys/cdefs.h
==>
...


I do not even know why does it look at /usr/local/include even, because the file being checked lies under /usr/include.

This -L/usr/local/lib breaks build when another (e.g., Samba3) version is installed, because linking is being done with the wrong libraries.

I'm attaching the full config.log.
Comment 1 Vadim Zhukov 2013-04-09 11:24:59 UTC
Created attachment 8738 [details]
gzipped config.log

Sorry for gzipping the file, otherwise it could not be attached due to the size.
Comment 2 Vadim Zhukov 2013-04-09 11:27:15 UTC
Oh, and here are the configuration options I've used:

--enable-fhs
--abi-check-disable
--prefix=${PREFIX}
--destdir=${WRKINST}
--docdir=${PREFIX}/share/doc
--localedir=${PREFIX}/share/locale
--localstatedir=/var
--sharedstatedir=/var
--with-statedir=/var/samba
--with-privatedir=/var/samba/private
--with-lockdir=/var/run/samba
--with-privileged-socket-dir=/var/samba
--enable-developer
--enable-selftest
--pedantic
--without-pam
-vv
Comment 3 Björn Jacke 2013-04-09 11:41:06 UTC
(In reply to comment #0)
> I do not even know why does it look at /usr/local/include even, because the
> file being checked lies under /usr/include.
> 
> This -L/usr/local/lib breaks build when another (e.g., Samba3) version is
> installed, because linking is being done with the wrong libraries.

you should not have samba library header files around if you don't wanna use them I'd say. You cannot reliably lock out /usr/local/include because things like krb5-config etc. can pull them in without you intending to doit. Either you have recent enough libtdb/ldb etc. installed in the system and use that or uninstall at least the header files(!) of them and use the libs shipped with the 4.0 tar ball. --disable-rpath-install is a good idea also so that rpath only contains the samba internal library path.
Comment 4 Vadim Zhukov 2013-04-09 11:49:41 UTC
(In reply to comment #3)
> (In reply to comment #0)
> > I do not even know why does it look at /usr/local/include even, because the
> > file being checked lies under /usr/include.
> > 
> > This -L/usr/local/lib breaks build when another (e.g., Samba3) version is
> > installed, because linking is being done with the wrong libraries.
> 
> you should not have samba library header files around if you don't wanna use
> them I'd say. You cannot reliably lock out /usr/local/include because things
> like krb5-config etc. can pull them in without you intending to doit. Either
> you have recent enough libtdb/ldb etc. installed in the system and use that or
> uninstall at least the header files(!) of them and use the libs shipped with
> the 4.0 tar ball. --disable-rpath-install is a good idea also so that rpath
> only contains the samba internal library path.

Looking at the... say, library_flags() in buildtools/wafsamba/wafsamba.py, I see this:

# note that we do not add the -I and -L in here, as that is added by the waf
# core. Adding it here would just change the order that it is put on the link line
# which can cause system paths to be added before internal libraries

So this problem is, thankfully, already known and tried to be addressed. So I don't get your point.

Even more, configure script definitely is broken - why does it ever make compiler look at -I/usr/local/include and -L/usr/local/lib when it wasn't either told to, and doesn't need to, either?

I _know_ that some stuff could get in the way. This is why internal paths should go before external. People that written at least some parts of build system know this (see the comment above), but looks like something was missed.
Comment 5 Vadim Zhukov 2013-04-20 14:11:49 UTC
Any news on this? Maybe I should contact someone specific? Or provide more information?
Comment 6 Jelmer Vernooij 2013-04-25 21:08:19 UTC
Not sure why this is assigned to me, unassigning.
Comment 7 Björn Jacke 2013-04-25 21:36:45 UTC
okay, when this comes from the waf experts back to me, I can again only say what I already said in comment 3. So please follow that advice because this solves this problem. This is imho a problem of the build environment, so please don't reopen the bug again, unless uninstalling of the outdated header libraries does not fix this for you.