Author Topic: Trouble with Mac OSX and CodeBlock default projects  (Read 10893 times)

Offline Clodo

  • Single posting newcomer
  • *
  • Posts: 4
Trouble with Mac OSX and CodeBlock default projects
« on: January 15, 2009, 04:49:39 pm »
Hi to all, i hope this is the right forum.

I need to port an application written with CodeBlock & wxWidgets from Linux to Mac OSX.
I'm using C::B 8.02 on Mac OS X Leopard 10.5.
I'm totally newbie about OSX world, for that i'm just starting to discover the differences.

-------------------------------------------------------------------------------------------------------------------
1- From C::B, Menu->New->Project->Shared Library->(all default), simply compiling give an error:
Code
Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I need to put "-dynamiclib" in "other linker options" to link correctly:
Code
Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Output size is 8.65 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
It's a known behiavour? It's the right solution?

-------------------------------------------------------------------------------------------------------------------
2- Menu->New->Project->wxWidgets project->(all default), compiling ok but when running the window can't be activated.
I understand that i need to create a "bundle" structure with a "info.plist", it's correct?
Where? Under bin/Debug? I need to set the executable output to "bin/Debug/Contents/MacOSX" ?

Thanks for feedback!
« Last Edit: January 15, 2009, 11:39:41 pm by Clodo »

Offline Clodo

  • Single posting newcomer
  • *
  • Posts: 4
Re: Porting from Linux to OSX
« Reply #1 on: January 15, 2009, 05:34:03 pm »
3- Under C::B Linux, i set the environment variable "LD_RUN_PATH" to "./". This build executables with the info about looking for shared library in the same path of the executable.
Under OSX doesn't work, any ideas? thx!

Offline Clodo

  • Single posting newcomer
  • *
  • Posts: 4
Re: Porting from Linux to OSX
« Reply #2 on: January 15, 2009, 11:38:03 pm »
A clarification: i read the topic IMPORTANT! BEFORE ASKING FOR HELP, and, for that, i ask only questions related to CodeBlocks and their default projects wizard (a newbie can expect that this generated projects by C::B can run out-of-the-box, right?). Ok, question (3) is out, sorry.
If this isn't the right forum, anyone can direct me to a correct place, please? Thx.

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Trouble with Mac OSX and CodeBlock default projects
« Reply #3 on: January 16, 2009, 01:04:51 am »
1- From C::B, Menu->New->Project->Shared Library->(all default), simply compiling give an error:
Code
Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Undefined symbols:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I need to put "-dynamiclib" in "other linker options" to link correctly:
Code
Compiling: main.c
Linking dynamic library: bin/Debug/libcbforumtest.dylib
Output size is 8.65 KB
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
It's a known behiavour? It's the right solution?

You are correct, -shared is currently hardcoded while Mac OS X uses -dynamiclib

So the workaround is correct, but it should handle this automatically for you really...

Quote
2- Menu->New->Project->wxWidgets project->(all default), compiling ok but when running the window can't be activated.
I understand that i need to create a "bundle" structure with a "info.plist", it's correct?
Where? Under bin/Debug? I need to set the executable output to "bin/Debug/Contents/MacOSX" ?

Thanks for feedback!

Yes, although the correct path is something like bin/Debug/Test.app/Contents/MacOS/Test

Again, the wxWidgets template should add these commands for you instead of current Rez.

Offline Clodo

  • Single posting newcomer
  • *
  • Posts: 4
Re: Trouble with Mac OSX and CodeBlock default projects
« Reply #4 on: January 16, 2009, 12:53:40 pm »
So the workaround is correct, but it should handle this automatically for you really...
...
Again, the wxWidgets template should add these commands for you instead of current Rez.
Thanks for reply!
Normally a newbie expect that a generated project from a wizard can run out-of-the-box, imho.
So, "-shared" it's automatically handled and "-dynamiclib" not, why? because C::B are more used under Linux and less used under Mac?  :wink:
Obviously it's your program and your decision about that; i reach my objective: a confirm of workaround, a topic that other people with same problem can reach, your confirm that's a known behiavour. Thanks again. Bye!

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Re: Trouble with Mac OSX and CodeBlock default projects
« Reply #5 on: January 17, 2009, 11:02:28 am »
So the workaround is correct, but it should handle this automatically for you really...
...
Again, the wxWidgets template should add these commands for you instead of current Rez.
Thanks for reply!
Normally a newbie expect that a generated project from a wizard can run out-of-the-box, imho.
So, "-shared" it's automatically handled and "-dynamiclib" not, why?
It's just a bug.

Quote
because C::B are more used under Linux and less used under Mac?  :wink:
Pretty much...

Quote
Obviously it's your program and your decision about that; i reach my objective: a confirm of workaround, a topic that other people with same problem can reach, your confirm that's a known behiavour. Thanks again. Bye!
Well, I guess nobody tried the shared library project - or at least did not report it.

The wxWidgets project used to work with Tiger, but doesn't anymore with Leopard.