Opened 3 years ago

Last modified 17 months ago

#62906 assigned defect

ming @0.4.8 cannot be built on PPC Leopard because static declaration of ‘swf4debug’ follows non-static declaration

Reported by: ballapete (Peter "Pete" Dyballa) Owned by: ryandesign (Ryan Carsten Schmidt)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: leopard Cc:
Port: ming

Description

/bin/sh ../../libtool  --tag=CC   --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src  -I./.. -I/opt/local/include  -pipe -Os -arch ppc -Wall -DSWF_BIG_ENDIAN -MT lex.swf4.lo -MD -MP -MF .deps/lex.swf4.Tpo -c -o lex.swf4.lo lex.swf4.c
libtool: compile:  /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src -I./.. -I/opt/local/include -pipe -Os -arch ppc -Wall -DSWF_BIG_ENDIAN -MT lex.swf4.lo -MD -MP -MF .deps/lex.swf4.Tpo -c lex.swf4.c  -fno-common -DPIC -o .libs/lex.swf4.o
./swf4compiler.flex:12: error: static declaration of ‘swf4debug’ follows non-static declaration
swf4compiler.tab.h:45: error: previous declaration of ‘swf4debug’ was here
make[4]: *** [lex.swf4.lo] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_multimedia_ming/ming/work/libming-ming-0_4_8/src/actioncompiler'

Cause is this in swf4compiler.flex:

   10	#include "swf4compiler.tab.h" /* defines token types */
   11	
   12	static int swf4debug;

In swf4compiler.tab.h we have:

   44	#if YYDEBUG
   45	extern int swf4debug;
   46	#endif

Attachments (3)

main.log (89.5 KB) - added by ballapete (Peter "Pete" Dyballa) 3 years ago.
Main.log from PPC Leopard
main.2.log (128.5 KB) - added by ballapete (Peter "Pete" Dyballa) 3 years ago.
Main.log from PPC Leopard after patching src/actioncompiler/swf[45]compiler.flex
swf45debug.patch (617 bytes) - added by ballapete (Peter "Pete" Dyballa) 3 years ago.
Patch file to solve the problems with type declarartions of swf4debug and swf5debug

Download all attachments as: .zip

Change History (24)

Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.log added

Main.log from PPC Leopard

comment:1 Changed 3 years ago by jmroot (Joshua Root)

Cc: ryandesign@… removed
Owner: set to ryandesign
Status: newassigned

comment:2 Changed 3 years ago by Min4sT1r1th (Minas Tirith Citizen)

This is a general error and not limited to PPC ; I fixed it in some ugly way, but it works:

--- src/actioncompiler/Makefile.am
+++ src/actioncompiler/Makefile.am
@@ -58,9 +58,11 @@
 
 swf4compiler.tab.h: $(srcdir)/swf4compiler.y
        $(YACC) --defines $(DEBUG) -p swf4 -b swf4compiler $(srcdir)/swf4compiler.y
+       gsed -i 44,46d $(srcdir)/swf4compiler.tab.h
 
 swf5compiler.tab.c: $(srcdir)/swf5compiler.y
        $(YACC) -p swf5 -b swf5compiler $(srcdir)/swf5compiler.y
 
 swf5compiler.tab.h: $(srcdir)/swf5compiler.y
        $(YACC) --defines $(DEBUG) -p swf5 -b swf5compiler $(srcdir)/swf5compiler.y
+       gsed -i 44,46d $(srcdir)/swf5compiler.tab.h

comment:3 in reply to:  2 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Min4sT1r1th:

A test must wait, Tiger is running…

comment:4 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Can someone file an upstream bug report, if one does not already exist for this?

comment:5 Changed 3 years ago by Min4sT1r1th (Minas Tirith Citizen)

comment:6 in reply to:  2 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Min4sT1r1th:

This is a general error and not limited to PPC ; I fixed it in some ugly way, but it works:

It did not work for me… I am going to try again, a port clean ming just finished and after this edit I'll build again.

comment:7 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

The patch file has changed its contents. Its application succeeds. And I get:

libtool: compile:  /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src -I./.. -I/opt/local/include -pipe -Os -arch ppc -Wall -DSWF_BIG_ENDIAN -MT lex.swf4.lo -MD -MP -MF .deps/lex.swf4.Tpo -c lex.swf4.c  -fno-common -DPIC -o .libs/lex.swf4.o
./swf4compiler.flex:12: error: static declaration of ‘swf4debug’ follows non-static declaration
swf4compiler.tab.h:45: error: previous declaration of ‘swf4debug’ was here
make[4]: *** [lex.swf4.lo] Error 1

Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: main.2.log added

Main.log from PPC Leopard after patching src/actioncompiler/swf[45]compiler.flex

comment:8 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

./swf4compiler.flex:12 has:

static int swf4debug;

and swf4compiler.tab.h:45 has:

extern int swf4debug;

comment:9 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

root 239 /\ egrep 'swf[45]debug;' swf[45]compiler.flex swf[45]compiler.tab.h
swf4compiler.flex:static int swf4debug;
swf5compiler.flex:static int swf5debug;
swf4compiler.tab.h:extern int swf4debug;
swf5compiler.tab.h:extern int swf5debug;

comment:10 Changed 3 years ago by Min4sT1r1th (Minas Tirith Citizen)

ok, that's strange, maybe some whitespace involved somewhere? anyway, my "patch" only removes the three offending lines in the two Makefiles - maybe for a clean patch file you just construct it yourself. One additional note: I did and verified it on two machines, one with 10.6.8, the other with 10.11.6. If requested, I could upload my build log, of course.

comment:11 in reply to:  10 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Min4sT1r1th: I am not sure what I need to achieve – that the *tab.h files have extern static int which would match the declarations in the *.flex files? According to their time stamps they all are created or changed during the build process so that I presume there is some (to me) hidden rule…

comment:12 Changed 3 years ago by Min4sT1r1th (Minas Tirith Citizen)

It's required to remove the lines with

#if YYDEBUG
extern int swf4debug;
#endif

from

.../work/libming-ming-0_4_8/src/actioncompiler/swf4compiler.tab.h
.../work/libming-ming-0_4_8/src/actioncompiler/swf5compiler.tab.h

Unfortunately these two files are generated by the Makefile in that subdirectory, therefore I found no other solution, but to add a new command to the rules which generate them, to remove these lines via gsed ; this can fail of course, if "#if YYDEBUG" is not starting on line 46 on your machine (for whatever reason); that's why I called it some ugly "fix" - I guess some sed guru can make a better variant.

(and don't try to use the built-in sed, it won't work, at least on my machines I had to use the macpports gnu sed, which is apparently much newer)

comment:13 in reply to:  12 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Min4sT1r1th: Alright! Using your original patch file that I baptised swf45debug.patch and not using duplicate-symbols-swf4debug-swf5debug.patch leads to an error:

ld: duplicate symbol _swf4debug in .libs/libming.lax/libactioncompiler.a/swf4compiler.tab.o and .libs/libming.lax/libactioncompiler.a/lex.swf4.o

So I am going to try again with duplicate-symbols-swf4debug-swf5debug.patch active.

comment:14 Changed 3 years ago by Min4sT1r1th (Minas Tirith Citizen)

yes please, my patch is an addition to the others, not a replacement.

comment:15 in reply to:  14 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Replying to Min4sT1r1th:

When I saw that the failure had been reported and a patch file existed, somehow related to this failure, I assumed this was the cure. But it's already ten days old… So it can't!

comment:16 Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

It built! I am going to upload the patch file I used.

Changed 3 years ago by ballapete (Peter "Pete" Dyballa)

Attachment: swf45debug.patch added

Patch file to solve the problems with type declarartions of swf4debug and swf5debug

comment:17 in reply to:  12 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to Min4sT1r1th:

It's required to remove the lines with

#if YYDEBUG
extern int swf4debug;
#endif

from

.../work/libming-ming-0_4_8/src/actioncompiler/swf4compiler.tab.h
.../work/libming-ming-0_4_8/src/actioncompiler/swf5compiler.tab.h

Unfortunately these two files are generated by the Makefile in that subdirectory, therefore I found no other solution, but to add a new command to the rules which generate them, to remove these lines via gsed ; this can fail of course, if "#if YYDEBUG" is not starting on line 46 on your machine (for whatever reason); that's why I called it some ugly "fix" - I guess some sed guru can make a better variant.

If it's true that that needs to be removed, then the correct solution would be to figure out why it's being added in the first place and to stop that from happening. Using sed to remove specific line numbers from a generated file is too brittle to be considered an acceptable fix; a change in ming's source files or in the program that generates that file could cause the line numbers to change, which would then cause your sed invocation to remove the wrong lines.

(and don't try to use the built-in sed, it won't work, at least on my machines I had to use the macpports gnu sed, which is apparently much newer)

"Built-in" (macOS) sed is BSD sed. MacPorts sed is GNU sed. BSD sed and GNU sed differ in some of their syntax. You can do what you want to do with BSD sed, you just have to use the right syntax. Specifically, GNU sed and BSD sed differ about whether an argument is required for the -i flag.

comment:18 Changed 19 months ago by ballapete (Peter "Pete" Dyballa)

The same error also happens in PPC Tiger, Mac OS X 10.4.11.

comment:19 Changed 19 months ago by ballapete (Peter "Pete" Dyballa)

With the supplied patch ming built here too.

comment:20 Changed 17 months ago by ballapete (Peter "Pete" Dyballa)

Recently two patches are applied to ming @0.4.8_0 and it does not build on PPC Tiger, Mac OS X 10.4.11:

mv -f .deps/swf5compiler.tab.Tpo .deps/swf5compiler.tab.Plo
/bin/sh ../../libtool  --tag=CC   --mode=compile /opt/local/bin/gcc-apple-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src  -I./.. -I/opt/local/include  -pipe -Os -arch ppc -Wall -DSWF_BIG_ENDIAN -MT lex.swf4.lo -MD -MP -MF .deps/lex.swf4.Tpo -c -o lex.swf4.lo lex.swf4.c
libtool: compile:  /opt/local/bin/gcc-apple-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src -I./.. -I/opt/local/include -pipe -Os -arch ppc -Wall -DSWF_BIG_ENDIAN -MT lex.swf4.lo -MD -MP -MF .deps/lex.swf4.Tpo -c lex.swf4.c  -fno-common -DPIC -o .libs/lex.swf4.o
./swf4compiler.flex:12: error: static declaration of 'swf4debug' follows non-static declaration
swf4compiler.tab.h:45: error: previous declaration of 'swf4debug' was here
make[4]: *** [lex.swf4.lo] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_multimedia_ming/ming/work/libming-ming-0_4_8/src/actioncompiler'

comment:21 Changed 17 months ago by ballapete (Peter "Pete" Dyballa)

On PPC Leopard, Mac OS X 10.5.8 I still get:

/bin/sh ../../libtool  --tag=CC   --mode=compile /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src  -I./.. -I/opt/local/include  -pipe -Os -arch ppc -Wall -DSWF_BIG_ENDIAN -MT lex.swf4.lo -MD -MP -MF .deps/lex.swf4.Tpo -c -o lex.swf4.lo lex.swf4.c
libtool: compile:  /usr/bin/gcc-4.2 -std=gnu99 -DHAVE_CONFIG_H -I. -I../../src -I./.. -I/opt/local/include -pipe -Os -arch ppc -Wall -DSWF_BIG_ENDIAN -MT lex.swf4.lo -MD -MP -MF .deps/lex.swf4.Tpo -c lex.swf4.c  -fno-common -DPIC -o .libs/lex.swf4.o
./swf4compiler.flex:12: error: static declaration of 'swf4debug' follows non-static declaration
swf4compiler.tab.h:45: error: previous declaration of 'swf4debug' was here
make[4]: *** [lex.swf4.lo] Error 1
make[4]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_nue.de.rsync.macports.org_macports_release_tarballs_ports_multimedia_ming/ming/work/libming-ming-0_4_8/src/actioncompiler'
Note: See TracTickets for help on using tickets.