ncsa-mosaic icon indicating copy to clipboard operation
ncsa-mosaic copied to clipboard

Probably won't compile with GCC 10 on Linux (`-fcommon` issue)

Open vain opened this issue 4 years ago • 7 comments

GCC 10 changed the default from -fcommon to -fno-common:

https://wiki.gentoo.org/wiki/Gcc_10_porting_notes/fno_common

I haven't tested this with your version of Mosaic, only with another fork (https://github.com/yotann/ncsa-mosaic -- because it has been ported to a newer version of libpng, see #8). IMO, it's more than likely that it affects your version as well (I don't see any relevant differences between the two) and wanted to let you know.

One blunt workaround is to add -fcommon:

diff --git a/makefiles/Makefile.linux b/makefiles/Makefile.linux
index 2cea009..ad03902 100755
--- a/makefiles/Makefile.linux
+++ b/makefiles/Makefile.linux
@@ -225,7 +225,7 @@ customflags =
 
 # ---------------------- END OF CUSTOMIZABLE OPTIONS -------------------------
 
-CFLAGS = -g $(sysconfigflags) $(prereleaseflags)
+CFLAGS = -fcommon -g $(sysconfigflags) $(prereleaseflags)
 
 # Don't worry about these -- for development purposes only.
 PURIFY = purify

As the Gentoo wiki points out, though, this is not an ideal solution. It also outlines nicely what should be done instead.

vain avatar Sep 15 '20 18:09 vain

Sorry, forgot to add the actual errors that I get:

/usr/bin/ld: ../libwww2/libwww.a(HTTP.o):/home/void/work/arch-packages/src/ncsa-mosaic/libwww2/../src/kcms.h:3: multiple definition of `KCMS_Enabled'; kcms.o:/home/void/work/arch-packages/src/ncsa-mosaic/src/kcms.h:3: first defined here
/usr/bin/ld: ../libwww2/libwww.a(HTTP.o):/home/void/work/arch-packages/src/ncsa-mosaic/libwww2/../src/kcms.h:4: multiple definition of `KCMS_Return_Format'; kcms.o:/home/void/work/arch-packages/src/ncsa-mosaic/src/kcms.h:4: first defined here
/usr/bin/ld: ../libhtmlw/libhtmlw.a(HTMLformat.o):/home/void/work/arch-packages/src/ncsa-mosaic/libhtmlw/HTMLformat.c:57: multiple definition of `Tv'; xpmread.o:/home/void/work/arch-packages/src/ncsa-mosaic/src/xpmread.c:84: first defined here
/usr/bin/ld: ../libhtmlw/libhtmlw.a(HTMLformat.o):/home/void/work/arch-packages/src/ncsa-mosaic/libhtmlw/HTMLformat.c:58: multiple definition of `Tz'; xpmread.o:/home/void/work/arch-packages/src/ncsa-mosaic/src/xpmread.c:85: first defined here
/usr/bin/ld: ../libhtmlw/libhtmlw.a(HTMLparse.o):/home/void/work/arch-packages/src/ncsa-mosaic/libhtmlw/HTMLparse.c:57: multiple definition of `Tv'; xpmread.o:/home/void/work/arch-packages/src/ncsa-mosaic/src/xpmread.c:84: first defined here
/usr/bin/ld: ../libhtmlw/libhtmlw.a(HTMLparse.o):/home/void/work/arch-packages/src/ncsa-mosaic/libhtmlw/HTMLparse.c:58: multiple definition of `Tz'; xpmread.o:/home/void/work/arch-packages/src/ncsa-mosaic/src/xpmread.c:85: first defined here

vain avatar Sep 15 '20 18:09 vain

dude, this is a browser from 1993, do you expect it to work on a modern computer?

ThePlaneGuy45 avatar May 14 '21 15:05 ThePlaneGuy45

Fingers crossed @ThePlaneGuy45

emrecio avatar May 14 '21 16:05 emrecio

@ThePlaneGuy45 Why should it not work? I recall that I managed to build a Linux binary just a few years ago. The only problem since is that libpng has changed in incompatible ways, but even that can be patched easily.

clausecker avatar May 14 '21 16:05 clausecker

@ThePlaneGuy45 Builds and runs fine once the CFLAGS setting is changed when building with gcc 10, so this is still working -- and why not? :D

legooolas avatar Nov 10 '21 09:11 legooolas

I can confirm with Ubuntu 22.04.1 LTS & gcc 11.3.0 (gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)) that -fcommon lets it build & run!

neozeed avatar Nov 08 '22 08:11 neozeed

I can confirm with Ubuntu 22.04.1 LTS & gcc 11.3.0 (gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)) that -fcommon lets it build & run!

Yes. Ubuntu Mate 22.04.3 with gcc 11.4.0. Works after adding -fcommon to CFLAGS.

smallpotato000 avatar Sep 12 '23 08:09 smallpotato000