Recent

Author Topic: Example application always opens using Terminal and X11?  (Read 7585 times)

AndrewShanklin

  • Newbie
  • Posts: 6
Example application always opens using Terminal and X11?
« on: July 07, 2008, 05:36:54 pm »
Hey all,

I am a newbie so please bare with me...

I mainly have experience using Windows and Delphi, but thought I would give Lazarus ago on my new iMac ( Mac OS X 10.5.4).

In the end i managed to get Lazarus installed (wow, that was complicated) and I can can now access Lazarus and can compile a basic app.

When I create a basic app it produces project1.app and when i then execute this application from the desktop It opens X11 and Terminal and runs in Terminal or using x11 I am not sure which.

How do I configure Lazarus so that when I compile an application (using run or build) it produces a .app file which will just run on its own and not using any other program - like i do in Lazarus on Windows where it creates a .exe file?

I have tried to figure this out myself by using Tools -> "Configure Build Lazarus" and playing with the various options like compile with all packages but If i do this i always get:

/usr/local/share/lazarus/tools/svn2revisioninc.pas(373) Error: Can't create assembler file: ./svn2revisioninc.s

Like I say I am not sure what I am doing or if this is even relavent but I could do with some advice please...

I am using the Lazarus Mac OS X i386 packages.

Thanks in advance.

Andy.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Example application always opens using Terminal and X11?
« Reply #1 on: July 07, 2008, 07:39:56 pm »
Quote from: "AndrewShanklin"
Like I say I am not sure what I am doing or if this is even relavent but I could do with some advice please...


Out of the box, the snapshots should not require any additional installation except for a one-time installation of the Apple programming tools (includes assembler, linker, etc.). The FPC installer checks for this, so if it didn't complain you should be okay.

To create a native Carbon-based GUI app:

- File | New | Application
- Design your form.
- Compile. Make sure Carbon is selected as the widget type.
- In Project Options dialog, click Create Application Bundle to create the .app folder for your app. You can also create this manually as described elsewhere if you want a more sophisticed info.plist file in your bundle.
- Double-click your app's bundle (not the executable file) in Finder to start the app.

You shouldn't see any terminal or X11 stuff. If you do, then something is seriously wrong.

To check to see which widgetset an executable is compiled against, do this from a terminal:

otool -L project1

If it shows gtk/X11 libraries, then you compiled it for GTK. If it shows only opengl/carbon, then you compiled it for Carbon widgetset.

Let me know if this isn't clear. I see that the original programming notes I wrote on the wiki for OS X are now out of date since X11 and GTK are no longer needed with OS X.

Thanks.

-Phil

AndrewShanklin

  • Newbie
  • Posts: 6
RE: Re: Example application always opens using Terminal and
« Reply #2 on: July 09, 2008, 04:38:10 pm »
Hi Phil,

Thanks to your help I was able to locate the Lazarus.app file and load up lazarus correctly.

I have one further question...

Prior to compiling I go Save All and save all the source code files into a folder called "Test App"

I then go Project -> Build and it creates a file called Project1.app in the "Test App" folder.

I then go In Project Options dialog, click Create Application Bundle to create the .app folder.

When I go into the Test App Folder, if i double click on Project1.app it opens correctly and does not open X11 or terminal (the issue I had before), which is correct.

If I drag the Project1.app file out of this folder and onto the desktop (i.e. away from all of the source files), to have a stand alone application and again try and open it, I get a warning:
"You can't open the application "Project1.app" because it is not supported on this architecture.

The only way I can get around this is to right click on the "Project1.app" file and click "Show Package Contents" and drag the project1 unix executable file from the "Test App" folder into the project1.app contents folder. This way the application will then run on its own.

I am sure this is not the correct way to get an app to run on its own but when I try the various Tools -> "Configure Build Lazarus" and playing with the various options like compile with all packages but If i do this i always get:

/usr/local/share/lazarus/tools/svn2revisioninc.pas(373) Error: Can't create assembler file: ./svn2revisioninc.s

Any ideas?

Thanks again for all your help.

Andy.

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: RE: Re: Example application always opens using Terminal
« Reply #3 on: July 12, 2008, 06:33:14 pm »
Quote from: "AndrewShanklin"
Hi Phil,I then go Project -> Build and it creates a file called Project1.app in the "Test App" folder.


No, building creates the project1 file, not the Project1.app bundle.

The bundle is created with a symbolic link in its contents/macos folder that points to the actual executable. This is fine for development and testing, but to create a true standalone bundle, you need to put the executable file in the contents/macos folder. Then it has no dependencies on anything outside the bundle structure.

I thought this was documented in the wiki. If not, you can add it.

Thanks.

-Phil

AndrewShanklin

  • Newbie
  • Posts: 6
RE: Re: RE: Re: Example application always opens using Termi
« Reply #4 on: July 14, 2008, 05:34:46 pm »
Hi Phil,

Thanks again for the info.

That all makes sense, I just wanted to check that was the case and that I wasn't missing something.

Thanks again

Andy.

 

TinyPortal © 2005-2018