Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development
Compiling plugin for Mac OSX
roxlu:
Hi, I've created a plugin for Code::blocks on windows, that uses wxWidgets. On windows it compiles nice and works as it should. I've now downloaded the 8.02 tag from svn, compiled C::B from source (also wxMac) and I'm trying to compile my plugin, but it fails when it wants to link it. I'm using the `/usr/local/bin/wx-config --cppflags` and `/usr/local/bin/wx-config --libs` in my build options. Does someone knows how I can fix this?
This is the output of C::B
--- Code: ----------------- Build: default in OpenFrameworks ---------------
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/tinyxml/tinyxmlparser.cpp -o .objs/tinyxml/tinyxmlparser.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/InstallParser.cpp -o .objs/InstallParser.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/OpenFrameworks.cpp -o .objs/OpenFrameworks.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/ProjectAnalyzer.cpp -o .objs/ProjectAnalyzer.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/tinyxml/tinystr.cpp -o .objs/tinyxml/tinystr.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/tinyxml/tinywxuni.cpp -o .objs/tinyxml/tinywxuni.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/tinyxml/tinyxml.cpp -o .objs/tinyxml/tinyxml.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/tinyxml/tinyxmlerror.cpp -o .objs/tinyxml/tinyxmlerror.o
g++ -g -I/usr/local/lib/wx/include/mac-ansi-release-2.8 -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXMAC__ -DBUILDING_PLUGIN -D__WXMAC__ -DWXUSINGDLL -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -DwxUSE_UNICODE -Itinyxml -I/usr/local/include/include -I/usr/local/include/include/wxscintilla/include -I/usr/local/lib/wx/include/mac-ansi-release-2.8/ -I/usr/local/include/wx-2.8 -I/usr/local/include/codeblocks/ -I/usr/local/include/codeblocks/wxscintilla/include/ -c /Users/diederick/Desktop/tmp/codeblocks_plugin/trunk/AddonDialog.cpp -o .objs/AddonDialog.o
g++ -shared -L/usr/local/include/devel -L/usr/local/lib/ -L/usr/local/lib .objs/tinyxml/tinyxmlparser.o .objs/InstallParser.o .objs/OpenFrameworks.o .objs/ProjectAnalyzer.o .objs/tinyxml/tinystr.o .objs/tinyxml/tinywxuni.o .objs/tinyxml/tinyxml.o .objs/tinyxml/tinyxmlerror.o .objs/AddonDialog.o -o OpenFrameworks.dylib -L/usr/local/lib -framework IOKit -framework Carbon -framework Cocoa -framework System -framework QuickTime -framework OpenGL -framework AGL -lwx_mac_richtext-2.8 -lwx_mac_aui-2.8 -lwx_mac_xrc-2.8 -lwx_mac_qa-2.8 -lwx_mac_html-2.8 -lwx_mac_adv-2.8 -lwx_mac_core-2.8 -lwx_base_carbon_xml-2.8 -lwx_base_carbon_net-2.8 -lwx_base_carbon-2.8 -lcodeblocks
i686-apple-darwin8-g++-4.0.1: unrecognized option '-shared'
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: warning -L: directory name (/usr/local/include/devel) does not exist
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_main
wxStringBase::InitWith(wchar_t const*, unsigned long, unsigned long)
wxStringBase::wxStringBase(unsigned long, wchar_t)
wxString::wxString(char const*, wxMBConv const&, unsigned long)
wxString::Printf(wchar_t const*, ...)
wxString::mb_str(wxMBConv const&) const
operator+(wchar_t const*, wxString const&)
wxStringBase::ConcatSelf(unsigned long, wchar_t const*, unsigned long)
wxString::Find(wchar_t const*) const
operator+(wxString const&, wchar_t const*)
wxFile::Access(wchar_t const*, wxFile::OpenMode)
wxFile::wxFile(wchar_t const*, wxFile::OpenMode)
wxString::Format(wchar_t const*, ...)
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 13 seconds)
0 errors, 0 warnings
--- End code ---
stahta01:
Code::Blocks is normally Unicode the log you showed looked like ANSI build of wxWidgets.
Which are you trying to do?
You can NOT easily mix the two!
The below define implies Unicode build
--- Code: ----DwxUSE_UNICODE
--- End code ---
The folder name below implies ANSI build
--- Code: ---mac-ansi-release-2.8
--- End code ---
Tim S.
afb:
--- Quote ---i686-apple-darwin8-g++-4.0.1: unrecognized option '-shared'
--- End quote ---
You need to use -bundle on Mac OS X, not -shared
(If making a shared library, it would be -dynamiclib)
Probably should use libtool to handle that for you... ?
(see the plugins bundled with codeblocks for examples)
roxlu:
hi afb, thanks a lot! Using dynamiclib and removing-DwxUSE_UNICODE did the trick.
Now I'm curious how I can create an installable plugin?
afb:
--- Quote from: roxlu on October 12, 2009, 08:32:51 pm ---hi afb, thanks a lot! Using dynamiclib and removing-DwxUSE_UNICODE did the trick.
Now I'm curious how I can create an installable plugin?
--- End quote ---
Well, you need two things: the bundle (.so) and the resources (.zip)
Dynamic libs are only used for things such as libcodeblocks.0.dylib
Then you need to make sure it can find all the libraries it needs,
this you can check and correct with otool and install_name_tool.
--- Code: ---$ otool -L libcompiler.so
libcompiler.so:
@executable_path/libwx_macu-2.8.0.dylib (compatibility version 7.0.0, current version 7.0.0)
@executable_path/libcodeblocks.0.dylib (compatibility version 1.0.0, current version 1.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.10)
/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 7.4.0)
/usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version