nariakiiwatani / ofxNDI

NewTek NDI SDK Wrapper for openFrameworks.
https://ndi.tv/
MIT License
103 stars 19 forks source link

ofxNDI compile for Linux #27

Closed steeley closed 3 years ago

steeley commented 3 years ago

Is it possible to use this addon with Linux? Intel platform would be ok, but RaspberryPi would be really nice.

nariakiiwatani commented 3 years ago

I really don't know about Linux but it would be, I guess, I hope. NDI itself supports Linux and AFAIK I haven't write any platform-specific code in this addon.

If everything goes fine, all you will need to do are

If you try, please share the processes and results and it will be much appreciated!

steeley commented 3 years ago

I tried to learn from this ofxNDI github.com/thomasgeissl/ofxNDI as it says it works on linux. I did get it to build and link, but had to put the libndi.so.3 in /usr/local/lib and it did run. But it is not very useful.

With your ofxNDI I added this line to addon_config.mk. but maybe it wants ndilib.so.X?

linux:
    ADDON_DLLS_TO_COPY += windows-copy-to-bin/Processing.NDI.Lib.x86.dll

the ndi addon files build but the linker fails like this:

++ -o bin/example-videocaster  obj/linux64/Release/src/ofApp.o obj/linux64/Release/src/main.o  /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIRecorder.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIRecvStream.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/utils/ofxNDIVideoCaster.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/utils/ofxNDIVideoGrabber.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIPTZ.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIFinder.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIReceiver.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIRouter.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIFrame.o /home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISendStream.o  /home/steeley/oF/libs/openFrameworksCompiled/lib/linux64/libopenFrameworks.a   -Wl,-rpath=./libs:./bin/libs -Wl,--as-needed -Wl,--gc-sections -fuse-ld=gold -L/home/steeley/oF/libs/fmod/lib/linux64/ -lfmod /home/steeley/oF/libs/kiss/lib/linux64/libkiss.a /home/steeley/oF/libs/tess2/lib/linux64/libtess2.a   -lz -lgstapp-1.0 -lgstvideo-1.0 -lgstbase-1.0 -lgstreamer-1.0 -ludev -lfontconfig -lfreetype -lsndfile -lopenal -lcurl -lglfw -lrtaudio -lpulse-simple -lpulse -lasound -lGLEW -lGLU -lGL -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lmpg123 -lglut -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -ldl -lpthread -lfreeimage -lboost_filesystem -lboost_system -lpugixml -luriparser -lXinerama
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::setup(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool, bool): error: undefined reference to 'NDIlib_send_create'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::isConnected(long) const: error: undefined reference to 'NDIlib_send_get_no_connections'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::addConnectionMetadata(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, long) const: error: undefined reference to 'NDIlib_send_add_connection_metadata'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::setFailover(ofxNDI::Source const&) const: error: undefined reference to 'NDIlib_send_set_failover'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::getTally(bool*, bool*, long) const: error: undefined reference to 'NDIlib_send_get_tally'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::~Sender(): error: undefined reference to 'NDIlib_send_destroy'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::~Sender(): error: undefined reference to 'NDIlib_destroy'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::getSourceName() const: error: undefined reference to 'NDIlib_send_get_source_name'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISender.o:ofxNDISender.cpp:function ofxNDI::Send::Sender::clearConnectionMetadata() const: error: undefined reference to 'NDIlib_send_clear_connection_metadata'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIFrame.o:ofxNDIFrame.cpp:function ofxNDI::AudioFrame::encode(ofSoundBuffer&&, bool): error: undefined reference to 'NDIlib_util_audio_from_interleaved_32f_v2'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDIFrame.o:ofxNDIFrame.cpp:function ofxNDI::AudioFrame::decode(ofSoundBuffer&) const: error: undefined reference to 'NDIlib_util_audio_to_interleaved_32f_v2'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISendStream.o:ofxNDISendStream.cpp:function ofxNDI::Recv::Blocking<ofxNDI::MetadataFrame, ofxNDI::Send::Sender>::captureFrame(ofxNDI::MetadataFrame&): error: undefined reference to 'NDIlib_send_capture'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISendStream.o:ofxNDISendStream.cpp:function ofxNDI::Send::VideoStream::sendFrame(ofxNDI::VideoFrame const&) const: error: undefined reference to 'NDIlib_send_send_video_async_v2'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISendStream.o:ofxNDISendStream.cpp:function ofxNDI::Send::VideoStream::sendFrame(ofxNDI::VideoFrame const&) const: error: undefined reference to 'NDIlib_send_send_video_v2'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISendStream.o:ofxNDISendStream.cpp:function ofxNDI::Send::MetadataStream::sendFrame(ofxNDI::MetadataFrame const&) const: error: undefined reference to 'NDIlib_send_send_metadata'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISendStream.o:ofxNDISendStream.cpp:function ofxNDI::Send::Stream<ofxNDI::AudioFrame, ofxNDI::Send::Sender>::sendFrame(ofxNDI::AudioFrame const&) const: error: undefined reference to 'NDIlib_send_send_audio_v3'
/home/steeley/oF/addons/obj/linux64/Release/ofxNDI/src/ofxNDISendStream.o:ofxNDISendStream.cpp:function ofxNDI::Recv::Blocking<ofxNDI::MetadataFrame, ofxNDI::Send::Sender>::freeFrame(ofxNDI::MetadataFrame&): error: undefined reference to 'NDIlib_send_free_metadata'
collect2: error: ld returned 1 exit status
make[1]: *** [/home/steeley/oF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:405: bin/example-videocaster] Error 1
make[1]: Leaving directory '/home/steeley/oF/addons/ofxNDI/example-videocaster'
make: *** [/home/steeley/oF/libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2
nariakiiwatani commented 3 years ago

DLLs are for Windows so you need NDI SDK for Linux that you can download from NewTek website. As you wrote it needs a kind of ndilib.so.X.

Once you put them in the right place as for example old ofxOpenCV does, PG would automatically add the libs to the project.

スクリーンショット 2021-04-21 13 34 33
steeley commented 3 years ago

Thank you - I was getting confused with .so and .dll...

It works! - here is my process:

Copy: NDI SDK for Linux/lib/x86_64-linux-gnu folder to:

/addons/ofxNDI/libs/NDI/lib copy this to addon_config.mk linux64: ADDON_LIBS = ADDON_LIBS += libs/NDI/lib/x86_64-linux-gnu/libndi.so ADDON_LIBS += libs/NDI/lib/x86_64-linux-gnu/libndi.so.4 ADDON_LIBS += libs/NDI/lib/x86_64-linux-gnu/libndi.so.4.6.2
AnasGhrab commented 2 years ago

Hi,

I have followed you process, using NDI 5, so I changed libndi.so.4 by libndi.so.5 and libndi.4.6.2 by libndi.5.1.1, but I get :

./example-sender: error while loading shared libraries: libndi.so.5: cannot open shared object file: No such file or directory
crecord commented 2 years ago

I was also struggle with this, I got it working with NDI 5 by

  1. Using this branch
  2. adding #include <functional> to ofxNDIFinder.h
  3. adding the absolute paths to the .so files in dynamiclibraries in my QBS file for QT like so

of.dynamicLibraries: ["/home/antimodular/Documents/of_v0.11.2_linux64gcc6_release/addons/ofxNDI/libs/NDI/lib/x86_64-linux-gnu/libndi.so","/home/antimodular/Documents/of_v0.11.2_linux64gcc6_release/addons/ofxNDI/libs/NDI/lib/x86_64-linux-gnu/libndi.so.5","/home/antimodular/Documents/of_v0.11.2_linux64gcc6_release/addons/ofxNDI/libs/NDI/lib/x86_64-linux-gnu/libndi.so.5.1.1"] // dynamic libraries

Hope that helps!