Bug#952049: pekka-kana-2: FTBFS: SDL_image.h:100:24: error: missing binary operator before token "("

2020-02-27 Thread Carlos Donizete Froes
Hi Markus,

> I have uploaded pekka-kana-2 to unstable. The pristine-tar commit for
> version 1.2.6 was missing. Please don't forget to include it next time.

Added version 1.2.6 of pristine-tar.[1]

[1] https://salsa.debian.org/games-team/pekka-kana-2/-/tree/pristine-tar

Thanks!

-- 
⢀⣴⠾⠻⢶⣦⠀ Carlos Donizete Froes [a.k.a coringao]
⣾⠁⢠⠒⠀⣿⡁ Debian Wiki: https://wiki.debian.org/coringao
⢿⡄⠘⠷⠚⠋⠀ GPG: 4096R/B638B780
⠈⠳⣄⠀⠀⠀  2157 630B D441 A775 BEFF  D35F FA63 ADA6 B638 B780


signature.asc
Description: This is a digitally signed message part


Bug#952049: pekka-kana-2: FTBFS: SDL_image.h:100:24: error: missing binary operator before token "("

2020-02-27 Thread Markus Koschany
Hi Carlos,

I have uploaded pekka-kana-2 to unstable. The pristine-tar commit for
version 1.2.6 was missing. Please don't forget to include it next time.

Regards,

Markus



signature.asc
Description: OpenPGP digital signature


Bug#952049: pekka-kana-2: FTBFS: SDL_image.h:100:24: error: missing binary operator before token "("

2020-02-24 Thread Carlos Donizete Froes
Hi,

Thank you very much for notifying me about the bug and the fix.

I made a new version of pekka-kana-2/1.2.6-1[1] fixing this bug and 
improvements.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=952422

See you later!

-- 
⢀⣴⠾⠻⢶⣦⠀ Carlos Donizete Froes [a.k.a coringao]
⣾⠁⢠⠒⠀⣿⡁ Debian Wiki: https://wiki.debian.org/coringao
⢿⡄⠘⠷⠚⠋⠀ GPG: 4096R/B638B780
⠈⠳⣄⠀⠀⠀  2157 630B D441 A775 BEFF  D35F FA63 ADA6 B638 B780


signature.asc
Description: This is a digitally signed message part


Bug#952049: pekka-kana-2: FTBFS: SDL_image.h:100:24: error: missing binary operator before token "("

2020-02-23 Thread Simon McVittie
Control: tags -1 + patch

On Sun, 23 Feb 2020 at 19:06:42 +, Simon McVittie wrote:
> - Some weirdness in src/draw.cpp where it includes 
>   but doesn't link to -lSDL2_image, which I currently don't fully understand
>   (perhaps src/draw.cpp really only needs the base SDL2 library, and not
>   SDL2_image?)

This seems to be related to the build system not passing the $(CXXFLAGS)
to all $(CXX) invocations. See attached patch, also available at
.

I don't really understand why libsdl2 merge request 3 avoids this, but
for some reason it does.

I've also attached/included a patch to make the build show what it's
doing, which is called for by Policy §4.9; I found that change very
useful to debug this. The V=1 convention is fairly common; the
implementation using $(Q) is adapted from ioquake3.

> - Fix pekka-kana-2 to stop making these assumptions, and instead use SDL
>   with the recommended patterns:
> - PKG_CONFIG ?= pkg-config
>   (so that cross-compilation uses the correct cross-pkg-config)
> - add $(${PKG_CONFIG} --cflags sdl2) to all C/C++ compiler command-lines
> - add $(${PKG_CONFIG} --libs sdl2) to linker command-line
> - add $(${PKG_CONFIG} --cflags SDL2_mixer) to all C/C++ compiler
>   command-lines
> - add $(${PKG_CONFIG} --libs SDL2_mixer) to linker command-line
> - include SDL.h (where required) with #include 
> - include SDL_mixer.h (where required) with #include 
> - if SDL2_image is required, do the same as for SDL2_mixer
> - if SDL2_image is not required, use #include  instead

My merge request does not implement all this, only the bare minimum
to get this package compiling again.

smcv
>From ec430cb81da6c9a5e1f51bfe2633f27576d8af24 Mon Sep 17 00:00:00 2001
From: Simon McVittie 
Date: Sun, 23 Feb 2020 19:57:11 +
Subject: [PATCH 1/2] Consistently pass $(CXXFLAGS) to all $(CXX) invocations

This fixes a build failure.

Closes: #952049
---
 debian/changelog  |  8 
 ...Pass-CXXFLAGS-to-all-CXX-invocations.patch | 41 +++
 debian/patches/series |  1 +
 3 files changed, 50 insertions(+)
 create mode 100644 debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch
 create mode 100644 debian/patches/series

diff --git a/debian/changelog b/debian/changelog
index 4836128..ba920cd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+pekka-kana-2 (1.2.5-2) UNRELEASED; urgency=medium
+
+  * d/p/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch:
+Consistently pass $(CXXFLAGS) to all $(CXX) invocations, fixing a
+build failure (Closes: #952049)
+
+ -- Simon McVittie   Sun, 23 Feb 2020 19:55:35 +
+
 pekka-kana-2 (1.2.5-1) unstable; urgency=medium
 
   * New upstream release. FTCBFS bug fix. (Closes: #933080)
diff --git a/debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch b/debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch
new file mode 100644
index 000..e349bdd
--- /dev/null
+++ b/debian/patches/build-Pass-CXXFLAGS-to-all-CXX-invocations.patch
@@ -0,0 +1,41 @@
+From: Simon McVittie 
+Date: Sun, 23 Feb 2020 19:53:13 +
+Subject: build: Pass $(CXXFLAGS) to all $(CXX) invocations
+
+When it generates dependencies, the C preprocessor needs to see the
+same -I flags as for the actual compilation. Otherwise,
+"#if SDL_VERSION_ATLEAST(2,0,0)" is a syntax error.
+
+Some compiler flags are also significant at link-time, so for
+consistency, also pass the CXXFLAGS to the compiler driver while
+linking.
+
+Signed-off-by: Simon McVittie 
+Bug-Debian: https://bugs.debian.org/952049
+Forwarded: no
+---
+ Makefile | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index c2bc035..7134b33 100644
+--- a/Makefile
 b/Makefile
+@@ -45,7 +45,7 @@ pk2: makedirs $(PK2_BIN)
+ # Rules for generate the binaries using the object files
+ $(PK2_BIN): $(PK2_OBJ) $(PK2_SPRITE_OBJ) $(PK2_MAP_OBJ) $(ENGINE_OBJ)
+ 	@echo -Linking Pekka Kana 2
+-	@$(CXX) $^ $(LDFLAGS) -o $@
++	@$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) -o $@
+ 
+ # Rules for generate any *.o file
+ -include $(DEPENDENCIES)
+@@ -53,7 +53,7 @@ $(PK2_BIN): $(PK2_OBJ) $(PK2_SPRITE_OBJ) $(PK2_MAP_OBJ) $(ENGINE_OBJ)
+ build/%.o : src/%.cpp
+ 	@echo -Some dependence of $@ was changed, updating
+ 	@$(CXX) $(CXXFLAGS) -I$(SRC_DIR) -o $@ -c $<
+-	@$(CXX) -MM -MT $@ -I$(SRC_DIR) $< > build/$*.d
++	@$(CXX) $(CXXFLAGS) -MM -MT $@ -I$(SRC_DIR) $< > build/$*.d
+ 
+ makedirs:
+ 	@mkdir -p $(BIN_DIR) >/dev/null
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 000..c14b890
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+build-Pass-CXXFLAGS-to-all-CXX-invocations.patch
-- 
2.25.1

>From b5ec6a6a2dda44cd7de15a21e82479bd3f84fc27 Mon Sep 17 00:00:00 2001
From: Simon McVittie 
Date: Sun, 23 Feb 2020 20:00:10 +
Subject: [PATCH 2/2] 

Bug#951087: Bug#952049: pekka-kana-2: FTBFS: SDL_image.h:100:24: error: missing binary operator before token "("

2020-02-23 Thread Simon McVittie
On Sun, 23 Feb 2020 at 08:56:19 +0100, Lucas Nussbaum wrote:
> During a rebuild of all packages in sid, your package failed to build
> on amd64.
> 
> > In file included from src/draw.cpp:19:
> > /usr/include/SDL2/SDL_image.h:100:24: error: missing binary operator before 
> > token "("
> >   100 | #if SDL_VERSION_ATLEAST(2,0,0)

Many games make wrong-but-usually-true assumptions about where the SDL2
headers and libraries can be found, and how they relate to each other.
pekka-kana-2 seems to have these assumptions:

- Assumes that $(pkg-config --cflags sdl2) and $(pkg-config --libs sdl2)
  are also going to be enough to find SDL2_mixer headers and -lSDL2_mixer,
  similar to the neverball issue mentioned in
   and addressed in
  


- Assumes that SDL2 and SDL2_foo headers can be #included as ,
  similar to ,
   and 
  (this is not portable, and instead they are meant to be included as
  #include  and #include , which is portable)

- Some weirdness in src/draw.cpp where it includes 
  but doesn't link to -lSDL2_image, which I currently don't fully understand
  (perhaps src/draw.cpp really only needs the base SDL2 library, and not
  SDL2_image?)

Despite not being considered correct, pekka-kana-2's assumptions used to
work before we modified SDL2 to be multiarch co-installable
(). There are two ways to address this
bug:

- Fix pekka-kana-2 to stop making these assumptions, and instead use SDL
  with the recommended patterns:
- PKG_CONFIG ?= pkg-config
  (so that cross-compilation uses the correct cross-pkg-config)
- add $(${PKG_CONFIG} --cflags sdl2) to all C/C++ compiler command-lines
- add $(${PKG_CONFIG} --libs sdl2) to linker command-line
- add $(${PKG_CONFIG} --cflags SDL2_mixer) to all C/C++ compiler
  command-lines
- add $(${PKG_CONFIG} --libs SDL2_mixer) to linker command-line
- include SDL.h (where required) with #include 
- include SDL_mixer.h (where required) with #include 
- if SDL2_image is required, do the same as for SDL2_mixer
- if SDL2_image is not required, use #include  instead

- Change SDL2 so the assumptions are true again
  (for example 
  which also resolves )

I've verified that libsdl2 merge request 3 is sufficient to fix the
FTBFS (compiled successfully but not otherwise tested). However, for
best robustness, I think we would ideally do both.

smcv



Bug#952049: pekka-kana-2: FTBFS: SDL_image.h:100:24: error: missing binary operator before token "("

2020-02-23 Thread Lucas Nussbaum
Source: pekka-kana-2
Version: 1.2.5-1
Severity: serious
Justification: FTBFS on amd64
Tags: buster sid
Usertags: ftbfs-20200222 ftbfs-buster

Hi,

During a rebuild of all packages in sid, your package failed to build
on amd64.

Relevant part (hopefully):
> make[1]: Entering directory '/<>'
> -Some dependence of build/pk2.o was changed, updating
> -Some dependence of build/sprite.o was changed, updating
> -Some dependence of build/map.o was changed, updating
> -Some dependence of build/engine.o was changed, updating
> -Some dependence of build/sound.o was changed, updating
> -Some dependence of build/input.o was changed, updating
> -Some dependence of build/utils.o was changed, updating
> -Some dependence of build/language.o was changed, updating
> -Some dependence of build/log.o was changed, updating
> -Some dependence of build/draw.o was changed, updating
> -Some dependence of build/font.o was changed, updating
> In file included from src/draw.cpp:19:
> /usr/include/SDL2/SDL_image.h:100:24: error: missing binary operator before 
> token "("
>   100 | #if SDL_VERSION_ATLEAST(2,0,0)
>   |^
> make[1]: *** [Makefile:56: build/draw.o] Error 1

The full build log is available from:
   http://qa-logs.debian.net/2020/02/22/pekka-kana-2_1.2.5-1_unstable.log

A list of current common problems and possible solutions is available at
http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute!

About the archive rebuild: The rebuild was done on EC2 VM instances from
Amazon Web Services, using a clean, minimal and up-to-date chroot. Every
failed build was retried once to eliminate random failures.