Opened 2 months ago

Last modified 8 weeks ago

#170 new defect

Failed to build GrafX2 on my Mac

Reported by: n.bruenggel@… Owned by: pulkomandy
Priority: major Milestone: 2.8
Component: GrafX2 Version:
Keywords: mac, make Cc: n.bruenggel@…

Description

Hi there :)

I just found GrafX2 and I like it. Unfortunately there are a few issues on my Mac, for example in window mode the mouse lags. So I checked out the master branch and tried to build it with make:

grafX2 🍎 CC=clang API=sdl2 make -j3 
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tools/8x8fonts/
clang -Wall -I/usr/local/Cellar/libpng/1.6.37/include/libpng16   -c -o generate_png_fonts.o generate_png_fonts.c
mkdir -p ../../bin
clang -L/usr/local/opt/python@3.10/lib -L/usr/local/Cellar/libpng/1.6.37/lib -o ../../bin/generate_png_fonts generate_png_fonts.o  -lpng16 -lz
../../bin/generate_png_fonts ../../share/grafx2/skins/
GrafX2 unicode font generator
writing ../../share/grafx2/skins/unicode_0390-03C9.png
  size : 256x16
writing ../../share/grafx2/skins/unicode_3040-309F.png
  size : 256x24
touch .fonts.generated
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src/
Building dependencies for gfx2mem.c
Building dependencies for gfx2log.c
Building dependencies for gfx2surface.c
echo "const char SVN_revision[]=\"3128\";" > version.c
Building dependencies for pversion.c
Building dependencies for realpath.c
Building dependencies for io.c
Building dependencies for fileseltools.c
Building dependencies for unicode.c
Building dependencies for colorred.c
Building dependencies for op_c.c
Building dependencies for giformat.c
Building dependencies for msxformats.c
Building dependencies for ifformat.c
Building dependencies for cpcformats.c
Building dependencies for c64formats.c
Building dependencies for stformats.c
Building dependencies for motoformats.c
Building dependencies for pngformat.c
if [ -d ../3rdparty ] ; then /Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../3rdparty 6502 ; fi
Building dependencies for c64load.c
Building dependencies for tifformat.c
Building dependencies for packbits.c
Building dependencies for loadsavefuncs.c
Building dependencies for libraw2crtc.c
Building dependencies for oldies.c
Building dependencies for fileformats.c
Building dependencies for miscfileformats.c
Building dependencies for tests/tests.c
Building dependencies for tests/testop_c.c
Building dependencies for tests/testmain.c
Building dependencies for tests/testio.c
Building dependencies for tests/testformats.c
Building dependencies for tests/mockui.c
if [ -d ../3rdparty ] ; then /Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../3rdparty recoil ; fi
Building dependencies for tests/mockloadsave.c
Building dependencies for loadrecoil.c
Building dependencies for tiles.c
Building dependencies for layers.c
Building dependencies for buttons_effects.c
Building dependencies for brush_ops.c
Building dependencies for 2gsformats.c
Building dependencies for loadsave.c
Building dependencies for factory.c
Building dependencies for transform.c
Building dependencies for hotkeys.c
Building dependencies for input.c
Building dependencies for mountlist.c
Building dependencies for brush.c
Building dependencies for windows.c
Building dependencies for pxquad.c
Building dependencies for pxwide2.c
Building dependencies for pxtall3.c
Building dependencies for pxtall2.c
Building dependencies for pxtriple.c
Building dependencies for pxdouble.c
Building dependencies for pxwide.c
Building dependencies for pxtall.c
Building dependencies for pxsimple.c
Building dependencies for setup.c
Building dependencies for SFont.c
Building dependencies for text.c
Building dependencies for keyboard.c
Building dependencies for shade.c
Building dependencies for saveini.c
Building dependencies for readini.c
Building dependencies for filesel.c
Building dependencies for engine.c
Building dependencies for readline.c
Building dependencies for pages.c
Building dependencies for operatio.c
Building dependencies for help.c
Building dependencies for palette.c
Building dependencies for buttons.c
Building dependencies for special.c
Building dependencies for osdep.c
Building dependencies for misc.c
Building dependencies for sdlscreen.c
Building dependencies for graph.c
Building dependencies for init.c
Building dependencies for main.c
Building dependencies for version.c
recoil-6.1.1: fetching https://downloads.sourceforge.net/project/recoil/recoil/6.1.1/recoil-6.1.1.tar.gz (or http://nanard.free.fr/grafx2/recoil-6.1.1.tar.gz) 
cd archives && /usr/local/bin/wget -nv https://github.com/redcode/6502/releases/download/v0.1/6502-v0.1.tar.xz
2022-05-30 23:23:00 URL:https://objects.githubusercontent.com/github-production-release-asset-2e65be/15108769/c4ec2e80-e52a-11e8-9911-302d525c4d0c?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20220530%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20220530T212259Z&X-Amz-Expires=300&X-Amz-Signature=dc5512da9facd4d7d29fd7197200a008d47a12757bc852a60636ffe608cc159d&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=15108769&response-content-disposition=attachment%3B%20filename%3D6502-v0.1.tar.xz&response-content-type=application%2Foctet-stream [22392/22392] -> "6502-v0.1.tar.xz" [1]
/usr/bin/tar xJf archives/6502-v0.1.tar.xz
cd 6502 ; for p in 6502-illegal-opcode.patch ; do echo "applying $p" ; patch -p1 < ../$p ; done
applying 6502-illegal-opcode.patch
patching file sources/6502.c
Hunk #1 succeeded at 762 (offset -1 lines).
touch 6502/.ok
cp -v 6502/README ../doc/README-6502.txt
6502/README -> ../doc/README-6502.txt
if [ -f ../3rdparty/6502/sources/6502.c ] ; then cp ../3rdparty/6502/sources/6502.c 6502.c ; fi
if [ -f ../3rdparty/6502/API/emulation/CPU/6502.h ] ; then cp ../3rdparty/6502/API/emulation/CPU/6502.h 6502.h ; fi
Building dependencies for 6502.c
2022-05-30 23:23:01 URL:https://deac-fra.dl.sourceforge.net/project/recoil/recoil/6.1.1/recoil-6.1.1.tar.gz [473680/473680] -> "recoil-6.1.1.tar.gz" [1]
/usr/bin/tar xzf archives/recoil-6.1.1.tar.gz
cd recoil-6.1.1 ; for p in  ; do echo "applying $p" ; patch -p1 < ../$p ; done
touch recoil-6.1.1/.ok
cp -v recoil-6.1.1/README ../doc/README-recoil.txt
recoil-6.1.1/README -> ../doc/README-recoil.txt
if [ -f ../3rdparty/recoil-6.1.1/recoil.c ] ; then cp ../3rdparty/recoil-6.1.1/recoil.c recoil.c ; fi
if [ -f ../3rdparty/recoil-6.1.1/recoil.h ] ; then cp ../3rdparty/recoil-6.1.1/recoil.h recoil.h ; fi
Building dependencies for recoil.c
Building dependencies for c64load.c
Building dependencies for loadrecoil.c
Building dependencies for help.c
Compiling main.c
Compiling init.c
Compiling graph.c
Compiling sdlscreen.c
Compiling misc.c
Compiling osdep.c
Compiling special.c
Compiling buttons.c
Compiling palette.c
Compiling help.c
Compiling operatio.c
Compiling pages.c
Compiling readline.c
Compiling engine.c
Compiling filesel.c
Compiling fileseltools.c
Compiling op_c.c
Compiling readini.c
readini.c:887:23: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
    if ((values[0]>0) || (values[0]<=2000))
        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
readini.c:879:23: warning: overlapping comparisons always evaluate to true [-Wtautological-overlap-compare]
    if ((values[0]>0) || (values[0]<=2000))
        ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
Compiling saveini.c
2 warnings generated.
Compiling shade.c
Compiling keyboard.c
Compiling io.c
Compiling version.c
Compiling text.c
Compiling SFont.c
Compiling setup.c
Compiling pxsimple.c
Compiling pxtall.c
Compiling pxwide.c
Compiling pxdouble.c
Compiling pxtriple.c
Compiling pxtall2.c
Compiling pxtall3.c
Compiling pxwide2.c
Compiling pxquad.c
Compiling windows.c
Compiling brush.c
Compiling realpath.c
Compiling mountlist.c
Compiling input.c
Compiling hotkeys.c
Compiling transform.c
Compiling pversion.c
make: *** [grafx2] Error 2

Unfortunately I don't know make well, I cannot find out where the errors that cause make to exit with Error 2 come from. Btw: Should it be and instead of or at readini.c:887 and readini.c:879?

I also tried running make with V=1, but I do not get more output:

grafX2 🍎 CC=clang API=sdl2 make -j3 V=1
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C tools/8x8fonts/
make[1]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C src/
make: *** [grafx2] Error 2

I run Mac OS 11.6.6 (20G624), the make version is: GNU Make 3.81

Attachments (1)

CMakeLists.txt (4.3 KB ) - added by n.bruenggel@… 8 weeks ago.
Quickly hacked together CMake file.

Download all attachments as: .zip

Change History (9)

comment:1 by Thomas Bernard, 2 months ago

that is strange
what if you run make directly from the src/ subdirectory ?

$ cd src
$ CC=clang API=sdl2 make

comment:2 by Thomas Bernard, 2 months ago

also have you installed a SDL2 sdk somehow (through brew or macports).
if not, you should go to 3rdparty directory and build it

$ cd 3rdparty
$ CC=clang API=sdl2 make

comment:3 by n.bruenggel@…, 2 months ago

src 🍎 CC=clang API=sdl2 make 
src 🍎 echo $?
2

humm?

comment:4 by n.bruenggel@…, 2 months ago

I installed SDL2 through brew:

src 🍎 brew list | grep sdl
sdl2
sdl2_gfx
sdl2_image
sdl2_net
sdl2_ttf

comment:5 by Thomas Bernard, 2 months ago

if there is no error message, I just don't know how to help you.
it looks like it doesn't even try to link.
What's the output of the following commands ? (always from the src/ directory)

$ CC=clang API=sdl2 make print-BIN
$ CC=clang API=sdl2 make print-MACAPPEXE

comment:6 by n.bruenggel@…, 2 months ago

src 🍎 CC=clang API=sdl2 make print-BIN
BIN = ../bin/grafx2-sdl2
src 🍎 CC=clang API=sdl2 make print-MACAPPEXE
MACAPPEXE = Grafx2.app/Contents/MacOS/Grafx2

But the files reported by make do not exist. In principle I would just need to compile and link the files in the src folder which depend on a few other libs (SDL2 being the most important one), right? If I find some time I will try to compile with CMake.

comment:7 by Thomas Bernard, 2 months ago

../bin/grafx2-sdl2 is indeed the linked binary that makes doesn't even try to build.

you should find the .o files in ../obj/macosx-sdl2

by n.bruenggel@…, 8 weeks ago

Attachment: CMakeLists.txt added

Quickly hacked together CMake file.

comment:8 by n.bruenggel@…, 8 weeks ago

In case anyone is interested in this: I got it to compile on my Mac using a quickly hacked together CMake file (see attachment).

Note: See TracTickets for help on using tickets.