Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can't build on macos #3

Open
hemna opened this issue Sep 28, 2021 · 15 comments
Open

can't build on macos #3

hemna opened this issue Sep 28, 2021 · 15 comments
Labels
help wanted Extra attention is needed

Comments

@hemna
Copy link

hemna commented Sep 28, 2021

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
@WickedSmoke
Copy link
Contributor

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.

@WickedSmoke
Copy link
Contributor

The SaveGame warning has been fixed in commit 467787e.

@hemna
Copy link
Author

hemna commented Sep 30, 2021

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

@hemna
Copy link
Author

hemna commented Sep 30, 2021

Do you have a link to the Boron source ? I can't seem to find the project

@WickedSmoke
Copy link
Contributor

The Boron homepage is http://urlan.sourceforge.net/boron/. The Makefile.macosx will probably need to be modified to link with libboron.

@WickedSmoke
Copy link
Contributor

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?

@hemna
Copy link
Author

hemna commented Sep 30, 2021

I tried to reconfigure and make again, but it's failing on the missing boron.h

@WickedSmoke
Copy link
Contributor

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.

@hemna
Copy link
Author

hemna commented Sep 30, 2021

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

@WickedSmoke
Copy link
Contributor

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

@hemna
Copy link
Author

hemna commented Oct 1, 2021

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

@hemna
Copy link
Author

hemna commented Oct 1, 2021

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.

@WickedSmoke
Copy link
Contributor

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".

@hemna
Copy link
Author

hemna commented Oct 1, 2021

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

@WickedSmoke
Copy link
Contributor

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.

@WickedSmoke WickedSmoke added the help wanted Extra attention is needed label Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants