can't build on macos
Opened this issue · 15 comments
I ran ./configure
then make, which fails
└─> make
make -C src -f Makefile.macosx
make[1]: *** No rule to make target `macosx/SDLMain.m', needed by `macosx/SDLMain.o'. Stop.
make: *** [src/u4] Error 2
I have SDL installed via brew.
I cd into src dir and ran make, which got further, but still failed
./xu4.h:11:1: note: did you mean struct here?
class SaveGame;
^~~~~
struct
person.cpp:33:10: fatal error: 'boron/boron.h' file not found
#include <boron/boron.h>
^~~~~~~~~~~~~~~
4 warnings and 1 error generated.
make: *** [person.o] Error 1
By default Allegro & Boron are used. If you wish to use SDL & libxml then configure with the "--sdl --xml" options. If you want to use Boron you must install that from source first.
I have no idea if the project still builds and runs on Mac OS. Please let us know if you get it working.
The SaveGame warning has been fixed in commit 467787e.
Thanks for the help. I got the build to complete, but launching it results in no display window
Unable to obtain graphics context for NSWindow (Mojave behavior)
screen initialized [screenInit()], using Quartz video driver
xu4: warning: Unsupported SDL pixel format: 32:0000ff00
Do you have a link to the Boron source ? I can't seem to find the project
The Boron homepage is http://urlan.sourceforge.net/boron/. The Makefile.macosx will probably need to be modified to link with libboron.
The display messages may be two separate issues. You will have to debug the "Unable to obtain graphics context" problem. The unsupported pixel format warning will not prevent the program from running, but would most likely result in bad RGB mapping.
The SDL backend really needs to be updated to SDL2. Is there any chance you can try the Allegro backend?
I tried to reconfigure and make again, but it's failing on the missing boron.h
Where did the headers get installed (what commands did you use to install Boron)? By default they are put under /usr/local which might not be in the default compiler include path.
Please note that using the Boron configuration currently requires the Allegro backend, as the scripts are read from the u4.mod file. Xu4 game modules are not currently supported when using SDL.
So I tried to install boron from the 2.0.6 tarball and building it, but it fails to build too.
1 warning generated.
libtool -dynamiclib -o libboron.dylib .obj/env.o .obj/array.o .obj/binary.o .obj/block.o .obj/coord.o .obj/date.o .obj/path.o .obj/string.o .obj/context.o .obj/gc.o .obj/serialize.o .obj/tokenize.o .obj/vector.o .obj/parse_block.o .obj/parse_string.o .obj/str.o .obj/mem_util.o .obj/quickSortIndex.o .obj/fpconv.o .obj/os.o .obj/boron.o .obj/port_file.o .obj/wait.o .obj/hashmap.o .obj/well512.o .obj/random.o .obj/port_socket.o -install_name @rpath/libboron.dylib -lm -lz
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `d' in: -dynamiclib
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
make: *** [libboron.dylib] Error 1
It looks like the correct libtool option is "-dynamic". Try replacing "-dynamiclib" with that in the Makefile.
An alternative to that is to use "./configure --static". This may be better overall as you won't have any problems linking at runtime. The xu4 development snapshots for Linux and Windows (http://xu4.sourceforge.net/download.php) use this option. The actual configuration used is:
./configure --no-execute --no-socket --static --thread
ok thanks. That helped to build boron. I also had to do make install-dev to get the header files to be installed in /usr/local/include. I then re-ran u4 ./configure --allegro --boron. The Makefile from the top level directory still errors out with
└─> make
make -C src -f Makefile.macosx
make[1]: *** No rule to make target `macosx/SDLMain.m', needed by `macosx/SDLMain.o'. Stop.
make: *** [src/u4] Error 2
I can cd into src and run make and that now completes.
I then have to cd .. (back to the top level u4 directory to run the app)
└─> src/u4 -i -v
xu4: error: Cannot open module u4.mod
It looks like the src/Makefile.macosx assumes that there are files called macosx/SDLMain.m and macosx/SDLMain.h
those files don't exist.
Yes, Makefile.macosx needs to be fixed to not assume libxml & SDL are being used. You can look at Makefile (for Linux) to see how the UI & CONF variables are used.
To build the u4.mod game module run "./tools/pack-xu4.b" from the project root. The script assumes boron (the interpreter binary) is installed in /usr/bin. If it is not then run "/path/to/boron tools/pack-xu4.b".
ok I was just discovering there lots of assumptions in the makefile for SDL. Also src/u4.cpp assumes SDL here:
https://github.com/xu4-engine/u4/blob/master/src/u4.cpp#L32
You are probably the first to build the project for Mac in years. If you can sort out those issues and submit a patch it would be most welcome.