Bug#1040062: Build failure for pydevd on alpha: gp-relative relocation against dynamic symbol

2023-10-28 Thread Julian Gilbey
On Sat, Oct 28, 2023 at 03:34:47PM +0300, Adrian Bunk wrote:
> On Fri, Oct 20, 2023 at 07:03:41AM +0100, Julian Gilbey wrote:
> > Hi!
> > 
> > I'm completely out of my depth on this one, and I wonder whether
> > anyone might be able to help.
> > [...]
> > /usr/bin/ld: /tmp/ccR4bmTq.ltrans5.ltrans.o: gp-relative relocation against 
> > dynamic symbol __pyx_module_is_main__pydevd_bundle__pydevd_cython
> > [...]
> 
> That's related to #1040062, the best fix that does not involve touching dpkg 
> is:

Thanks Adrian!  I'll apply this patch.

Best wishes,

   Julian



Bug#1040062: Build failure for pydevd on alpha: gp-relative relocation against dynamic symbol

2023-10-28 Thread Adrian Bunk
On Fri, Oct 20, 2023 at 07:03:41AM +0100, Julian Gilbey wrote:
> Hi!
> 
> I'm completely out of my depth on this one, and I wonder whether
> anyone might be able to help.
> 
> I have just updated pydevd from 2.9.6+ds-1, uploaded 2023-06-23, to
> version 2.10.0+ds-1.  But the build of the cython extension now fails
> on alpha: near the end of the build log
> 
> https://buildd.debian.org/status/fetch.php?pkg=pydevd=alpha=2.10.0%2Bds-1=1697725269=0
> 
> is the failed build:
> 
> I: pybuild pybuild:340: cd 
> /<>/.pybuild/cpython3_3.11_pydevd/build; python3.11 
> setup_pydevd_cython.py build_ext --inplace --force-cython
> /usr/lib/python3/dist-packages/Cython/Compiler/Main.py:369: FutureWarning: 
> Cython directive 'language_level' not set, using 2 for now (Py2). This will 
> change in a later release! File: 
> /<>/.pybuild/cpython3_3.11_pydevd/build/_pydevd_bundle/pydevd_cython.pxd
>   tree = Parsing.p_module(s, pxd, full_module_name)
> Compiling _pydevd_bundle/pydevd_cython.pyx because it changed.
> [1/1] Cythonizing _pydevd_bundle/pydevd_cython.pyx
> running build_ext
> building '_pydevd_bundle.pydevd_cython' extension
> creating build
> creating build/temp.linux-alpha-cpython-311
> creating build/temp.linux-alpha-cpython-311/_pydevd_bundle
> alpha-linux-gnu-gcc -Wsign-compare -mieee -DNDEBUG -g -fwrapv -O2 -Wall -g 
> -Wformat -Werror=format-security -g -O2 -ffile-prefix-map=/<>=. 
> -specs=/usr/share/dpkg/pie-compile.specs -Wformat -Werror=format-security 
> -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPy_BUILD_CORE_MODULE=1 
> -I/usr/include/python3.11 -c _pydevd_bundle/pydevd_cython.c -o 
> build/temp.linux-alpha-cpython-311/_pydevd_bundle/pydevd_cython.o -flto
> creating build/lib.linux-alpha-cpython-311
> creating build/lib.linux-alpha-cpython-311/_pydevd_bundle
> alpha-linux-gnu-gcc -shared -Wl,-O1 -Wl,-Bsymbolic-functions 
> -specs=/usr/share/dpkg/pie-link.specs -Wl,-z,relro -Wl,-z,now -g -O2 
> -ffile-prefix-map=/<>=. -specs=/usr/share/dpkg/pie-compile.specs 
> -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 
> build/temp.linux-alpha-cpython-311/_pydevd_bundle/pydevd_cython.o 
> -L/usr/lib/alpha-linux-gnu -o 
> build/lib.linux-alpha-cpython-311/_pydevd_bundle/pydevd_cython.cpython-311-alpha-linux-gnu.so
>  -flto
> lto-wrapper: warning: using serial compilation of 7 LTRANS jobs
> lto-wrapper: note: see the ‘-flto’ option documentation for more information
> /usr/bin/ld: /tmp/ccR4bmTq.ltrans5.ltrans.o: gp-relative relocation against 
> dynamic symbol __pyx_module_is_main__pydevd_bundle__pydevd_cython
> /usr/bin/ld: /tmp/ccR4bmTq.ltrans5.ltrans.o: gp-relative relocation against 
> dynamic symbol __pyx_module_is_main__pydevd_bundle__pydevd_cython
> /usr/bin/ld: /tmp/ccR4bmTq.ltrans5.ltrans.o: gp-relative relocation against 
> dynamic symbol 
> __pyx_wrapperbase_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__
> /usr/bin/ld: /tmp/ccR4bmTq.ltrans5.ltrans.o: gp-relative relocation against 
> dynamic symbol 
> __pyx_wrapperbase_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__
> /usr/bin/ld: /tmp/ccR4bmTq.ltrans5.ltrans.o: gp-relative relocation against 
> dynamic symbol 
> __pyx_wrapperbase_14_pydevd_bundle_13pydevd_cython_12ThreadTracer_2__call__
> collect2: error: ld returned 1 exit status
> error: command '/usr/bin/alpha-linux-gnu-gcc' failed with exit code 1
> E: pybuild pybuild:395: build: plugin distutils failed with: exit code=1: cd 
> /<>/.pybuild/cpython3_3.11_pydevd/build; python3.11 
> setup_pydevd_cython.py build_ext --inplace --force-cython
> 
> 
> I have no idea what caused these errors.
>...

That's related to #1040062, the best fix that does not involve touching dpkg is:

--- pydevd-2.10.0+ds/debian/rules.old   2023-10-28 12:12:23.060259727 +
+++ pydevd-2.10.0+ds/debian/rules   2023-10-28 12:14:34.343882684 +
@@ -4,7 +4,11 @@
 include /usr/share/dpkg/pkg-info.mk
 export PYBUILD_NAME=pydevd
 
+ifneq (,$(filter $(DEB_HOST_ARCH), alpha ia64 x32))
+export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
+else
 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+endif
 
 CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS)
 CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)


> Best wishes,
> 
>Julian

cu
Adrian