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

Cannot compile on OS X 10.10.4 #408

Closed
AKorzeniowski opened this issue Nov 17, 2014 · 17 comments
Closed

Cannot compile on OS X 10.10.4 #408

AKorzeniowski opened this issue Nov 17, 2014 · 17 comments

Comments

@AKorzeniowski
Copy link
Contributor

@AKorzeniowski AKorzeniowski commented Nov 17, 2014

I've tried to compile the game under OS X 10.10.1 on my MBA, according to this guide and while the makefile was successfully created, the make command fails.

 /usr/include/dispatch/object.h:143:15: error: expected unqualified-id before '^' token
  typedef void (^dispatch_block_t)(void);
                ^
 /usr/include/dispatch/object.h:143:15: error: expected ')' before '^' token
 /usr/include/dispatch/object.h:362:3: error: 'dispatch_block_t' has not been declared
    dispatch_block_t notification_block);
    ^

Full log: https://gist.github.com/Schocker/a560af18a7c2330f1d63
GCC 4.8 from MacPorts, as the guide mentions, I only had to install PhysFS manually.

@krzys-h
Copy link
Member

@krzys-h krzys-h commented Nov 17, 2014

Seems like an error somewhere in Mac OS's internal include files.
You can try passing -DSYSTEM_CPP_MODULE=system_other.cpp to CMake or change it at line 90 of main CMakeLists.txt.
Doing this means that it will save files to ./saves in current directory instead of user's directory.

@AKorzeniowski
Copy link
Contributor Author

@AKorzeniowski AKorzeniowski commented May 1, 2015

Telling it to compile for "other" systems allows the compilation to go much further but it still finishes with an error. The compilation ends right after it complains about undefined symbols, but I'm not really sure what is the exact problem.

Full log: https://gist.github.com/Schocker/eb1344247017e01da799

@krzys-h
Copy link
Member

@krzys-h krzys-h commented May 2, 2015

@Shocker That's because of this part not being executed if you force a diffrent system - https://github.com/colobot/colobot/blob/dev/src/CMakeLists.txt#L46-L50
The same happens for X11, but the dependency for X11 on Mac has been recently removed (#416). Could you check if latest dev compiles?

@AKorzeniowski
Copy link
Contributor Author

@AKorzeniowski AKorzeniowski commented May 2, 2015

Not at all, unfortunately. Compiling with system_macosx.cpp yields exactly the same error as it did before, changing it to system_other.cpp doesn't cause so many undefined symbols, but still errors out on it:

[ 92%] Building CXX object src/CMakeFiles/colobot.dir/app/main.cpp.o
Linking CXX executable ../colobot
Undefined symbols for architecture x86_64:
  "vtable for CSystemUtilsMacOSX", referenced from:
      CSystemUtilsMacOSX::CSystemUtilsMacOSX() in libcolobotbase.a(system.cpp.o)
  NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
[...]

Full log once again (it's not much different though): https://gist.github.com/Schocker/c25bbb438131415552ea

@AKorzeniowski AKorzeniowski changed the title Cannot compile on OS X 10.10.1 using GCC 4.8 Cannot compile on OS X 10.10.4 using GCC 4.8 May 2, 2015
@krzys-h
Copy link
Member

@krzys-h krzys-h commented May 2, 2015

You are only changing the file that is compiled, you also need to fix the code that uses it here:
https://github.com/colobot/colobot/blob/master/src/app/system.cpp#L26-L34
https://github.com/colobot/colobot/blob/master/src/app/system.cpp#L51-L59

@AKorzeniowski
Copy link
Contributor Author

@AKorzeniowski AKorzeniowski commented May 2, 2015

Thanks, it has helped a lot. The game now compiles successfully, same goes with .DMG creation. The app lacks an icon, though (but it has probably got to do with letting system_macosx.cpp go) and closes right after opening.

Here's the log from Console.app right after launching the game: https://gist.github.com/Schocker/8dccf2775bc88c5cddfc

@krzys-h
Copy link
Member

@krzys-h krzys-h commented May 2, 2015

Looks like some internal problem in SDL_VideoInit. I have no idea how to fix this.

@piotrdz
Copy link
Contributor

@piotrdz piotrdz commented May 3, 2015

I think this problem is with SDL itself which in version 1.2 has not been updated to run on newest OS X, while SDL 2.0 is supposed to run fine. Maybe we should consider upgrading to newer SDL version.

I also think that the instructions for compiling should be updated, as it is not necessary to use GCC 4.8 nor Mac Ports. On my virtual machine with OS X Mavericks, I used Clang from Command Line Developer Tools and Homebrew (http://brew.sh/). There is only one package for perl, which requires manual install, and otherwise it is as easy as executing "brew install ".

@AKorzeniowski
Copy link
Contributor Author

@AKorzeniowski AKorzeniowski commented May 4, 2015

@piotrdz If using Homebrew is an option, I'm all for it (especially if it also means less things to clutter up my poor SSD).
Mind telling more about what have you installed on your Mavericks VM?

@piotrdz
Copy link
Contributor

@piotrdz piotrdz commented May 4, 2015

I wrote a short description of compilation with Homebrew: https://gist.github.com/piotrdz/f1bfdab638caca1aa280

@AKorzeniowski
Copy link
Contributor Author

@AKorzeniowski AKorzeniowski commented Jun 5, 2015

Okay, so we have some progress.
First of all, current dev compiles! (woo-hoo!) Unfortunately, the app package can not be created. :/ (boo!) And since it is supposed to be run as a package, the game goes bananas when I try to launch it.

The "make package" command starts erroring out on
can't open input file: /Users/Schocker/Developer/colobot/build/_CPack_Packages/Darwin/Bundle/colobot-0.1.4+alpha-git-master~re2be034/Colobot.app/Contents/MacOS/libvorbis.0.dylib for writing (Permission denied)
and I guess all other errors are caused by this. I suppose the problem is that every file in Colobot.app/Contents/MacOS (besides colobot and libCBOT.dylib) has a chmod of 444 (vide https://gist.github.com/Schocker/f8715b72358d1601c216), so, yeah, the permissions are wrong.

Full CPack log: https://gist.github.com/Schocker/7cfa8ea4d1ca91899d55

Is there any way to alter the chmods for those files while making the package? Sorry for being a total noob in that, but I have no experience in cmake or cpack whatsoever and consulting the documentation hasn't helped much, unfortunately. I've tried to do USE_SOURCE_PERMISSIONS, but it didn't change a thing (another thing is I had no idea where to add it). :/

@AKorzeniowski AKorzeniowski changed the title Cannot compile on OS X 10.10.4 using GCC 4.8 Cannot compile on OS X 10.10.4 Jun 5, 2015
@vieux
Copy link
Contributor

@vieux vieux commented Jul 23, 2015

@Schocker I had the same issue, and it went away when I switch to brew&clang instead of macport&gcc4.8

See the update guide written by @piotrdz : https://github.com/colobot/colobot/blob/master/INSTALL-MacOSX.md

@AlexSwensen
Copy link

@AlexSwensen AlexSwensen commented Jul 24, 2015

It should be known that @piotrdz's brew guide takes into account the package: po4a, which is not a valid homebrew package from my experience.

@MrSimbax
Copy link
Member

@MrSimbax MrSimbax commented Jul 24, 2015

po4a was replaced with Python 2.7+ and is no longer needed (at least in dev branch)).

@AKorzeniowski
Copy link
Contributor Author

@AKorzeniowski AKorzeniowski commented Jul 24, 2015

@vieux Actually, the problem happens when using Homebrew + Clang. And the guide you've linked to is apparently about installing Macports and GCC.
Edit: mea culpa, the guide on the dev branch is updated for Homebrew.

I'll try to compile the game and create a package after the weekend, the connection I'm using right now is really slow. :/

@piotrdz
Copy link
Contributor

@piotrdz piotrdz commented Jul 24, 2015

@AlexSwensen You're right, po4a is not a homebrew package. I meant to write to install po4a from source.
Edit: And while it's not required right now to generate data package, it is still an optional dependency to generate translated desktop files and man pages. But if you don't have it, everything will compile fine, just with English desktop file and man page.

Edit2: Now I see that man page and desktop files are generated only on PLATFORM_GNU, that is Linux. So no po4a is needed on MacOSX.

@AKorzeniowski
Copy link
Contributor Author

@AKorzeniowski AKorzeniowski commented Aug 8, 2015

Alright, after going through a few public betas of El Capitan and installing wget (this turned out to be quite important when compiling the latest dev, since OS X does not include wget by default, thus #553), I am glad to report that I've finally managed to compile Colobot using Brew and Clang. Yayness!

The game works pretty well, albeit with some graphical glitches. But those are not related to this issue, so I'm marking it as closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants