GLBasic forum

Main forum => Bug Reports => Topic started by: t-spy on 2011-Feb-02

Title: Problems with MacOS
Post by: t-spy on 2011-Feb-02
I've made an aplication with glbasic wich runs on windows but on a Mac computer it does nothing. Just open and closes inmediatly. I just copy the .app dir to Mac. May i did something more to run my application?.

I'm using an iMac with Snow Leopard and the latest glbasic version.

Sorry for my bad english.
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-02
Does it require any media ?
Title: Re: Problems with MacOS
Post by: Ian Price on 2011-Feb-02
Quote from: MrTAToad on 2011-Feb-02
Does it require any media ?

Indeed - that was my first guess too. Have you copied the Media from the Windows version into the Media folder for the Mac version? GLB doesn't copy across the Media contents, you have to do that manually.

However, lack of media desn't generally cause a program to close (on Windows anyway).
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-02
No, it should be - unless of course the program is designed to.

Try running the executable part from Terminal - hopefully that should show something...
Title: Re: Problems with MacOS
Post by: doimus on 2011-Feb-02
It's probably the permissions thingy. See this thread:

http://www.glbasic.com/forum/index.php?topic=5437.msg42586#msg42586 (http://www.glbasic.com/forum/index.php?topic=5437.msg42586#msg42586)

Or in short, the solution is this:
I'm assuming you've got GLB app called MyGame

- Open Terminal window
- navigate to the folder where MyGame.app is saved
- type "cd MyGame.app/Contents/MacOS"
- type "chmod +x MacOSX"
- type "./MacOSX" to run it (or click on app icon in Finder).
Title: Re: Problems with MacOS
Post by: t-spy on 2011-Feb-02
Changed the permissions and now i have this error (i'm not using any resources):

Process:         MacOSX [5341]
Path:            /Users/angel/Downloads/pru.app/Contents/MacOS/MacOSX
Identifier:      GLBasic.com
Version:         ??? (???)
Code Type:       X86 (Native)
Parent Process:  launchd [127]

Date/Time:       2011-02-02 19:23:32.919 +0100
OS Version:      Mac OS X 10.6.6 (10J567)
Report Version:  6

Interval Since Last Report:          267364 sec
Crashes Since Last Report:           11
Per-App Crashes Since Last Report:   1
Anonymous UUID:                      91582920-4E6D-4D6E-A62F-1E580CA21653

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000002, 0x0000000000000000
Crashed Thread:  0

Dyld Error Message:
Library not loaded:
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL
Referenced from: /Users/angel/Downloads/pru.app/Contents/MacOS/MacOSX
Reason: image not found

Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-02
Can you check to make sure that the SDL library is in one of the Framework directories ?
Title: Re: Problems with MacOS
Post by: t-spy on 2011-Feb-02
Yes. It's on the Contents\Frameworks\SDL.framework\Versions\A directory of my app.

Here is all the contents of my app.

Contents
   1.066 Info.plist
<DIR>          Resources
<DIR>          Frameworks

Contents\MacOS

   3.679.008 MacOSX

Contents\Resources

   103.013 Icon.icns

Contents\Frameworks

<DIR>          SDL_mixer.framework
<DIR>          SDL.framework

Contents\Frameworks\SDL_mixer.framework

   24 Headers
   26 Resources
   26 SDL_mixer
<DIR>          Versions

Contents\Frameworks\SDL_mixer.framework\Versions

   1 Current

Contents\Frameworks\SDL_mixer.framework\Versions\A

   3.674.436 SDL_mixer
<DIR>          Resources
<DIR>          Headers

Contents\Frameworks\SDL_mixer.framework\Versions\A\Resources

   814 Info.plist

Contents\Frameworks\SDL_mixer.framework\Versions\A\Headers

   25.516 SDL_mixer.h

Contents\Frameworks\SDL.framework

   24 Headers
   26 Resources
   20 SDL
<DIR>          Versions

Contents\Frameworks\SDL.framework\Versions

   1 Current

Contents\Frameworks\SDL.framework\Versions\A

   4.530.452 SDL
<DIR>          Resources
<DIR>          Headers

Contents\Frameworks\SDL.framework\Versions\A\Resources

   797 Info.plist
<DIR>          SDLMain.nib

Contents\Frameworks\SDL.framework\Versions\A\Resources\SDLMain.nib

   302 classes.nib
   352 info.nib
   1.701 objects.nib

Contents\Frameworks\SDL.framework\Versions\A\Headers

   4.327 begin_code.h
   1.423 close_code.h
   3.133 SDL.h
   1.875 SDL_active.h
   10.879 SDL_audio.h
   910 SDL_byteorder.h
   5.657 SDL_cdrom.h
   1.474 SDL_config.h
   2.803 SDL_config_dreamcast.h
   2.801 SDL_config_macos.h
   3.537 SDL_config_macosx.h
   3.635 SDL_config_os2.h
   4.507 SDL_config_win32.h
   869 SDL_copying.h
   2.303 SDL_cpuinfo.h
   5.653 SDL_endian.h
   1.762 SDL_error.h
   12.564 SDL_events.h
   910 SDL_getenv.h
   5.203 SDL_joystick.h
   3.885 SDL_keyboard.h
   7.160 SDL_keysym.h
   2.769 SDL_loadso.h
   2.732 SDL_main.h
   4.535 SDL_mouse.h
   5.707 SDL_mutex.h
   183 SDL_name.h
   336.232 SDL_opengl.h
   2.516 SDL_platform.h
   1.919 SDL_quit.h
   4.783 SDL_rwops.h
   15.611 SDL_stdinc.h
   5.991 SDL_syswm.h
   4.436 SDL_thread.h
   4.424 SDL_timer.h
   910 SDL_types.h
   2.557 SDL_version.h
   37.051 SDL_video.h

Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-02
Is the directory structure 9/pru.app/Contents/MacOS/MacOSX) correct ?
Title: Re: Problems with MacOS
Post by: t-spy on 2011-Feb-02
Is the directory pru.app/Contents.
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-03
I'm just wondering why its MacOS/MacOSX
Title: Re: Problems with MacOS
Post by: t-spy on 2011-Feb-04
MacOSX is te executable file. It's located on the MacOS dir and is how glbasic generate the package.
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-04
Ah yes :)
Title: Re: Problems with MacOS
Post by: Kitty Hello on 2011-Feb-04
I should have named it glb-macos-exe  =D :D
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-04
It comes of not having a Mac to check :)
Title: Re: Problems with MacOS
Post by: t-spy on 2011-Feb-11
Can anyone upload one working app for Mac (just a MOUSEWAIT) to compare with mine?. Just for testing.
Title: Re: Problems with MacOS
Post by: doimus on 2011-Feb-11
Here it is. Works on my Mac.

(Sorry for the 4MB attach.)

[attachment deleted by admin]
Title: Re: Problems with MacOS
Post by: ampos on 2011-Feb-12
That's driving me crazy too...

I have /mygame in GLBasic. Inside there is Contents, that is the mac dir.

I copied the /content dir to the Mac. Now I have in the mac desktop a dir called /content, with the following files:

/contents
.../framework
...info.plist
.../Macos
......MacOSX
.../resources

I place my media.sbx file inside /MacOS

I double click in the MacOSX file and it returns the error "media.sbx" file not found.

SO I open terminal and type chmod +x macosx

Now I type "./macosx" and my game runs.

But I double click in the MacOSX icon, the game fails again with the "no media.sbx file found" error.

What should I do to make the game mouse-clickable?
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-12
Have you tried using something like "./MacOS/media.sbx" ?
Title: Re: Problems with MacOS
Post by: ampos on 2011-Feb-12
Quote from: MrTAToad on 2011-Feb-12
Have you tried using something like "./MacOS/media.sbx" ?

I have tried all the directories inside /content folder and no luck.

If the media.sbx file is in the same directory as macosx exe file, running it from terminal works, but not double clicking in the macosx icon.
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-12
Write a small program that outputs the current directory to the screen when double-clicking on the icon.  It will be interesting to see what it thinks the directory is...

The other thing to try would be SETCURRENTDIR
Title: Re: Problems with MacOS
Post by: ampos on 2011-Feb-12
Nobody has ever created a game for MacOS?
Title: Re: Problems with MacOS
Post by: MrTAToad on 2011-Feb-12
Oh yes : http://www.un-map.com/finishedprograms.html

Unfortunately I can no longer do anything Mac wise...  Moru or Hiru would be the ones to help - but I dont think they are around at the moment.

However, I put all my media in Media directory in the base of the .app directory, and access files using Media/xxxx
Title: Re: Problems with MacOS
Post by: ampos on 2011-Feb-14
At last!!!!!

PART 1
- Open Terminal window
- navigate to the folder where Game is saved ("ls" to get a dir of files/folders, and "cd" to change directory/folder)
- type "cd /Contents/MacOS"
- type "chmod +x MacOSX"
- close terminal
PART 2
- In Finder, create a folder called "GAME"
- Place the file "media.sbx" or /media folder inside this folder
- Place the folder "content" inside this folder
- Rename "GAME" folder to "GAME.app"
- Click in the "GAME.app" folder to run the game

PART 1 is not always necesary.
Title: Re: Problems with MacOS
Post by: Kitty Hello on 2011-Feb-14
Usually, you have an .app directory in GLBasic, and that's what you need for the Mac. There might be problems with having to chmod +x the file.
If anyone can see what file attributes are changed after the chmod+x on an ntfs drive, I might change that internally.
Title: Re: Problems with MacOS
Post by: ampos on 2011-Feb-14
Yeah, but this folder.app is so full of things :D

I will check about the file attributes later.
Title: Re: Problems with MacOS
Post by: erico on 2011-Mar-29
Gernot also said in another post that ziping the file before transferring to MAC keep the flags intact.
It works great for me.