Bug#1068158: python-escript: FTBFS: RuntimeError: We do not current support different different dpkg-buildflags for C vs C++:

Sebastian Ramacher sramacher at debian.org
Tue Apr 2 16:19:41 BST 2024


Hi

On 2024-04-02 23:16:16 +0800, Bo YU wrote:
> Tags: patch
> 
> Hi,
> >  File "/<<PKGBUILDDIR>>/site_scons/extractdebbuild.py", line 61:
> >    raise RuntimeError("We do not current support different different dpkg-buildflags for C vs C++")
> > make[1]: *** [debian/rules:65: override_dh_auto_build] Error 2
> 
> I have looked into this a bit.
> As the error hint here, the default cflags in here when build is:
> 
> ```
> -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-
> clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-uninitialized
> ```
> 
> But cxxflags without[0] `-Werror=implicit-function-declaration` here. Is it
> expected?

It is expected. -Werror=implicit-function-declaration makes no sense in
C++ since C++ simply does not support implicit function declarations.

Cheers

> 
> 
> 
> Once we added the build flags for cxx[1] and sorted these config with
> compared, the built is okay.
> 
> [0]: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=ef90821fe45b99fa8c8c4279b9a74c30f59f491d
> [1]: https://salsa.debian.org/science-team/python-escript/-/blob/debian/latest/debian/rules?ref_type=heads#L16
> 
> -- 
> Regards,
> --
>   Bo YU
> 

> diff -Nru python-escript-5.6/debian/changelog python-escript-5.6/debian/changelog
> --- python-escript-5.6/debian/changelog	2023-12-10 18:53:54.000000000 +0800
> +++ python-escript-5.6/debian/changelog	2024-04-02 20:27:27.000000000 +0800
> @@ -1,3 +1,12 @@
> +python-escript (5.6-7) unstable; urgency=medium
> +
> +  * Team upload.
> +  * Add fix-dpkg-buildflags-on-c-c++.patch to fix ftbfs issue.
> +    (Closes: #1068158)
> +  * No build dependencies issue again. (Closes: #1067385)
> +
> + -- Bo YU <tsu.yubo at gmail.com>  Tue, 02 Apr 2024 20:27:27 +0800
> +
>  python-escript (5.6-6) unstable; urgency=medium
>  
>    * Update patch for new buildflags. Closes: #1057593
> diff -Nru python-escript-5.6/debian/patches/fix-dpkg-buildflags-on-c-c++.patch python-escript-5.6/debian/patches/fix-dpkg-buildflags-on-c-c++.patch
> --- python-escript-5.6/debian/patches/fix-dpkg-buildflags-on-c-c++.patch	1970-01-01 08:00:00.000000000 +0800
> +++ python-escript-5.6/debian/patches/fix-dpkg-buildflags-on-c-c++.patch	2024-04-02 20:26:55.000000000 +0800
> @@ -0,0 +1,32 @@
> +Description: false postive for different build flags
> +  Do not support different different dpkg-buildflags for C vs C++
> +  In fact, cflags and cxxflags was the same with following config:
> +  cxxflags: -g -O2 -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-clash-protection -Wformat -Werror=form
> +at-security -fcf-protection -Wno-uninitialized -Werror=implicit-function-declaration
> +
> +  cflags:   -g -O2 -Werror=implicit-function-declaration -ffile-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -fstack-
> +clash-protection -Wformat -Werror=format-security -fcf-protection -Wno-uninitialized
> + so sorted them can fix the issue.
> +
> +Author: Bo YU <tsu.yubo at gmail.com>
> +Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1068158
> +Last-Update: 2024-04-02
> +---
> +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
> +--- a/site_scons/extractdebbuild.py
> ++++ b/site_scons/extractdebbuild.py
> +@@ -57,8 +57,12 @@
> +         mycflags=val
> +     if key=="CXXFLAGS":
> +         mycxxflags=val
> +-    if mycflags is not None and mycxxflags is not None and mycflags!=mycxxflags:
> +-        raise RuntimeError("We do not current support different different dpkg-buildflags for C vs C++")
> ++    if mycflags is not None and mycxxflags is not None: 
> ++        print(mycxxflags)
> ++        print(mycflags)
> ++
> ++        if sorted(mycflags.split()) != sorted(mycxxflags.split()):
> ++            raise RuntimeError("We do not current support different different dpkg-buildflags for C vs C++")
> +     if usedflags[key] is None:
> +         continue
> +     res.append([usedflags[key],val])
> diff -Nru python-escript-5.6/debian/patches/py3.patch python-escript-5.6/debian/patches/py3.patch
> --- python-escript-5.6/debian/patches/py3.patch	2023-12-10 16:25:14.000000000 +0800
> +++ python-escript-5.6/debian/patches/py3.patch	2024-04-02 17:40:23.000000000 +0800
> @@ -4,11 +4,9 @@
>  Last-Updated: 2020-03-09
>   Updated for python3.8
>  
> -Index: python-escript-5.6/site_scons/extractdebbuild.py
> -===================================================================
> ---- python-escript-5.6.orig/site_scons/extractdebbuild.py
> -+++ python-escript-5.6/site_scons/extractdebbuild.py
> -@@ -35,7 +35,7 @@ def getdebbuildflags():
> +--- a/site_scons/extractdebbuild.py
> ++++ b/site_scons/extractdebbuild.py
> +@@ -35,7 +35,7 @@
>     mycflags=None
>     mycxxflags=None
>     try:
> @@ -17,11 +15,9 @@
>     except OSError:
>       return []
>     res=[]
> -Index: python-escript-5.6/site_scons/dependencies.py
> -===================================================================
> ---- python-escript-5.6.orig/site_scons/dependencies.py
> -+++ python-escript-5.6/site_scons/dependencies.py
> -@@ -122,7 +122,7 @@ def call_python_config(bin=None):
> +--- a/site_scons/dependencies.py
> ++++ b/site_scons/dependencies.py
> +@@ -122,7 +122,7 @@
>       cmd+='  sp=subprocess.Popen([pythonroot+"python"+pyversion+"-config","--ldflags"], stdout=subprocess.PIPE)\n'
>       cmd+='d=sp.stdout.readline().split()\n'
>       cmd+="libdirs=[z[2:] for z in d if z.startswith(b'-L')]\n"
> @@ -30,7 +26,7 @@
>       cmd+="target=''\n"
>       cmd+="libname=''\n"
>       cmd+="for d in libdirs:\n"
> -@@ -162,7 +162,7 @@ def call_python_config(bin=None):
> +@@ -162,7 +162,7 @@
>       libname=sp.stdout.readline().strip()
>       ver=sp.stdout.readline().strip()
>       pinc=sp.stdout.readline().strip()
> @@ -39,7 +35,7 @@
>   
>   def checkPython(env):
>       # First we check to see if the config file has specified
> -@@ -177,7 +177,7 @@ def checkPython(env):
> +@@ -177,7 +177,7 @@
>               python_libs=['python%s%s'%(sys.version_info[0], sys.version_info[1])]
>               verstring=".".join([str(i) for i in sys.version_info[:3]])
>           else:
> @@ -48,7 +44,7 @@
>   
>       # if we want to use a python other than the one scons is running
>       # Note: we assume scons is running python 2 in the following.
> -@@ -793,6 +793,7 @@ def checkOptionalLibraries(env):
> +@@ -793,6 +793,7 @@
>           else:
>               which = Popen(['which', 'gmsh'], stdout=PIPE)
>               path,_ = which.communicate()
> diff -Nru python-escript-5.6/debian/patches/series python-escript-5.6/debian/patches/series
> --- python-escript-5.6/debian/patches/series	2023-12-10 16:25:14.000000000 +0800
> +++ python-escript-5.6/debian/patches/series	2024-04-02 17:51:27.000000000 +0800
> @@ -12,3 +12,4 @@
>  make.patch
>  ignore-flags.patch
>  which.patch
> +fix-dpkg-buildflags-on-c-c++.patch
> diff -Nru python-escript-5.6/debian/rules python-escript-5.6/debian/rules
> --- python-escript-5.6/debian/rules	2023-12-10 16:25:14.000000000 +0800
> +++ python-escript-5.6/debian/rules	2024-04-02 18:08:31.000000000 +0800
> @@ -13,7 +13,7 @@
>  
>  #export DEB_CXXFLAGS_MAINT_APPEND = -Wno-maybe-uninitialized
>  #export DEB_CFLAGS_MAINT_APPEND = -Wno-maybe-uninitialized
> -export DEB_CXXFLAGS_MAINT_APPEND = -Wno-uninitialized
> +export DEB_CXXFLAGS_MAINT_APPEND = -Wno-uninitialized -Werror=implicit-function-declaration
>  export DEB_CFLAGS_MAINT_APPEND = -Wno-uninitialized
>  
>  DPKG_EXPORT_BUILDFLAGS = 1




-- 
Sebastian Ramacher



More information about the debian-science-maintainers mailing list