The Issue
I'm trying to compile an iOS test project with the NDI v3.0 SDK and I'm running into Apple Mach-O Linker (ld) Errors.
It's a static framework (libndi_ios.a
) that you are to link your binary to, and reference the headers in order to use their C/C++ API in our ObjC++ code.
I am copying sample code of theirs that simply creates a NDIlib_send_instance_t
for use. As soon as I attempt to compile this code the build fails with this linker error:
Undefined symbols for architecture armv7:
"NDI_multicast::send::packetize::~packetize()", referenced from:
std::__1::__shared_ptr_emplace<NDI_multicast::send::packetize, std::__1::allocator<NDI_multicast::send::packetize> >::~__shared_ptr_emplace() in libndi_ios.a(send_server.o)
std::__1::__shared_ptr_emplace<NDI_multicast::send::packetize, std::__1::allocator<NDI_multicast::send::packetize> >::~__shared_ptr_emplace() in libndi_ios.a(send_server.o)
std::__1::__shared_ptr_emplace<NDI_multicast::send::packetize, std::__1::allocator<NDI_multicast::send::packetize> >::__on_zero_shared() in libndi_ios.a(send_server.o)
NDI_multicast::send::send(NDI_multicast::send::config_multicast_t const&) in libndi_ios.a(NDI_multicast_send.o)
NDI_multicast::send::send(NDI_multicast::send::config_unicast_t const&) in libndi_ios.a(NDI_multicast_send.o)
NDI_multicast::send::~send() in libndi_ios.a(NDI_multicast_send.o)
"NDI_multicast::send::packetize::packetize()", referenced from:
ndi::reference::send::server::send(ndi::reference::buffer_pack const&, ndi::reference::send::connection*) in libndi_ios.a(send_server.o)
NDI_multicast::send::send(NDI_multicast::send::config_multicast_t const&) in libndi_ios.a(NDI_multicast_send.o)
NDI_multicast::send::send(NDI_multicast::send::config_unicast_t const&) in libndi_ios.a(NDI_multicast_send.o)
"NDI_multicast::send::packetize::operator()(std::__1::function<std::__1::pair<unsigned char const*, unsigned long> (unsigned long, unsigned long)>)", referenced from:
ndi::reference::send::server::send(ndi::reference::buffer_pack const&, ndi::reference::send::connection*) in libndi_ios.a(send_server.o)
NDI_multicast::send::operator()(NDI_multicast::send::buffer_source_t&, std::__1::pair<int, int>, std::__1::function<void (bool)>) in libndi_ios.a(NDI_multicast_send.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Reproducing
You can reproduce this error by following the steps below. I'm currently using Xcode 9.4 (and I've tested on the latest beta with the same results)
The steps I have taken to get this error:
- Install the NewTek NDI SDK from their website here
- Create a new Xcode project for a single view Objective-C iOS app
- Rename the
ViewController.m
toViewController.mm
(So it's compiled as Objc++) - Add
/NewTek NDI SDK/include
to Header Search Paths - Add
/NewTek NDI SDK/lib/iOS
to Library Search Paths - Add the
libndi_ios.a
under the "Link Binary With Libraries" in "Build Phases". Add this code to the ViewController.mm:
NDIlib_initialize(); NDIlib_send_create_t NDI_send_create_desc; NDI_send_create_desc.p_ndi_name = "My Audio"; NDI_send_create_desc.clock_audio = true; // (Without this line, everything compiles fine...) NDIlib_send_instance_t pNDI_send = NDIlib_send_create(&NDI_send_create_desc);
This will fail with the error above.
One thing that I found interesting was that using other code from their samples, such as for receiving video, worked as expected. The issue only exists when using the NDIlib_send_create
API.
Does anyone have any tips, or ideas to lend?
You can find the NewTek iOS SDK by requesting it on their website here.