Author Topic: Big trouble running Codeblocks in MacOS X Leopard  (Read 10803 times)

Offline Baluarte

  • Multiple posting newcomer
  • *
  • Posts: 16
Big trouble running Codeblocks in MacOS X Leopard
« on: December 14, 2008, 03:06:30 pm »
Greetings!

First:

Here a very very very happy Codeblocks 'old' user.  Keep the good work! It is amazing!!

Second:

For first time, I try to build/run Codeblocks (from SVN repository) in Mac OS X Leopard (MacBoock Pro/Intel CPU)

I use the Leopard default GCC (i686-apple-darwin9-gcc-401)

I have previously built/installed under "/usr/local" directory the wxWidgets 2,8,9.

I follow the same Linux/Unix system steps. Perhaps do not be the right approach ( ?)

The main steps:

1.  svn checkout svn://svn.berlios.de/codeblocks/trunk
2. ./bootstrap
3. mkdir builds; cd builds
4. ../configure --with-wxdir=/usr/local/
5. make
6. sudo make install

SUCCESS!!

However:

When I launch the Codeblocks from terminal. It seems work normally. The classical main Codeblocks window is showed without problems. But, Is it unable to respond any event! Click a button. Open menu. Nothing. The MAC OS X interface window title ( Maximize Window, Minimize Window, Close Window) works.

When I attempt to launch from the Finder, It denies me. It determine that 'Codeblocks'  is a Classical Application (and so NO compatible with the new MAC OSX Leopard )

Any Idea? Any flag? Any updated guide? Thanks in advance!

P.S: Sorry for my terrible English!

Baluarte

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Big trouble running Codeblocks in MacOS X Leopard
« Reply #1 on: December 14, 2008, 08:26:46 pm »
Not responding to events is "normal" for wxWidgets on Mac.

Adding the resfork is enough to make it work in earlier versions of Mac OS X, however it is not a Classic application as Finder mistakenly deduces (it uses Carbon). For newer versions it seems you must make an application bundle, so running from the regular /usr/local doesn't work anymore.

See wiki:Installing_Code::Blocks_from_source_on_Mac_OS_X#Way_Two:_NeXT_.28bundle.29  and http://wiki.wxwidgets.org/WxMac_Issues#Building_a_MacOSX_application_bundle. The included wxWidgets template has the same issue, so all of it needs updating for Leopard.

You're 90% there though, just need the directory structure...

Offline Baluarte

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Big trouble running Codeblocks in MacOS X Leopard
« Reply #2 on: December 14, 2008, 09:13:31 pm »
Thank you for your very fast answer!

In a few days, I will try the suggested approach.
I must admit I am a newbie in MacOS X environment.

Baluarte

Offline Baluarte

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Big trouble running Codeblocks in MacOS X Leopard
« Reply #3 on: December 21, 2008, 02:36:19 pm »
Ok! Unsuccessful Greetings!

Reminder:

I attempt running Codeblocks (from SVN) in a Macbook Pro with Leopard 1,5,6 installed.

Until now, I have managed to compile/building/installing under usr/local/ the CodeblocksSVN (see previous posts in this forum thread)

Codeblocks works but he is unable to respond to any event.

Today:

Now I try to create a MACOSX application bundle.

Obeying indications from:

http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X#Way_Two:_NeXT_.28bundle.29

I built the tree folder:

CodeBlocksSVN.app
CodeBlocksSVN.app/Contents
CodeBlocksSVN.app/Contents/MacOS
CodeBlocksSVN.app/Contents/Resources
CodeBlocksSVN.app/Contents/MacOS/CodeBlocks
CodeBlocksSVN.app/Contents/Resources/share
CodeBlocksSVN.app/Contents/Resources/share/codeblocks

After that:

 I copy the file Info.plist from SVN trunk to CodeBlocksSVN.app/Contents
 I copy the file app.icns from SVN trunk to CodeBlocksSVN.app/Contents/Resources

In the next step I use the script suggested in

 http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X#Way_Two:_NeXT_.28bundle.29

Code
cp /usr/local/bin/codeblocks ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks
cp /usr/local/bin/cb_share_config ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/bin/cb_console_runner ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/bin/codesnippets ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/lib/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/lib/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS
cp /usr/local/lib/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS

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

install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks

install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/codesnippets

install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_share_config

install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/cb_console_runner

install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libcodeblocks.0.dylib
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libcodeblocks.0.dylib

install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib

cp -R /usr/local/share/codeblocks/ ./CodeBlocksSVN.app/Contents/Resources/share/codeblocks

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

I suspect that the script is not updated. That way I got the following errors:

Code
cp: /usr/local/bin/codesnippets: No such file or directory
cp: /usr/local/lib/libwxsmithlib.0.dylib: No such file or directory
cp: /usr/local/lib/libwx_macu-2.8.0.dylib: No such file or directory
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwx_macu-2.8.0.dylib (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib (No such file or directory)
install_name_tool: can't map file: ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks (Invalid argument)
install_name_tool: can't map file: ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks (Invalid argument)
install_name_tool: can't map file: ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks (Invalid argument)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/codesnippets (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/codesnippets (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/codesnippets (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib (No such file or directory)

The "can't map file" erros can be circumvented with the change:

install_name_tool -change /usr/local/lib/libcodeblocks.0.dylib @executable_path/libcodeblocks.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks/codeblocks
install_name_tool -change /usr/local/lib/libwx_macu-2.8.0.dylib @executable_path/libwx_macu-2.8.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks/codeblocks
install_name_tool -change /usr/local/lib/libwxsmithlib.0.dylib @executable_path/libwxsmithlib.0.dylib ./CodeBlocksSVN.app/Contents/MacOS/CodeBlocks/codeblocks

In this case, When I run the script I get:

Code
cp: /usr/local/bin/codesnippets: No such file or directory
cp: /usr/local/lib/libwxsmithlib.0.dylib: No such file or directory
cp: /usr/local/lib/libwx_macu-2.8.0.dylib: No such file or directory
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwx_macu-2.8.0.dylib (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/codesnippets (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/codesnippets (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/codesnippets (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib (No such file or directory)
install_name_tool: can't open file: ./CodeBlocksSVN.app/Contents/MacOS/libwxsmithlib.0.dylib (No such file or directory)

I think the script is too old. The libwx_macu-2.8.0.dylib, libwxsmithlib.0, codesnippets files must be "anachronic" references. True? I have searched similar files but I have not found good candidates.

Which should new files be? (Especifically for libwx_macu-2.8.0.dylib)


At last, I executed application from Finder.
The Codeblocks icon jumped four or five times in the dashboard before vanishing.
Next nothing happened.

The Consola.app says:

Code
[0x0-0x20020].org.codeblocks.app[489] /System/Library/Frameworks/Carbon.Framework/Versions/A/Support/LaunchCFMApp [489] Launch Failed with Error Code -2857 
(cfragCFragRsrcErr) for application /Users/baluarte/CodeBlocksSVN.app/Contents/MacOS/CodeBlocks

com.apple.launchd[261] ([0x0-0x20020].org.codeblocks.app[489]) Exited with exit code:215

What must I do now?

Thanks in advance!

Baluarte

P.S: Sorry for my horrible English


Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Big trouble running Codeblocks in MacOS X Leopard
« Reply #4 on: December 22, 2008, 02:03:24 pm »
I suspect that the script is not updated.
Quote
I think the script is too old.

They are out of sync (outdated), but the general principle should still hold...

I'll try to update it with the latest script and take down the most ancient files.

Quote
The libwx_macu-2.8.0.dylib, libwxsmithlib.0, codesnippets files must be "anachronic" references. True? I have searched similar files but I have not found good candidates.

Which should new files be? (Especifically for libwx_macu-2.8.0.dylib)

libwx_macu-2.8.0.dylib is the name of the shared library, even for wxWidgets 2.8.9

It's normally a symbolic link to the actual version (like libwx_macu-2.8.0.5.0.dylib)

Quote
What must I do now?

Most likely a library dependency looked in the wrong place, or something...

Look with /Applications/Utilities/Console.app for the actual error in the log ?

Offline Baluarte

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Big trouble running Codeblocks in MacOS X Leopard
« Reply #5 on: December 22, 2008, 09:00:52 pm »
Ok. I should recognize that I did not use any guides for the library wxwidgets building. Simply I used the same procedure than at a system Unix/Linux.
Too perhaps I should explain it in detail.

The main steps:

1. Open Console
2. cd wxWidgets-2.8.9
3. mkdir buildswithopengl; cd buildswithopengl
4. ../configure --with-opengl --with-mac --enable-unicode
5. make; sudo make install

SUCCESS!

But I do not find a similar file to *libwx_macu-*.dylib

The files I find are:

libwx_base_carbonu-2.8.0.5.dylib
libwx_base_carbonu_net-2.8.0.5.dylib
libwx_base_carbonu_xml-2.8.0.5.dylib
libwx_macu_adv-2.8.0.5.dylib
libwx_macu_aui-2.8.0.5.dylib
libwx_macu_core-2.8.0.5.dylib
libwx_macu_gl-2.8.0.5.dylib
libwx_macu_html-2.8.0.5.dylib
libwx_macu_qa-2.8.0.5.dylib
libwx_macu_richtext-2.8.0.5.dylib
libwx_macu_xrc-2.8.0.5.dylib



However:

If I install wxWidgets with Mac Ports (wxWidgets-2.8.8. Sigh!)
then Yes. I find a libwx_macu-2.8.0.5.0.dylib under /opt/local/var/macports/software/wxWidgets/2.8.8_0/opt/local) and a libwx_macu-2.8.0.dylib too.

So, I modified the script. And I copy the libwx_macu-2.8.0.5.0.dylib file in CodeBlocksSVN.app/Contents (with Finder).

Here is the proof:



Same result:

At last, I executed application from Finder.
The Codeblocks icon jumped four or five times in the dashboard before vanishing.
Next nothing happened.

The Consola.app says:

Code
[0x0-0x20020].org.codeblocks.app[489] /System/Library/Frameworks/Carbon.Framework/Versions/A/Support/LaunchCFMApp [489] Launch Failed with Error Code -2857 
(cfragCFragRsrcErr) for application /Users/baluarte/CodeBlocksSVN.app/Contents/MacOS/CodeBlocks

com.apple.launchd[261] ([0x0-0x20020].org.codeblocks.app[489]) Exited with exit code:215

Baluarte

P.S: Sorry for my poor English
« Last Edit: December 22, 2008, 09:08:53 pm by Baluarte »

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Big trouble running Codeblocks in MacOS X Leopard
« Reply #6 on: December 22, 2008, 09:26:00 pm »
Ok. I should recognize that I did not use any guides for the library wxwidgets building. Simply I used the same procedure than at a system Unix/Linux.

The configuration used for building wxWidgets noted on that Wiki page above...

Code
./configure --enable-shared --enable-monolithic --enable-unicode --with-mac --with-opengl \
            --with-png=builtin --with-jpeg=builtin --with-tiff=builtin --with-expat=builtin

It's the "monolithic" option that builds one big library instead of several small.

You can use the non-monolithic libraries too, loop over them the same way...
Check where your application links, by using otool -L on your CodeBlocks

Offline Baluarte

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Big trouble running Codeblocks in MacOS X Leopard
« Reply #7 on: December 22, 2008, 09:39:08 pm »
Ok! I will test it!

Very grateful for your effort.

Baluarte