Cannot run app by clicking on Bundle lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- Daniello · 2014-10-26 15:57 Hi guys, I've been porting a game I did with free pascal to OSX now. I don't use Lazarus, just straight opengl + openal + FPC. At first I tried creating an App Bundle manually, putting the exe on the game.app/Resources/MacOS folder, along with the files etc. Created the Info.plist, the icon displays ok, all seems a valid bundle. And of course, the game is coded already to detect the bundle resources path and such.. When I run it, it just closes and does not display any error message... However running the game on the terminal by doing ./game.app/Resources/MacOS/gamename Works! The game startups and runs fine  So this seems just some kind of App Bundle problem. I tried remaking the bundle on Lazarus, using the button that makes a bundle, etc, did all from scratch (did not compile from inside lazarus, just used the executable I had working), still same problem.. Tried something different, opening the bundle in the terminal with: open game.app The game does not start, but it shows a error message at last! SOpenURLsWithRole() failed with error -10810 for the file "pathtofileblabla" I google the error, some people say to chmod the executable, but of course, I already did that.. Anyone can help? ---------------------------------------------------------------------- kamischi · 2014-10-26 16:16 I could not find anything with error -10810 :-(. Which file is actually mentioned? Your main binary? Does it work with earlier versions of Mac OS X? Could it be a problem of code signing? I checked the developer docs regarding number 10810. Unfortunately it only says: An unknown error has occurred. ---------------------------------------------------------------------- Daniello · 2014-10-26 16:25 Someone told me to use the Console app to check the OSX logs. There it was, the app crashed with an exception, however it did not display any line info, even though I compiled it with -gl  However it was EInOutError, acess denied, so I thought this would be called by using Writeln() for debugging (it worked fine when running from the terminal). Now I removed the log via WriteLn, and when I do "open game.app" in the terminal nothing happens...No crashes, nothing in the Console, the game does not write any log file (it should...) No clue now how to debug this... ---------------------------------------------------------------------- kamischi · 2014-10-26 16:43 compile it with -gw for debugging. you may then use the debugger in lazarus or gdb from the command line. In some cases i also used ddd, a X11 GUI for gdb. ---------------------------------------------------------------------- Daniello · 2014-10-26 16:48 Yep, I always have gl, gw and others when compiling. Anyway I found a fix, while still not understanding the problem. I'll explain in case someone else has a similar problem  Basically I looked around what is usually used in OSX to logging and found syslog, and luckily Free Pascal already has a syslog unit. So I just replaced my logging system to output to syslog instead of a normal file and recompiled. The game now starts by clicking the bundle. I guess when launching the app from Finder it starts on a folder with non-write acess and when the game tried to create a log file it crashed. But why silently without errors anywhere I have no clue! ---------------------------------------------------------------------- kamischi · 2014-10-26 17:23 On Mac OS X your user specific program logging should go to ~/Library/Logs/YourLogFileName.log. System wide logging should go to /Library/Logs/YourLogFileName.log. ---------------------------------------------------------------------- Daniello · 2014-10-26 17:37 kamischi, is that using what logging system? It seems there are lots of options, I also found out how to use NSLog in FPC an hour ago. However by using syslog I can't find my log anywhere ---------------------------------------------------------------------- kamischi · 2014-10-26 18:03 I am not sure, but i assume that NSLog is actually doing exactly that. I would use syslog only preliminarily for program specific logging. ---------------------------------------------------------------------- jwdietrich · 2014-10-26 23:27 The infamous error -10810 might have several reasons. In most cases it emanates from faulty permissions or a full process table. Therefore I recommend that you check the permissions of your program and to check if it could create sub-processes in an infinite loop. if that doesn't help, the suggestions at http://hintsforums.macworld.com/showthread.php?t=57456, http://www.thexlab.com/faqs/error-10810.html, http://osxdaily.com/2010/02/09/mac-error-10810/ and http://www.cnet.com/news/finder-error-10810-in-snow-leopard-causing- problems/ might be useful.