Le Sat, Oct 30, 2021 at 10:27:46AM +0200, Landry Breuil a écrit :
> Le Sat, Oct 30, 2021 at 10:20:18AM +0200, Landry Breuil a écrit :
> > Le Sat, Oct 30, 2021 at 09:51:34AM +0200, Landry Breuil a écrit :
> > > Hi,
> > > 
> > > i dunno if something should be fixed in the python build system (is it
> > > *necessary* to point at /usr/local/lib for libpython3.8.so ?), but i
> > > think there's something definitely wrong somewhere. That probably
> > > accounts for many failures i remember seeing building python updates
> > > when the previous version was installed systemwide, and taking precedence
> > > over the just-newly-built lib/extension.
> > 
> > looking a bit more at our python port and reading
> > https://docs.python.org/3/using/configure.html#linker-flags, the
> > paths seem to come from MAKE_FLAGS += LDFLAGS='-L${WRKSRC}
> > -L${LOCALBASE}/lib/' in /usr/ports/lang/python/Makefile.inc. Dunno if
> > that's right or wrong for them to end up in LDSHARED, so i wonder if
> > PY_LDFLAGS or PY_CORE_LDFLAGS or LDSHARED should be overriden.
> 
> Hah !! https://bugs.python.org/issue35257 and
> https://bugs.python.org/issue21121 looks definitely related ! so
> i think we should use PY_LDFLAGS_NODIST / CFLAGS_NODIST in the python
> port to build python itself, so that those paths dont 'leak' to
> extensions built later on..

So, more findings... in freebsd-land for python 3.2 in 2013, they added
a patch
(https://svnweb.freebsd.org/ports/head/lang/python38/files/patch-Makefile.pre.in?revision=516854&view=markup)
to 'Remove CONFIGURE_* variables from Makefile.pre.in' in
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=181721 /
http://svnweb.freebsd.org/changeset/ports/326729 to fix libintl
detection. that patch has been cargoculted since then in all python
versions.

in debian-land they seem to use a subst on _sysconfigdata here
https://salsa.debian.org/cpython-team/python3/-/blob/master/debian/rules#L231

i locally rebuilt python 3.8 with the following diff in
lang/python/Makefile.inc:

 CONFIGURE_ENV += OPT='${CFLAGS} -fPIC' CPPFLAGS='-I${LOCALBASE}/include' \
-               LDFLAGS='-L${LOCALBASE}/lib/' SVNVERSION=no \
+               LDFLAGS_NODIST='-L${LOCALBASE}/lib/' SVNVERSION=no \
                LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
 MAKE_ENV +=    LOCALBASE=${LOCALBASE} X11BASE=${X11BASE}
 MAKE_FLAGS +=  LD_LIBRARY_PATH=${WRKSRC} PATH="${WRKDIST}:${PORTPATH}"
-MAKE_FLAGS +=  LDFLAGS='-L${WRKSRC} -L${LOCALBASE}/lib/'
+MAKE_FLAGS +=  LDFLAGS_NODIST='-L${WRKSRC} -L${LOCALBASE}/lib/'
 FAKE_FLAGS +=  RANLIB=:

that gives me a python that compiles the gdal extension from master fine
(eg still -L/usr/obj/gdal -L/usr/local/lib -lgdal, but not the 'extra'
-L flags before).

sadly, libintl library detection at configure time fails with this..

checking for bind_textdomain_codeset... no

so not there yet.

Landry

Reply via email to