Author Topic: Code::Blocks, wxWidgets and Mac OS X  (Read 14924 times)

Offline BastiaanOlij

  • Multiple posting newcomer
  • *
  • Posts: 10
Code::Blocks, wxWidgets and Mac OS X
« on: June 14, 2014, 03:34:42 am »
Hi All,

Been doing alot of googling and searching and every time I get a step closer but I'm stuck at the final end probably overlooking something utterly dumb.

Yes I'm new to code::blocks, forgive me:)

Anyway I've downloaded wxWidgets 3.0.0 and compiled from source. I'm going down the route of creating a static library for wxWidgets and compiling against that and ignoring xcode for as much as I can. In a nutshell, created a build folder, using configure to set up my build, then make, and finally make install. Also compiled the samples and they all work so I'm pretty sure wxWidgets is up and running.

Booted up code::blocks, used the wizard to create an empty wxWidgets project, pretty much default settings for 3.0.0. Tried to compile and hit the first road block. Couldn't find several wxWidgets include files...
Even though I used make install I think I'm missing something there, the files got nicely installed into /usr/local but alas. I left that alone and instead concentrated on my source tree.

Opened up build options and setup search directories manually.
Compiler search directories are set up as:
../wxWidgets/include
../wxWidgets/build-cocoa/lib/wx/include/osx_cocoa-unicode-static-3.0
Linker search directories are set up as:
../wxWidgets/build-cocoa/lib

Tried compiling again, got a little further, now it started to complaining about missing targets and such with the message wx-setup should be run
Again, opening up build options, noticed the inclusion of wx-setup in the compilers "other options" and "other linker options" under the linker settings

All I did here is complete the path, again I think this is the same issue as above that wxWidgets didn't get installed in the right location for code::blocks to find it.

Compiling now compiles all the sources correctly and attempts to link everything correctly however I'm left with two linker issues:

ld: warning: option -s is obsolete and being ignored
ld: internal error: atom not found in symbolIndex(__ZN8wxString7ImplStrEPKcRK8wxMBConv) for architecture x86_64

I have no clue here :)

Cheers,

Bastiaan Olij










Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2566
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #1 on: June 14, 2014, 10:44:18 am »
i'm np mac user, so probably i can't help, but it is always a good idea to report a compiling/linking problem with the help of this template: http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

you posted the wrong build log... and please make a rebuild

greetings

Offline BastiaanOlij

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #2 on: June 14, 2014, 11:27:52 am »
BlueHazzard,

Hopefully someone has an answer though:)

I did just notice that calling wx-setup in other options is only working for the linker, for the compiler it's not inserting the flags. I ended up manually inserting them but to no avail, still same issue in the build log:

Code: [Select]
-------------- Build: Release in TestWidgets (compiler: GNU GCC Compiler)---------------

g++ -Wall -O2 -I/Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/Projects/CPP/wxWidgets-3.0.0/include -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -I../wxWidgets/include -I../wxWidgets/build-cocoa-release/lib/wx/include/osx_cocoa-unicode-static-3.0 -c /Projects/Personal/CPP/Testing/TestWidgets/TestWidgetsApp.cpp -o obj/Release/TestWidgetsApp.o
g++ -Wall -O2 -I/Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/Projects/CPP/wxWidgets-3.0.0/include -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__ -I../wxWidgets/include -I../wxWidgets/build-cocoa-release/lib/wx/include/osx_cocoa-unicode-static-3.0 -c /Projects/Personal/CPP/Testing/TestWidgets/TestWidgetsMain.cpp -o obj/Release/TestWidgetsMain.o
g++ -L../wxWidgets/build-cocoa-release/lib -o bin/Release/TestWidgets obj/Release/TestWidgetsApp.o obj/Release/TestWidgetsMain.o  -s -L/Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/lib/libwx_osx_cocoau-3.0.a -framework WebKit -lwxregexu-3.0 -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -lz -lpthread -liconv   
ld: warning: option -s is obsolete and being ignored
ld: internal error: atom not found in symbolIndex(__ZN8wxString7ImplStrEPKcRK8wxMBConv) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Process terminated with status 1 (0 minute(s), 3 second(s))
0 error(s), 1 warning(s) (0 minute(s), 3 second(s))

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #3 on: June 14, 2014, 12:02:56 pm »
Are you sure your wxwigets is build for 64bits?
Probably you'll get better support in the wxWidgets' forum/mailing list.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BastiaanOlij

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #4 on: June 14, 2014, 01:23:45 pm »
oBFusCATed, I'll certainly ask there as well.

Any ideas why the output from wx_config is only working for the linker and not the compiler and why I had to manually copy all the flags in?

The "other options" is set to:
`../wxWidgets/build-cocoa/wx-config --cflags`

It does seem to do something as the string isn't put into the command string and like I mentioned, executing this on the command line and pasting the flags into the "other options" field works fine.
wx-config is executed properly for the linker options..  
« Last Edit: June 14, 2014, 01:36:56 pm by BastiaanOlij »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6672
    • My Best Post
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #5 on: June 14, 2014, 02:20:30 pm »
oBFusCATed, I'll certainly ask there as well.

Any ideas why the output from wx_config is only working for the linker and not the compiler and why I had to manually copy all the flags in?

The "other options" is set to:
`../wxWidgets/build-cocoa/wx-config --cflags`

It does seem to do something as the string isn't put into the command string and like I mentioned, executing this on the command line and pasting the flags into the "other options" field works fine.
wx-config is executed properly for the linker options..  

I strongly suggest trying it with either a full path to wx-config or getting your computer to use just  `wx-config --cflags`

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline BastiaanOlij

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #6 on: June 15, 2014, 12:28:00 am »
I strongly suggest trying it with either a full path to wx-config or getting your computer to use just  `wx-config --cflags`

As I mentioned, that is what I do, using wx-config directly only seems to work for the linker options, not for the compiler options, so ran it in the command line and pasted in the results. That made the sources compile.

Without wx-config in the linker options the errors on the linker are substantial as to be expected. With wx-configs output in the linker options I'm just stuck with the one error mentioned on top.

Cheers,

Bastiaan Olij

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #7 on: June 17, 2014, 01:59:27 am »
As I mentioned, that is what I do, using wx-config directly ....
Please reread the post from stahta01. It is either you're using a relative path or you're not posting correct information!
You stated that you're using a relative path, but stahta01 suggested to use full/absolute path, please try it and report if it is not working...

p.s. keep in mind that the backtick expressions are cached for the whole C::B session, so if you've changed something in you environment it won't be reflected until you restart C::B.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BastiaanOlij

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #8 on: June 17, 2014, 03:23:17 am »
Please reread the post from stahta01. It is either you're using a relative path or you're not posting correct information!
You stated that you're using a relative path, but stahta01 suggested to use full/absolute path, please try it and report if it is not working...

Ah, then indeed I must not have been clear enough and my apologies (note in the previous posts I shorted some of the path names for clarity but I'll leave them as they are here).

In the compiler settings I've tried:
`../wxWidgets-3.0.0/build-cocoa-release/wx-config --cflags`

Nothing is added to the compiler command and compilation fails with numerous errors consistent with not having the correct paths and flags set.

I've tried:
`/Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/wx-config --cflags`

Same thing as above.

Finally I executed the command on a command line and copied the flags into C::B:
-I/Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/Projects/CPP/wxWidgets-3.0.0/include -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__

And that works fine, this is also what is used in the compiler log posted above.

In the linker setting I've tried:
`../wxWidgets-3.0.0/build-cocoa-release/wx-config --libs`
and
`/Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/wx-config --clibs`
and the output of this:
-L/Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /Projects/CPP/wxWidgets-3.0.0/build-cocoa-release/lib/libwx_osx_cocoau-3.0.a -framework WebKit -lwxregexu-3.0 -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -lz -lpthread -liconv

All result in the same linker command that compiles except for the aforementioned x86_64 error

So it would seem that calling wx-config from the compiler settings isn't working but calling it from the linker settings is.
Currently my build is setup to simply use the flags bypassing wx-config all together as I want to get the app to compile first and then worry about what I'm doing wrong in calling wx-config :)

p.s. keep in mind that the backtick expressions are cached for the whole C::B session, so if you've changed something in you environment it won't be reflected until you restart C::B.
That is good to know but I have restarted C::B to ensure that is not the cause. Also checking the compiler log I can see the commands are being executed as they have been configured as far as I can tell so it must be a flag that is missing in either the compiler or the linker.

So far I've not had any usable feedback on that on the wxWidgets forum:(

Thanks for your help guys!

Cheers,

Bas



Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #9 on: June 17, 2014, 08:30:28 am »
What happens if you place `wx-config --libs ` in the compiler options? And `wx-config --cxxflags` in the linker?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BastiaanOlij

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #10 on: June 17, 2014, 09:59:10 am »
What happens if you place `wx-config --libs ` in the compiler options? And `wx-config --cxxflags` in the linker?

Are you sure you want me to configure the compile options for the linker and the linker options for the compiler? I'll humour you :)

Setting them exactly as you state, so wx-config without a path:
Code: [Select]
-------------- Build: Release in TestWidgets (compiler: GNU GCC Compiler)---------------

g++ -Wall -O2  -c /Projects/Personal/CPP/TestWidgets/TestWidgetsApp.cpp -o obj/Release/TestWidgetsApp.o
In file included from /Projects/Personal/CPP/TestWidgets/TestWidgetsApp.cpp:18:
/Projects/Personal/CPP/TestWidgets/TestWidgetsApp.h:13:10: fatal error: 'wx/app.h' file not found
#include <wx/app.h>
         ^
1 error generated.
Process terminated

As you can see from the G++ line C::B isn't including any of the wxWidgets compiler options wx-config returns (and yes, before you ask I am using these funky characters ` around the command, I assumed they tell C::B to run the command and add its return value to the arguments, that does work for the linker arguments, just not for the compiler).

If I run wx-config on the command line, without the path, I get only slightly different options as it now uses the files "make install" moved into my /usr/local folder.

Copying those flags in, and just for fun swapping the linker and compiler options gives me:
Code: [Select]
-------------- Build: Release in TestWidgets (compiler: GNU GCC Compiler)---------------

g++ -Wall -O2 -L/usr/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /usr/local/lib/libwx_osx_cocoau-3.0.a -framework WebKit -lwxregexu-3.0 -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -lz -lpthread -liconv  -c /Projects/Personal/CPP/TestWidgets/TestWidgetsApp.cpp -o obj/Release/TestWidgetsApp.o
clang: warning: -framework IOKit: 'linker' input unused
clang: warning: -framework Carbon: 'linker' input unused
clang: warning: -framework Cocoa: 'linker' input unused
clang: warning: -framework AudioToolbox: 'linker' input unused
clang: warning: -framework System: 'linker' input unused
clang: warning: -framework OpenGL: 'linker' input unused
clang: warning: /usr/local/lib/libwx_osx_cocoau-3.0.a: 'linker' input unused
clang: warning: -framework WebKit: 'linker' input unused
clang: warning: -lwxregexu-3.0: 'linker' input unused
clang: warning: -lwxtiff-3.0: 'linker' input unused
clang: warning: -lwxjpeg-3.0: 'linker' input unused
clang: warning: -lwxpng-3.0: 'linker' input unused
clang: warning: -lz: 'linker' input unused
clang: warning: -lpthread: 'linker' input unused
clang: warning: -liconv: 'linker' input unused
clang: warning: argument unused during compilation: '-L/usr/local/lib'
In file included from /Projects/Personal/CPP/TestWidgets/TestWidgetsApp.cpp:18:
/Projects/Personal/CPP/TestWidgets/TestWidgetsApp.h:13:10: fatal error: 'wx/app.h' file not found
#include <wx/app.h>
         ^
1 error generated.

I wasn't honestly expecting that to work:)

Putting the flags the right way around but using the paths wx-config brings me back to where I was:
Code: [Select]
-------------- Build: Release in TestWidgets (compiler: GNU GCC Compiler)---------------

g++ -Wall -O2 -I/usr/local/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__  -c /Projects/Personal/CPP/TestWidgets/TestWidgetsApp.cpp -o obj/Release/TestWidgetsApp.o
g++ -Wall -O2 -I/usr/local/lib/wx/include/osx_cocoa-unicode-static-3.0 -I/usr/local/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -D__WXMAC__ -D__WXOSX__ -D__WXOSX_COCOA__  -c /Projects/Personal/CPP/TestWidgets/TestWidgetsMain.cpp -o obj/Release/TestWidgetsMain.o
g++  -o bin/Release/TestWidgets obj/Release/TestWidgetsApp.o obj/Release/TestWidgetsMain.o  -s -L/usr/local/lib   -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL /usr/local/lib/libwx_osx_cocoau-3.0.a -framework WebKit -lwxregexu-3.0 -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -lz -lpthread -liconv  
ld: warning: option -s is obsolete and being ignored
ld: internal error: atom not found in symbolIndex(__ZN8wxString7ImplStrEPKcRK8wxMBConv) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Process terminated with status 1 (0 minute(s), 5 second(s))

Well it was worth a try :)

I have no idea where __ZN8wxString7ImplStrEPKcRK8wxMBConv comes from or what it is. I don't know if this is a function used somewhere in wxWidgets or if it is something in my source code (which is just the default code that the C::B wxWidgets project template adds), or whether my xCode install is dodgy and its something the linker introduces.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #11 on: June 17, 2014, 10:08:28 am »
Are you sure you want me to configure the compile options for the linker and the linker options for the compiler? I'll humour you :)
The idea is to verify that the backtick expansion works in the compiler options, too. No need for humour or jokes!

We've verified it works. Now it is time to find out why wx-config --cflags doesn't return the proper string...
Can you start codeblocks from the same terminal, where you've verified that wx-config --cflags returns the proper result?


(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #12 on: June 17, 2014, 10:11:04 am »
https://github.com/mapnik/node-mapnik/wiki/Troubleshooting

Code: [Select]
Can be fixed by upgrading your node-mapnik version or manually removing the -s stripping from common.gypi if it exits.
Little searching reveals what your problem is!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline BastiaanOlij

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #13 on: June 17, 2014, 10:31:32 am »
The idea is to verify that the backtick expansion works in the compiler options, too. No need for humour or jokes!

We've verified it works. Now it is time to find out why wx-config --cflags doesn't return the proper string...
Can you start codeblocks from the same terminal, where you've verified that wx-config --cflags returns the proper result?
That works!

And that kinda makes sense now that I think of it. All the paths and stuff would have been added to my bash profile and will probably not be set up when I start C::B directly.

Little searching reveals what your problem is!
I'm dying to know what you search on to find that as that page showed up no where in my attempts to google on the error.

So the -s option, even though the linker says its ignore it because its deprecated, is actually doing something naughty. Turning that off in C::B does indeed result in the linker linking my app. It's not running yet but OSX seems to think its not a cocoa app, I'm guessing thats because I've just got the executable and no p-list etc.

Unlike that page suggests, I'm not on Mavericks btw but I have an up to date XCode 5.0 installation so whatever is causing this is simply in the latest of Apple's compilers.

Thanks man! this was super!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12122
    • Travis build status
Re: Code::Blocks, wxWidgets and Mac OS X
« Reply #14 on: June 17, 2014, 08:46:30 pm »
Just searched for the error, but removed the unique parts of it...
Like this:
Code: [Select]
ld: internal error: atom not found in symbolIndex() for architecture x86_64
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]