problems with compiling code on mac os

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

Moderator: Forum Moderators

Post Reply
nosba
Posts: 7
Joined: January 17th, 2016, 4:49 pm

problems with compiling code on mac os

Post by nosba »

Hi all,

I'd like to start helping in coding Battle for Wesnoth. I downloaded the source from the git repository and I tried to compile it... I have already downloaded the dependences and I configured the correct path to libraries in CMakeCache. But when i try to compile the code, the linker gives me an error: "undefined symbols for architecture...". I know that it is an error that usually occurs when a library is missing.

I installed all dependences listed in INSTALL file (excepted the optionals ones). What am I doing wrong? is there some Hack to use on MacOSX?
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: problems with compiling code on mac os

Post by Celtic_Minstrel »

A common cause of this is that someone who's not using a Mac added a new source file. It'll definitely be fixed at some point (I'll get to it as soon as I can), but if you want to get started right away, you could try perusing recent commits to see if there were any added files.

It could also help if you give a list of the undefined symbols - it might help someone identify which source file is not included in the XCode project, if that's the cause, or give some clues to what else might be the issue here.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: problems with compiling code on mac os

Post by Celtic_Minstrel »

I tested a hour or so ago, and this is not due to a missing file in the XCode project, so further information (such as the actual error output) is required to help you with this issue. Alternatively, I just noticed you're using CMake, so you could try using the included XCode project instead (though that means putting the dependencies in Headers and lib folders next to the project file).
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
nosba
Posts: 7
Joined: January 17th, 2016, 4:49 pm

Re: problems with compiling code on mac os

Post by nosba »

I use CLion not XCode and I compile manually with terminal, but I tried even with XCode and it doesn't work.

The error is incomprehensible for me, however I will put a screenshot of the error maybe you can understand it.
error screenshot
error screenshot
The error continues printings "maybe you meant: ....[so much assembly labels]..."

There is also many warnings but they are caused by the missing optional libraries.
User avatar
Celtic_Minstrel
Developer
Posts: 2158
Joined: August 3rd, 2012, 11:26 pm
Location: Canada
Contact:

Re: problems with compiling code on mac os

Post by Celtic_Minstrel »

Okay, so I'm guessing that the issue here is that the CMake is not (currently) equipped to handle OSX builds. This is probably possible to fix, though. Basically, an OSX build requires three additional source files: "projectfiles/Xcode/Mac\ Sources/SDLMain.mm" and "src/desktop/apple_notification.mm" for the game, and "projectfiles/Xcode/Mac\ Sources/server_main.m" for the server. I can try to add conditionals for these, though I don't know much about CMake so it could take some time; you might be able to do it faster.

I'm also curious about what failed when you tried XCode, because the XCode project definitely works for me as of almost the latest master.
Author of The Black Cross of Aleron campaign and Default++ era.
Former maintainer of Steelhive.
Post Reply