Cannot start OpenTTD after successfully building from source on OSX

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
bence23
Engineer
Engineer
Posts: 6
Joined: 19 Mar 2020 22:04

Cannot start OpenTTD after successfully building from source on OSX

Post by bence23 »

Hi,

I just cloned the project from git and built it based on https://wiki.openttd.org/Compiling_on_Mac_OS_X. Everything compiled fine, I only have a couple deprecation or unused variable warnings. When I start the application the process doesn't seem to do anything, just hangs there. I tried to start by using the "make run" command, going straight to the build folder and running the openttd executable and creating a bundle file and starting that, the result is always the same: nothing. It doesn't stop nor provide any output. I let it run for an hour, just in case it would be processing something, but no. OSX's activity monitor shows that it uses some CPU, very little (7MB) memory and no I/O operations. I suspected that it has something to do with OSX's new security restrictions, but I couldn't find any evidence for that.

The published version that can be downloaded from www.openttd.org works fine.

I use OSX 10.15
Does anyone had this issue before? Any idea why this can happen?
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by jfs »

Try running the bundled build from the terminal. As far as I remember:

Code: Select all

make bundle
./bundle/OpenTTD.app/Content/MacOS/openttd
You should get errors and logging written to the terminal then.
bence23
Engineer
Engineer
Posts: 6
Joined: 19 Mar 2020 22:04

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by bence23 »

Thanks for the super quick response! :bow:

Unfortunately, it doesn't help it behaves the same way :cry:

Code: Select all

~/dev/OpenTTD $ make bundle
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
make[1]: Nothing to be done for `all'.
[BUNDLE] Constructing bundle
23:29:16
~/dev/OpenTTD $ ./bundle/OpenTTD.app/Contents/MacOS/openttd

... and no ouput
User avatar
jfs
Tycoon
Tycoon
Posts: 1750
Joined: 08 Jan 2003 23:09
Location: Denmark

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by jfs »

Okay try enabling driver debug then.

Code: Select all

./bundle/OpenTTD.app/Contents/MacOS/openttd -d driver=2
bence23
Engineer
Engineer
Posts: 6
Joined: 19 Mar 2020 22:04

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by bence23 »

Thanks for all the help, the debug and driver flags unfortunately don't seem to help. :?

I keep googling around the OSX security features, maybe someone else experienced the same problem with other C projects, I suspect it might be due to the fact that the process will read the user home directory, which requires new permissions to be granted. If I find something, I'll update this thread for future reference
bence23
Engineer
Engineer
Posts: 6
Joined: 19 Mar 2020 22:04

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by bence23 »

I granted all permissions to the compiled executable, no luck.

I started adding console traces to the code and I found something interesting (or it is just my complete lack of knowledge of the c++ ecosystem): In src/os/unix/unix.cpp I put an fprintf call to line 260, right before the openttd_main function call, the output was printed to the console, but if I put an fprintf call to the first line of the openttd_main function in src/openttd.cpp, that output is never printed. Does this clue rings a bell to anyone?
bence23
Engineer
Engineer
Posts: 6
Joined: 19 Mar 2020 22:04

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by bence23 »

Thanks for the update, I tried a couple things in the meantime but it didn't help. I guess I'll end up playing around with the source code in a virtual box.
MarkJor
Engineer
Engineer
Posts: 4
Joined: 12 Apr 2020 14:16

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by MarkJor »

I signed up to this forum to report that I have the same issue on MacOS Catalina 10.15.4 on a Mac mini late 2014.

I may try a fresh install of the OS and try again

edit after clean install of Mac OS 10.15.4:
The same problem persists, unfortunately.
Using Xcode command line tools 11.4
bence23
Engineer
Engineer
Posts: 6
Joined: 19 Mar 2020 22:04

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by bence23 »

I couldn't get it fixed either, I tried with a non-Xcode C compiler and C libraries too, but that didn't help, same result. If you manage to overcome this issues, please post it here. I would love to know how to resolve it.
MarkJor
Engineer
Engineer
Posts: 4
Joined: 12 Apr 2020 14:16

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by MarkJor »

I have found a workaround, no solution unfortunately.
read the edit below

I installed a dual boot of Mac OS 10.13.6 on a separate volume.
Using Xcode command line tools version 10.1.0.0.1.1539992718 and dependencies obtained via home-brew (xz, lzo and pkg-config) I was able to compile a working version.
One that also works on 10.15.4!

In Catalina 10.15.4 I had no such luck.
Utilizing Xcode command line tools version 11.4.0.0.1.1583798712 on that OS.

Since I was recently still able to compile on my Catalina installation, my guess is that something changed in the command line tools that causes the compiled program to not work properly anymore.

edit: confirmed!
I installed the previous version of the Xcode command line tools: 11.3.1.0.1.15796735732 and OpenTTD runs like a breeze!
With the 11.4 version I saw a lot of linker errors at the end of the make command, using 11.3.1 there were none.

How to get the 11.3.1 Command line tools:
1. Go to: https://developer.apple.com/support/xcode/
2. Click 'Account' in the top right corner
3. Login with your Apple ID and agree to the developer account terms (it's a free account)
4. After login go the the 'Downloads' section in the left column.
5. You'll land on the Beta releases page, which is not what we're looking for. So click on 'More' on the top right, just above the 'Sign out' link of your account.
6. You can now search the available downloads. Search for ' 11.3.1' and download the 'Command Line Tools for Xcode 11.3.1', install and compile again!
7. Don't update to newer versions or keep this one safe after you have tried newer command line tools versions and running the program fails again.

Good luck and have fun with OpenTTD again!
MarkJor
Engineer
Engineer
Posts: 4
Joined: 12 Apr 2020 14:16

Re: Cannot start OpenTTD after successfully building from source on OSX

Post by MarkJor »

I have tried the new xcode command line tools that come with Xcode 11.5.
To be specific version: 11.5.0.0.1.1588476445.

I can compile a bundle that runs without issues.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 9 guests