Apr 17, 2014 at 4:08 PM
Edited Apr 17, 2014 at 4:13 PM
You're completely right that newer versions of boost require ICU (and not linking against it would produce issues sooner or later).
Now, on to the main problem. I think that your issue is your link order. I suspect you have a link line that looks like
gcc main.o foo.o bar.o -ldl -lz -lboost -lcasablanca
Unfortunately, due to the particulars of how linking works, this will fail to properly link all the symbols from Casablanca against boost. Long story short, you fix this by putting -lcasablanca as the first link in the list:
gcc main.o foo.o bar.o -lcasablanca -ldl -lz -lboost
Long story long: When linking occurs, the linker works by building a table of "unresolved symbols needed thus far". So first, it goes through your primary objects (main, foo, and bar) and records all the symbols they need. Then it looks at (in the
first case) dl.a and says "What parts of this library do I need? dlsym and dlopen," which it then adds to final binary. Then, it goes to libz and does the same. Then we get to boost. At this point, the linker says "Hmm, you don't seem to be
using any boost symbols. Oh well, just toss the library." and doesn't include any of the symbols. Then we get to Casablanca and it says "Ok, you're using function utility::conversions::usascii_to_utf16 which relies on boost::locale::conv::to_utf"
and adds boost::locale::conf::to_utf to the list of symbols needed.
The crucial point here, is that the linker will not backtrack
. Since it has already passed boost, it will not go back to look again and will therefore not locate the symbol.
If this doesn't fix your issue, could you please post the full link line (you can reveal it by doing
In my project or when I build casablanca ?
I am curious about your steps for building Casablanca -- specifically, I would like to understand why you needed to patch Release/CMakeLists.txt to include these two definitions.
Edit: After re-reading your initial post, I realize that you (were?) using those macros in your actual project, thus needed to add them to the CMake file when compiling Casablanca.