[Patch] Fix the build with bundled talloc on FreeBSD (bug #12724)

Alexander Bokovoy ab at samba.org
Tue Apr 4 10:03:22 UTC 2017


On ti, 04 huhti 2017, Stefan Metzmacher via samba-technical wrote:
> Hi,
> 
> here's a patch that fixes
> https://bugzilla.samba.org/show_bug.cgi?id=12724
> 
> The problem is that LINKFLAGS_PYEMBED contains
> -L/usr/local/lib, so that we link against
> /usr/local/lib/libtalloc.so instead of bin/shared/private/libtalloc.so
> and pytalloc_GenericObject* is missing.
> 
> When linking we use LINKFLAGS first followed by LIBPATH.
> LIBPATH contains the relative (to the source/build directory) -L values
> first before the absolute -L values for external libraries.
> 
> The key is that LINKFLAGS never contains -L, this must go via LIBPATH.
> 
> Please review and push:-)
> 
> Thanks!
> metze

> From de0f93acef2dd7434b282d1a54f0553cccbd052a Mon Sep 17 00:00:00 2001
> From: Stefan Metzmacher <metze at samba.org>
> Date: Tue, 28 Mar 2017 15:28:21 +0200
> Subject: [PATCH] wafsamba: move -L/some/path from LINKFLAGS_PYEMBED to
>  LIBPATH_PYEMBED
> 
> LINKFLAGS should not have path components.
> 
> This fixes the build on systems like FreeBSD where python
> is located in /usr/local/lib.
> 
> BUG: https://bugzilla.samba.org/show_bug.cgi?id=12724
> 
> Signed-off-by: Stefan Metzmacher <metze at samba.org>
> ---
>  buildtools/wafsamba/samba_python.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/buildtools/wafsamba/samba_python.py b/buildtools/wafsamba/samba_python.py
> index 40b42fc..f97439c 100644
> --- a/buildtools/wafsamba/samba_python.py
> +++ b/buildtools/wafsamba/samba_python.py
> @@ -90,6 +90,12 @@ def _check_python_headers(conf, mandatory):
>      conf.env['PYTHON_LIBNAME_SO_ABI_FLAG'] = (
>          conf.env['PYTHON_SO_ABI_FLAG'].replace('_', '-'))
>  
> +    for lib in conf.env['LINKFLAGS_PYEMBED']:
> +        if lib.startswith('-L'):
> +            conf.env.append_unique('LIBPATH_PYEMBED', lib[2:]) # strip '-L'
> +            conf.env['LINKFLAGS_PYEMBED'].remove(lib)
> +
> +    return
>  
>  def PYTHON_BUILD_IS_ENABLED(self):
>      return self.CONFIG_SET('HAVE_PYTHON_H')
> -- 
> 1.9.1
> 
Thanks. This is subtle.

RB+ by me.

2Timur -- could you please confirm this fixes your issue on FreeBSD as I
can see this comment in the package Makefile:
# XXX: Gross hack to allow build newer Samba while old one is installed.
# This implies that LINKFLAGS_PYEMBED contains flags which are already
# used in other parts of LINKFLAGS, namely -L$(LOCALBASE)/lib and -pthread
post-configure:
	-${REINPLACE_CMD} -e 's|LINKFLAGS_PYEMBED.*|LINKFLAGS_PYEMBED = []|' \
		${CONFIGURE_WRKSRC}/bin/c4che/default.cache.py


-- 
/ Alexander Bokovoy



More information about the samba-technical mailing list