Recent

Author Topic: [Solved] El Capitan - Compiled program runs from terminal but not when clicked  (Read 6349 times)

Trenatos

  • Hero Member
  • *****
  • Posts: 540
    • MarcusFernstrom.com
I have a program that compiles and runs on Windows and an old Mac, but on El Capitan after I compile, if I try to double click the binary or the .app, I get a file not found error.

BUT, if I run it from terminal from where the .app is, it runs just fine.
« Last Edit: March 18, 2016, 04:39:44 pm by Trenatos »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: El Capitan - Compiled program runs from terminal but not when clicked
« Reply #1 on: March 18, 2016, 05:25:31 am »
sounds like your bundle (.app) is not-configured.
What do you have in yourprogram.app/Contents/MacOS directory?

You can try to remove the .app and let Lazarus to rebuild it for you and see if it helps.

Sandbox-ed applications are not required in El Capitan, by default.
« Last Edit: March 18, 2016, 05:27:16 am by skalogryz »

Trenatos

  • Hero Member
  • *****
  • Posts: 540
    • MarcusFernstrom.com
Re: El Capitan - Compiled program runs from terminal but not when clicked
« Reply #2 on: March 18, 2016, 01:55:07 pm »
Just one file, looks like an Alias to the executable, which is in the same directory as the .app bundle

Trenatos

  • Hero Member
  • *****
  • Posts: 540
    • MarcusFernstrom.com
Re: El Capitan - Compiled program runs from terminal but not when clicked
« Reply #3 on: March 18, 2016, 01:58:58 pm »
I've rebuilt, and get the same .app and executable in the same directory as the .app

Trenatos

  • Hero Member
  • *****
  • Posts: 540
    • MarcusFernstrom.com
Re: El Capitan - Compiled program runs from terminal but not when clicked
« Reply #4 on: March 18, 2016, 02:10:09 pm »
I just found another oddness..

I set the compiler to create new directories per target os, so I have a darwin directory under the project directory.

I can run the program from terminal but ONLY if I do so from the project folder, NOT from within the darwin folder.

So this works:
user$ ./darwin/program
Or user$ ./darwin/program.app/Contents/MacOS/program

But if I cd into the darwin folder, I get the file not found error.

This is, to me, bizarre...

--edit
I use Lazarus 1.6, FPC 3.0.0
« Last Edit: March 18, 2016, 02:13:25 pm by Trenatos »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
Re: El Capitan - Compiled program runs from terminal but not when clicked
« Reply #5 on: March 18, 2016, 02:26:35 pm »
do you run it as
"program"
or
"./program"
?

How does "file not found" error look like? Is it OS generated or is it something that the program generates on start?

Trenatos

  • Hero Member
  • *****
  • Posts: 540
    • MarcusFernstrom.com
Re: El Capitan - Compiled program runs from terminal but not when clicked
« Reply #6 on: March 18, 2016, 02:57:36 pm »
After some more digging, it looks like it might be a pathing issue in my program.

I'll dig at it more and come back with info.

Trenatos

  • Hero Member
  • *****
  • Posts: 540
    • MarcusFernstrom.com
Re: El Capitan - Compiled program runs from terminal but not when clicked
« Reply #7 on: March 18, 2016, 03:15:09 pm »
Definitely my own stupidity and inexperience with developing on a Mac.

It was a simple pathing issue to some supporting files, all's well.

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2770
    • havefunsoft.com
let me ask you this, how did it work on "old Mac"?

Trenatos

  • Hero Member
  • *****
  • Posts: 540
    • MarcusFernstrom.com
I compiled, it ran.

The difference was that this time around I switched folders around, created the .app bundle and whatnot, and then had issues.

The problem was entirely behind the keyboard, I eventually figured it out, lol

 

TinyPortal © 2005-2018