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

2024-04-02 Thread Bo YU
On Tue, Apr 2, 2024 at 11:19 PM Sebastian Ramacher  wrote:
>
> Hi
>
> On 2024-04-02 23:16:16 +0800, Bo YU wrote:
> > Tags: patch
> >
> > Hi,
> > >  File "/<>/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=/<>=. -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.

Thanks for clarification.

Once cleared my local build, I will push this update again.

BR,
Bo
>
> Cheers
>



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

2024-04-02 Thread Sebastian Ramacher
Hi

On 2024-04-02 23:16:16 +0800, Bo YU wrote:
> Tags: patch
> 
> Hi,
> >  File "/<>/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=/<>=. -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.0 
> +0800
> +++ python-escript-5.6/debian/changelog   2024-04-02 20:27:27.0 
> +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   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.0 +0800
> +++ python-escript-5.6/debian/patches/fix-dpkg-buildflags-on-c-c++.patch  
> 2024-04-02 20:26:55.0 +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=/<>=. 
> -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=/<>=. -fstack-protector-strong -fstack-
> +clash-protection -Wformat -Werror=format-security -fcf-protection 
> -Wno-uninitialized
> + so sorted them can fix the issue.
> +
> +Author: Bo YU 
> +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.0 +0800
> +++ python-escript-5.6/debian/patches/py3.patch   2024-04-02 
> 17:40:23.0 +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
> -===
>  

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

2024-04-02 Thread Bo YU

Tags: patch

Hi,

 File "/<>/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=/<>=. -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?



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.0 +0800
+++ python-escript-5.6/debian/changelog 2024-04-02 20:27:27.0 +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   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.0 +0800
+++ python-escript-5.6/debian/patches/fix-dpkg-buildflags-on-c-c++.patch
2024-04-02 20:26:55.0 +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=/<>=. 
-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=/<>=. -fstack-protector-strong -fstack-
+clash-protection -Wformat -Werror=format-security -fcf-protection 
-Wno-uninitialized
+ so sorted them can fix the issue.
+
+Author: Bo YU 
+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.0 
+0800
+++ python-escript-5.6/debian/patches/py3.patch 2024-04-02 17:40:23.0 
+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 @@
  

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

2024-03-31 Thread Sebastian Ramacher
Source: python-escript
Version: 5.6-6
Severity: serious
Tags: ftbfs
Justification: fails to build from source (but built successfully in the past)
X-Debbugs-Cc: sramac...@debian.org

https://buildd.debian.org/status/fetch.php?pkg=python-escript=arm64=5.6-6%2Bb3=1711889068=0

mkdir -p /<>/debian/stage3
scons  -j4   cc_optim=' -O3  '  build_dir=/<>/debian/tmp3 
verbose=on prefix=/<>/debian/stage3 
options_file=debian/sid_options.py docs
scons: Reading SConscript files ...
3.11.8 (main, Mar 26 2024, 12:04:57) [GCC 13.2.0]
RuntimeError: We do not current support different different dpkg-buildflags for 
C vs C++:
  File "/<>/SConstruct", line 172:
env = Environment(tools = ['default'], options = vars,
  File "/usr/lib/python3/dist-packages/SCons/Environment.py", line 1231:
variables.Update(self)
  File "/usr/lib/python3/dist-packages/SCons/Variables/__init__.py", line 187:
exec(contents, {}, values)
  File "", line 84:

  File "/<>/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

Cheers
-- 
Sebastian Ramacher