I am trying to find a way to use a C++ library from kotlin native using a extern “C” Wrapper API.
Things work fine until the moment I try to produce the K/N executable, then I get the error message below abut a missing reference to the C++ new operator.
It looks like konanc does not link in the standard C++ runtime.
Is there a way to overcome this?
:compileKonanK-wrapperLinux_x64 FAILED /tmp/included802814211042874970/libmyLib.a(MyWrapper.cpp.o):MyWrapper.cpp:function newMyClass: error: undefined reference to 'operator new(unsigned long)' error: /home/vbaggiol/.konan/dependencies/target-gcc-toolchain-3-linux-x86-64/x86_64-unknown-linux-gnu/bin/ld.gold invocation reported errors
Here is the corresponding source code MyWrapper.cpp in my github project.
To reproduce this problem please checkout the two projects (tag forum-2018-07-15) from github into the /tmp directory
and follow the build instructions in the README.md files of each project:
- https://github.com/vbaggiol/c-wrapper # the wrapped library
- https://github.com/vbaggiol/c-wrapper-kotlin # the caling kotlin native code
I’m working on Ubuntu 16.04 LTS.
Many thanks in advance for your help!