How to build Imebra library using CMake for iOS?

487 Views Asked by At

I tried to embed use the Imebra library as Dicom file viewer in my iOS app. But when I built the Imebra library via "cmake --build ." on command line after "cmake install...", Errors came out as the following

Undefined symbols for architecture x86_64: "_iconv", referenced from: imebra::charsetConversionIconv::myIconv(void*, char*, unsigned long) const in charsetConversionIconvImpl.cpp.o "_iconv_close", referenced from: imebra::charsetConversionIconv::~charsetConversionIconv() in charsetConversionIconvImpl.cpp.o "_iconv_open", referenced from: imebra::charsetConversionIconv::charsetConversionIconv(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in charsetConversionIconvImpl.cpp.o

Can someone help me with it?

2

There are 2 best solutions below

0
On

i have just installed it successfuly without any error. here is what i did...

follow commandline instructions provided on imebra compilling documentation instead of gui. if you are getting error at cmake command (for being not recognized as a valid command) then you have to install CMake command line tools.

Here is a tutorial: https://www.youtube.com/watch?v=sK4sVg4SRsg

To generate a library for the iPhone simulator, type the following (replace imebra_location with the path to Imebra):

mkdir imebra_for_ios
cd imebra_for_ios
cmake imebra_location -DIOS=SIMULATOR
cmake --build

To generate a library for iPhone, type the following (replace imebra_location with the path to Imebra):

mkdir imebra_for_ios
cd imebra_for_ios
cmake imebra_location -DIOS=IPHONE
cmake --build
2
On

The cmake file does not specify the iconv library when it selects it by default. Try launching cmake explicitly specifying iconv:

Cmake -DIMEBRA_CHARSET_CONVERSION=ICONV

UPDATE

A bug in the CMakeLists.txt has been fixed in version 4.0.5.3 of the library.

Basically, while explicitly linking to iconv on Linux causes the build to fail, the opposite is true on OS-X. The resolution consisted in explicitly linking to iconv when running the build on OS-X.