Author Topic: mac osx build failure  (Read 7071 times)

Offline wmaxfield

  • Multiple posting newcomer
  • *
  • Posts: 10
mac osx build failure
« on: June 09, 2008, 11:25:32 pm »

  I built the mac osx and when I run it, I get a "You can't open the application "codeblocks" because the classic environment is no longer supported."

  This happens with 8.02 or the svn.

   The binary has numerous bugs, and the executable it produces does not accept focus to the frame window.  I'm willing to work on it, but I need some guidance.


Offline eranif

  • Regular
  • ***
  • Posts: 254
Re: mac osx build failure
« Reply #1 on: June 09, 2008, 11:46:26 pm »
The focus thing, is a FAQ for wxMac (wxWidgets port for MacOS). Have a look here:

http://wiki.wxwidgets.org/WxMac_Issues#Building_a_MacOSX_application_bundle

In general, you must package your application in the structure described at the above URL.

Eran

Offline wmaxfield

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: mac osx build failure
« Reply #2 on: June 09, 2008, 11:59:55 pm »

  Thanks!  I'll check into it for the output of the compiler. 

  Still wondering about the build for now, complaining about Classic environment.

Offline wmaxfield

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: mac osx build failure
« Reply #3 on: June 10, 2008, 12:05:25 am »

  OK.  copying the codeblocks into the binary version directory of codeblocks caused a launch, which crashed a little later.

  If I put all of the libraries in the same directory, will the svn version of codeblocks find those libraries and launch, or do I need to do a ./configure parameter that will cause that to happen?
   

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: mac osx build failure
« Reply #4 on: June 10, 2008, 09:40:31 am »
  I built the mac osx and when I run it, I get a "You can't open the application "codeblocks" because the classic environment is no longer supported."

You need to start it from the terminal (like `/usr/local/bin/codeblocks` or so), to be able to launch it from the Finder (by double-clicking) you need to build an application bundle.

The resource fork hack is required for wxWidgets, to be able to run the Aqua interface from a regular (non-bundle) installation - but it isn't needed for the GTK interface.

Offline wmaxfield

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: mac osx build failure
« Reply #5 on: June 10, 2008, 09:59:34 pm »

  If I run it from the command line, I get an error and then it quits.

  If someone can point me to a "debugging codeblocks on mac" site, I'll gladly read up and start looking at it.

  Who builds the mac version?  I'd like to find out what the final incantation is to get the executable.  mine doesn't run right.

Offline wmaxfield

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: mac osx build failure
« Reply #6 on: June 11, 2008, 12:36:19 am »

  Sorry to answer my own question, but I did a google search.  some of the google searches are dead links.  I found this one that may be close to correct:
http://wiki.codeblocks.org/index.php?title=Compiling_Code::Blocks_in_Mac_OS_X

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: mac osx build failure
« Reply #7 on: June 11, 2008, 08:10:47 pm »
The wiki is the latest information, it's correct but outdated (mentions 10.4 but not 10.5, and uses wxWidgets 2.6 instead of 2.8 ). The final step before assembling the bundle is install_name_tool. But that's only needed when running everything from inside the app bundle, if you do a regular install to a prefix then it only needs the directory structure of the bundle wrapper and the library/data can stay... This is how it is setup in the MacPorts port, the CodeBlocks.app there is just a symlink to the ${prefix}

Offline Lis

  • Single posting newcomer
  • *
  • Posts: 3
Re: mac osx build failure
« Reply #8 on: August 31, 2008, 03:53:44 pm »
I use OSX 10.5
configured wxWidgets with:
./configure --prefix=/tmp/wxmac --enable-monolithic --enable-shared --enable-optimize --disable-universal_binary --enable-dynlib --enable-dynamicloader --enable-unicode --enable-threads --enable-gif --enable-pcx --enable-tga --enable-iff --enable-pnm --enable-xpm --with-mac --with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin --with-libxpm=builtin --with-opengl --with-regex=builtin --with-zlib=builtin --with-expat=builtin --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk --with-macosx-version-min=10.5

configured codeblocks with:
./configure --prefix=/tmp/codeblocks --with-platform=macosx --with-contrib-plugins=all --with-wx-prefix=/tmp/wxmac

I modified the 2 script who can be found here:
http://wiki.codeblocks.org/index.php?title=Compiling_Code::Blocks_in_Mac_OS_X#Way_Two:_NeXT_.28bundle.29

They are used to create the real app bundle without the startscript.
First you execute codeBlocks_createAppDir.sh
Code
# Create the CodeBlocks.app bunde dir
mkdir ./CodeBlocks.app
mkdir ./CodeBlocks.app/Contents
cp CodeBlocks.Info.plist ./CodeBlocks.app/Contents/Info.plist
mkdir ./CodeBlocks.app/Contents/MacOS
cp CodeBlocks.sh ./CodeBlocks.app/Contents/MacOS/CodeBlocks
mkdir ./CodeBlocks.app/Contents/Resources
cp ./CodeBlocks.icns ./CodeBlocks.app/Contents/Resources/app.icns
#mkdir ./CodeBlocks.app/Contents/bin
#mkdir ./CodeBlocks.app/Contents/lib
#mkdir ./CodeBlocks.app/Contents/share/codeblocks/
cp -r /opt/codeblocks/share ./CodeBlocks.app/Contents/Resources

Then you modify codeBlocks_createTrueApp.sh at the first 3 lines.
After you set your wxMac and CodeBlocks installation Prefix you
execute the script.
Code
#!/bin/sh
cbInstallPrefix="/tmp/codeblocks"
wxInstallPrefix="/tmp/wxmac"

# CodeBlocks copy
cp $cbInstallPrefix/bin/codeblocks ./CodeBlocks.app/Contents/MacOS/CodeBlocks
cp $cbInstallPrefix/bin/cb_share_config ./CodeBlocks.app/Contents/MacOS
cp $cbInstallPrefix/bin/cb_console_runner ./CodeBlocks.app/Contents/MacOS
cp $cbInstallPrefix/bin/codesnippets ./CodeBlocks.app/Contents/MacOS
cp $cbInstallPrefix/lib/* ./CodeBlocks.app/Contents/MacOS

# Wx copy
cp $wxInstallPrefix/lib/libwx* ./CodeBlocks.app/Contents/MacOS

install_name_tool -id @executable_path/libcodeblocks.0.dylib ./CodeBlocks.app/Contents/MacOS/libcodeblocks.0.dylib
install_name_tool -id @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocks.app/Contents/MacOS/libwx_macu-2.8.0.dylib
install_name_tool -id @executable_path/libwxsmithlib.0.dylib ./CodeBlocks.app/Contents/MacOS/libwxsmithlib.0.dylib

install_name_tool -change $cbInstallPrefix/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocks.app/Contents/MacOS/CodeBlocks
install_name_tool -change $cbInstallPrefix/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocks.app/Contents/MacOS/CodeBlocks
install_name_tool -change $cbInstallPrefix/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocks.app/Contents/MacOS/CodeBlocks

install_name_tool -change $cbInstallPrefix/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocks.app/Contents/MacOS/codesnippets
install_name_tool -change $cbInstallPrefix/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocks.app/Contents/MacOS/codesnippets
install_name_tool -change $cbInstallPrefix/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocks.app/Contents/MacOS/codesnippets

install_name_tool -change $cbInstallPrefix/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocks.app/Contents/MacOS/cb_share_config
install_name_tool -change $cbInstallPrefix/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocks.app/Contents/MacOS/cb_share_config
install_name_tool -change $cbInstallPrefix/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocks.app/Contents/MacOS/cb_share_config

install_name_tool -change $cbInstallPrefix/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocks.app/Contents/MacOS/cb_console_runner
install_name_tool -change $cbInstallPrefix/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocks.app/Contents/MacOS/cb_console_runner
install_name_tool -change $cbInstallPrefix/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocks.app/Contents/MacOS/cb_console_runner

install_name_tool -change $cbInstallPrefix/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocks.app/Contents/MacOS/libcodeblocks.0.dylib
install_name_tool -change $cbInstallPrefix/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocks.app/Contents/MacOS/libcodeblocks.0.dylib

install_name_tool -change $cbInstallPrefix/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocks.app/Contents/MacOS/libwxsmithlib.0.dylib
install_name_tool -change $cbInstallPrefix/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocks.app/Contents/MacOS/libwxsmithlib.0.dylib

cp -R $cbInstallPrefix/share/codeblocks/ ./CodeBlocks.app/Contents/Resources/share/codeblocks

for dotso in ./CodeBlocks.app/Contents/Resources/share/codeblocks/plugins/*.so
do
#echo $dotso
# install_name_tool -id $dotso ./libcodeblocks.0.dylib CodeBlocks
install_name_tool -change $wxInstallPrefix/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib $dotso
install_name_tool -change $wxInstallPrefix/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib $dotso
install_name_tool -change $wxInstallPrefix/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib $dotso
done

However if i start the app bundle the application crashes.
The faszinating part is:
1. if I compile wxMac and replace the Apple delivered wxMac with my own compiled librarys the application does not crash but runs very slow.
2. If I use the Apple delivered wxMac for CodeBlocks the application also runs very slow.
3. The splashscreen does not change for about 30 seconds in booth cases.
4. If I switch to another application while CodeBlocks shows the spashscreen Codeblocks hangs completely.
5. I have the same problem with the released 8.02 CodeBlocks.

You can restore the original apple wxMac libs with pacifist. The libs are stored in the coreBSD.pkg Package on the OSX DVD.

Can someone help here? Beeing able to use CodeBlocks on OSX would be great.

Greets Louis.

[attachment deleted by admin]
« Last Edit: August 31, 2008, 04:22:52 pm by Lis »

Offline Auria

  • Almost regular
  • **
  • Posts: 152
Re: mac osx build failure
« Reply #9 on: August 31, 2008, 05:48:25 pm »
If all you want is to use it, can't you just use the pre-built binaries??

Anyway, the splash screen that hangs for an incredibly long time is a known issue, i don't know what can cause it. Once the splash screen is gone, it should run at approximately okay speed. (scintilla is still a little low on mac. I know the CodeLite author optimized wxScintilla for mac in his mac version of CodeLite - but some changes also spped it up on linux. it would help to import these changes, it's just a core decision i can't take)

I would suggest not to overwrite the Apple libs, nor play with /usr/lib in any way. Install your own wx to /usr/local, or, even better, don't install it and leave it in-place. Then adjust your PATH so that the correct wx-config is used.

Offline Lis

  • Single posting newcomer
  • *
  • Posts: 3
Re: mac osx build failure
« Reply #10 on: August 31, 2008, 06:12:12 pm »
If all you want is to use it, can't you just use the pre-built binaries??

No, im sorry but the precompiled version of CodeBlocks has the same splash problem. It also does not create any template source files and the project file browser crashes CodeBlocks itselve. If the Precompiled version would at least be usable I would not have started to compile it on my own.

Anyway, the splash screen that hangs for an incredibly long time is a known issue, i don't know what can cause it. Once the splash screen is gone, it should run at approximately okay speed. (scintilla is still a little low on mac. I know the CodeLite author optimized wxScintilla for mac in his mac version of CodeLite - but some changes also spped it up on linux. it would help to import these changes, it's just a core decision i can't take)
If this would be the only problem...

Greets Louis.

Offline Auria

  • Almost regular
  • **
  • Posts: 152
Re: mac osx build failure
« Reply #11 on: August 31, 2008, 08:15:03 pm »
What are the other issues? If you get a crash, getting a backtrace would be intersting

Offline Lis

  • Single posting newcomer
  • *
  • Posts: 3
Re: mac osx build failure
« Reply #12 on: September 02, 2008, 04:08:53 am »
Ok, right now i get this:
. done
wxSmith: loaded
wxSmithMime: loaded
Reading symbols for shared libraries . done
wxSmithContribItems: loaded
AutoVersioning plugin activated

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x07108cb0 in BrowseTracker::OnAttach (this=0x702f0d0) at BrowseTracker.cpp:218
218       m_pMenuBar = Manager::Get()->GetAppFrame()->GetMenuBar();

CodeBlocks crashed right at the start. Right now i do not know why this happens. Maybe CB never worked with the Apple wxWidgets. I compile the wxMac libs again and hopefully i am able to reproduce the object file browser crash.

[EDIT]
Same problem for the 2.8.8 wxMac libraries

Reading symbols for shared libraries . done
wxSmithContribItems: loaded
AutoVersioning plugin activated

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000000
0x055ca32c in BrowseTracker::OnAttach (this=0x68e8cd0) at BrowseTracker.cpp:218
218       m_pMenuBar = Manager::Get()->GetAppFrame()->GetMenuBar();

I will continue debuggin.

Greets Lis.
« Last Edit: September 02, 2008, 04:29:54 pm by Lis »