Author Topic: Mac os X bundle  (Read 9457 times)

Offline Trikko

  • Multiple posting newcomer
  • *
  • Posts: 82
    • e-nuts.net
Mac os X bundle
« on: September 04, 2006, 02:00:28 pm »
Hello! I've installed c::b for mac os x and i've compiled wxWidgets. It compiles the template app but i can't run it probably becouse we need to make a bundle app. Did anyone write a post-building script to do this (or something similar) ?

Thanks in advance!
A. Fontana
My homepage
Do you need custom software? Do you want to work as freelancer?

Offline Trikko

  • Multiple posting newcomer
  • *
  • Posts: 82
    • e-nuts.net
Re: Mac os X bundle
« Reply #1 on: September 04, 2006, 07:24:52 pm »
When i run an application built with C::B for mac it starts and quit immediatly. On console it writes:


dyld: lazy symbol binding failed: lazy pointer not found
dyld: lazy pointer not found
Trace/BPT trap

I can't understand why using the makefile given with samples they compiles without problems...

Could anyone help me?

I have just one compiler: gcc 4 for mac os x....
A. Fontana
My homepage
Do you need custom software? Do you want to work as freelancer?

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2288
Re: Mac os X bundle
« Reply #2 on: September 04, 2006, 08:14:31 pm »
When i run an application built with C::B for mac it starts and quit immediatly. On console it writes:
dyld: lazy symbol binding failed: lazy pointer not found
dyld: lazy pointer not found
Trace/BPT trap

If you would google "dyld: lazy symbol binding failed: lazy pointer not found"
you will find all sorts of solutions to this problem.

Primary reason:
gcc packaged with 10.4 should not be used with the -s option. It over strips your programs and libraries. Do a separate strip (standalone) after you've tested your program.

Other mentioned solutions:

It's possible Mac cannot find your dylib. Use something like the following to set the library pointer

Code
LIB=`pwd`
# or LIB=<path to my just compiled programs dylib>
DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LIB
export DYLD_LIBRARY_PATH
 

You might also have to give your program the great Mac blessing:

Code
sudo /developer/tools/Rez -d __DARWIN__ -t APPL Carbon.r -o <my just compiled program>

Otherwise you can make it into a bundle like:
http://wxforum.shadonet.com/viewtopic.php?t=6045&highlight=


See at bottom of this link the section on Bundles
http://wiki.codeblocks.org/index.php?title=Compiling_Code::Blocks_in_Mac_OS_X

Code
/Developer/Tools/SetFile -t APPL `pwd`/${1}
/developer/tools/Rez -d __DARWIN__ -t APPL Carbon.r -o `pwd`/${1}

Here's an example shell command that can be modified to run your program without bundling.
Code
#!/ bin/sh
##^remove the blank before bin. It's here only to appease forum software

APP_DIR=/Users/pecan/devel/mac/trunk/src/devel/
export LD_LIBRARY_PATH=$APP_DIR:$LD_LIBRARY_PATH

LIB=$APP_DIR

DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$LIB
export DYLD_LIBRARY_PATH

#--exec $APP_DIR/codeblocks --prefix=$DIR
echo DIR=$APP_DIR
echo LIB=$LIB
echo DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH
echo command line =exec $APP_DIR/codeblocks --prefix="$APP_DIR"

exec $APP_DIR/codeblocks --prefix="$APP_DIR"
 
« Last Edit: September 05, 2006, 12:36:06 am by Pecan »

Offline Trikko

  • Multiple posting newcomer
  • *
  • Posts: 82
    • e-nuts.net
Re: Mac os X bundle
« Reply #3 on: September 04, 2006, 11:50:21 pm »
Now it seems to work. I've just seen solutions on google but i didn't find the SetFile / Rez one.

Code
/Developer/Tools/SetFile -t APPL `pwd`/${1}
/developer/tools/Rez -d __DARWIN__ -t APPL Carbon.r -o `pwd`/${1}

By the way it's strange. Using that instructions it creates a mac os classic application. If i run from system it calls classic subsystem, if i call it from console it works as mac os x app. If i create a bundle it works as mac os x app too. But usually inside bundle the apps are not classic apps, are they?

Now i'm writing my own wizard to set post-build options too.

Thanks Pecan!
A. Fontana
My homepage
Do you need custom software? Do you want to work as freelancer?

Offline _Andrey_

  • Single posting newcomer
  • *
  • Posts: 4
    • Games for all ages
Re: Mac os X bundle
« Reply #4 on: February 24, 2008, 11:06:34 pm »
Now i'm writing my own wizard to set post-build options too.

Good idea, but is wizard ready to download? Or you do not plan to share it?

Offline Auria

  • Almost regular
  • **
  • Posts: 152
Re: Mac os X bundle
« Reply #5 on: February 25, 2008, 03:43:50 am »
The rez thing should NOT be used. it is for legacy stuff (classic apps)

It's much better to build an app bundle. Quick example of how to do it:

Target > Build Options > Pre/post build steps

Pre-build steps:
Code
mkdir -p $(TARGET_OUTPUT_DIR)/MyApp.app/Contents/MacOS
mkdir -p $(TARGET_OUTPUT_DIR)/MyApp.app/Contents/Resources

post-build step:
Code
cp $(TARGET_OUTPUT_FILE) $(TARGET_OUTPUT_DIR)/MyApp.app/Contents/MacOS

This is dirty and incomplete, but if you continue in that direction, add an info.plist file, fix executable location instead of copying it, etc. you can probably get it working quite well enough

If you can make a wizard out of that, please share it, it would be awesome  :D

Fenk

  • Guest
Re: Mac os X bundle
« Reply #6 on: December 09, 2009, 11:52:12 am »
I'm sorry for reviving such an old thread, but I'd really like to know if that wizard finally got made. XCode works too well to be struggling with C::B on Mac OS X  :D (although it is a wonderful alternative for most Windows IDEs). Did you guys get an automated solution to this?

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Mac os X bundle
« Reply #7 on: December 09, 2009, 09:01:43 pm »
I'm sorry for reviving such an old thread, but I'd really like to know if that wizard finally got made.

That would be a: "no" (but patches welcome)

http://svn.berlios.de/svnroot/repos/codeblocks/trunk/src/plugins/scriptedwizard/resources/wxwidgets/wizard.script