User forums > Using Code::Blocks
Code::Blocks, wxWidgets and Mac OS X
BastiaanOlij:
--- Quote from: oBFusCATed 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?
--- End quote ---
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: ----------------- 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
--- End code ---
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: ----------------- 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.
--- End code ---
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: ----------------- 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))
--- End code ---
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.
oBFusCATed:
--- Quote from: BastiaanOlij on June 17, 2014, 09:59:10 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 :)
--- End quote ---
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?
oBFusCATed:
https://github.com/mapnik/node-mapnik/wiki/Troubleshooting
--- Code: ---Can be fixed by upgrading your node-mapnik version or manually removing the -s stripping from common.gypi if it exits.
--- End code ---
Little searching reveals what your problem is!
BastiaanOlij:
--- Quote from: oBFusCATed on June 17, 2014, 10:08:28 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?
--- End quote ---
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.
--- Quote from: oBFusCATed on June 17, 2014, 10:08:28 am ---Little searching reveals what your problem is!
--- End quote ---
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!
oBFusCATed:
Just searched for the error, but removed the unique parts of it...
Like this:
--- Code: ---ld: internal error: atom not found in symbolIndex() for architecture x86_64
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version