Can not compile with XCode 8 and open wesnoth

Get help with compiling or installing the game, and discuss announcements of new official releases.

Moderator: Forum Moderators

Post Reply
DuJust
Posts: 4
Joined: November 10th, 2016, 4:56 am

Can not compile with XCode 8 and open wesnoth

Post by DuJust »

Hi all, I'm new to Wesnoth. I'm going to learn and write Wesnoth AI, so I tried to compile the master 8cf7bb8 on my own. Unfortunately I'm failed after three days' try, so I'm asking you guys for help.

I'm using Sierra Mac OS and XCode 8.1, and I install all dependences mentioned in INSTALL file(SDL2_mixer with Ogg Vorbis is a little trip).

1. I tried compile with scons, the check output is as following. The compile result was good, but when I tried to open it, it shows the following messages and hang. I tried a packaged one(version 1.13.6), it only cost about half minute to open.

Code: Select all

$ workspace/github/wesnoth/wesnoth ; exit;
objc[9067]: Class SDLApplication is implemented in both /usr/local/opt/sdl2/lib/libSDL2-2.0.0.dylib (0x10b778d70) and /Users/DuJust/workspace/github/wesnoth/wesnoth (0x10ae138d8). One of the two will be used. Which one is undefined.

Code: Select all

checking logs:
...
Saved options: default_targets = 'wesnoth,wesnothd', gettextdir = '/usr/local/opt/gettext', jobs = 3
Building Wesnoth version 1.13.6+dev
---[checking prerequisites]---
Checking for C library m... (cached) yes
Checking for C function round()... (cached) yes
Checking whether C++ compiler works (g++ version >= 4.8 required)... (cached) yes
Checking for Boost iostreams library version >= 1.48.0... (cached) yes
Checking for gzip support in Boost Iostreams... (cached) yes
Checking for bzip2 support in Boost Iostreams... (cached) yes
Checking for C library pthread... (cached) yes
Checking for Boost system library... (cached) yes
Checking for Boost asio library... (cached) yes
Checking for Boost random library version >= 1.48.0... (cached) yes
Checking for Boost smart_ptr library... (cached) yes
Checking for Boost system library... (cached) yes
Checking for Boost filesystem library version >= 1.48.0... (cached) yes
Checking for Boost locale library... (cached) yes
INFO: Base prerequisites are met
Checking for Simple DirectMedia Layer library version >= 2.0.4... (cached) yes
Checking for SDL2_ttf library... (cached) yes
Checking for SDL2_mixer library... (cached) yes
Checking for SDL2_image library... (cached) yes
Checking for C library vorbisfile... (cached) yes
Checking for Ogg Vorbis support in SDL... (cached) yes
Checking for PNG support in SDL... (cached) yes
Checking for JPG support in SDL... (cached) yes
Checking for Pango with cairo backend... (cached) yes
Checking for fontconfig... (cached) yes
Checking for Boost program_options library version >= 1.48.0... (cached) yes
Checking for Boost thread library... (cached) yes
Checking for Boost regex library... (cached) yes
Checking for C library X11... (cached) no
Checking for dbus-1... (cached) yes
Checking for fribidi >= 0.10.9... (cached) yes
Checking for C library png... (cached) yes
Checking for C library history... (cached) no
WARNING: Can't find GNU history, disabling history support.
Checking for Boost unit_test_framework library... (cached) yes
  If any config checks fail, look in build/config.log for details
  If a check fails spuriously due to caching, use --config=force to force its rerun
NLS tools are not present...
NLS catalogue installation is disabled.
---[applying configuration]---
scons: done reading SConscript files.
scons: Building targets ...
2. I also tried to build with XCode, but it seems to be more difficult. The material in https://sourceforge.net/downloads/wesno ... e%20Stuff/ is out of date, it didn't provide like SDL2, etc. So I copied the lib and headers from the material and covered with the lib from packaged 1.13.6, but it's still broken.

The first problem is 'no such file' error. There are two files not in repo, `linit.cpp` and `input_stream.cpp`. I tried to delete these dependences in xcodeproj file, but still show following errors:

Code: Select all

wesnoth/src/gui/dialogs/lua_interpreter.cpp:214:5: Use of undeclared identifier 'append_history'
wesnoth/src/gui/dialogs/lua_interpreter.cpp:307:14: Use of undeclared identifier 'history_list'
I figured out `linit.cpp` is from Lua, I also tried to copy `linit.c` from lua 5.1.4 and rename, but it failed again.

It would be very thankful for anybody's help. :)
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Can not compile with XCode 8 and open wesnoth

Post by Celtic_Minstrel »

Regarding XCode, it's unfortunate timing that you happened to grab the master branch while we were in the middle of some code churn (quite a few files deleted) and the XCode project had not yet been updated. I finally updated it today, so if you pull now your XCode build should work, as long as you have SDL2*. Those errors in lua_interpreter.cpp are caused by missing the readline library, but that library is optional, so if you can't find it you can disable it by editing the project settings and removing the HAVE_HISTORY preprocessor define.

As for scons... the reason you can't just run the executable produced by the build is because it doesn't know where to find the nib. It should work if you substitute that executable into the 1.13.6 package, for example (though that would also make it use the 1.13.6 data unless you passed command-line arguments to override that).

* SDL2 can be downloaded at libsdl.org. You also need SDL2_mixer, SDL2_image, and SDL2_ttf. I'm linking these directly because I personally had some trouble locating them, particularly the last three.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
DuJust
Posts: 4
Joined: November 10th, 2016, 4:56 am

Re: Can not compile with XCode 8 and open wesnoth

Post by DuJust »

Hi Celtic, thanks very much for your help.

For the XCode part, the HAVE_HISTORY problem is solved, and I download SLD2* with your links and all other dependences, like latest boost(1.62.0), as I notices you've updated it. I found out a quick way to fetch them: after installed by homebrew, open the boost folder and copy all *.dylib in lib folder, but I still get error as following. After google, I found out it may need to import the boost_regex lib, but I notice you've import the boost_regex-mt one. It shows the same error even I add boost_regex in the project settings. Do I need more specific on project settings?

Code: Select all

Undefined symbols for architecture x86_64:
  "boost::re_detail::get_mem_block()", referenced from:
  "boost::re_detail::put_mem_block(void*)", referenced from:
...
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Can not compile with XCode 8 and open wesnoth

Post by Celtic_Minstrel »

If you have both -mt and non-mt versions of the Boost libs, you should probably use only the -mt versions. You mentioned that you copied the dylibs from Homebrew's lib folder into Wesnoth's lib folder, but did you do the same with the Boost headers? In other words, delete the Headers/boost folder that came from MacCompileStuff and copy the boost folder from Homebrew's include folder in its place. If you use Boost 1.54 headers but 1.62 libs, it's not likely to work.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
DuJust
Posts: 4
Joined: November 10th, 2016, 4:56 am

Re: Can not compile with XCode 8 and open wesnoth

Post by DuJust »

Hi Celtic,

It works after adding boost header, thanks! There's another issue as attachment of the ugly output. I download pango 1.29.5(1.30+ don't provide pango-querymodules) and install, and tried many places to add `pango/pango.modules`, but the warning message is still there. Where's the `.` folder?

Code: Select all

(process:62286): Pango-CRITICAL **: No modules found:
No builtin or dynamically loaded modules were found.
PangoFc will not work correctly.
This probably means there was an error in the creation of:
  './pango/pango.modules'
You should create this file by running:
  pango-querymodules > './pango/pango.modules'
Attachments
ugly output
ugly output
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: Can not compile with XCode 8 and open wesnoth

Post by Celtic_Minstrel »

I seem to recall that we were assuming pango 1.30+ specifically because it doesn't use modules anymore. You might be able to build with an earlier version though; until recently, the modules were stored in the repository. You could obtain them from this commit. Note however that XCode is no longer set up to copy them into the application package, so you'll have to either do that or copy them in yourself. The path after copying should look something like "Wesnoth.app/Contents/Resources/pango/1.8.0/modules". I'm not quite sure where the pango.modules file goes, but probably either in "Resources" or in "pango".

Personally though, I'd recommend just using a newer pango. Note that pango is dependent on several other libs, including cairo and glib, so updating one may mean you need to update all of them.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
DuJust
Posts: 4
Joined: November 10th, 2016, 4:56 am

Re: Can not compile with XCode 8 and open wesnoth

Post by DuJust »

Wow, it works! Thanks Celtic very much, it's very kind and patient of you. :)
I am going to add a summary of what I have done for the new comer as well.
Post Reply