Kodi-Addon - Linker fails

Good morning,

I am trying to build the kodi-binary-addon inputstream.ffmpegdirect in my project:
https://build.opensuse.org/package/show/home:Herbster0815:HTPC/kodi.binary-addons-inputstream.ffmpegdirect

But building fails with error:

   65s] /usr/bin/g++-7 -fPIC -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -DNDEBUG -O2 -g -DNDEBUG -lavcodec;-lavfilter;-lavformat;-lavutil;-lswscale;-lswresample;-lpostproc  -Wl,--as-needed -Wl,--no-undefined -Wl,-z,now -shared -Wl,-soname,inputstream.ffmpegdirect.so.19.0 -o inputstream.ffmpegdirect.so.1.4.1 CMakeFiles/inputstream.ffmpegdirect.dir/src/StreamManager.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/DemuxStream.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/FFmpegCatchupStream.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/FFmpegLog.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/FFmpegStream.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/commons/Exception.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/threads/Atomics.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/threads/Event.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/threads/Thread.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/threads/Timer.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/threads/TimeUtils.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/threads/SystemClock.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/url/URL.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/url/UrlOptions.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/url/Variant.cpp.o CMakeFiles/inputstream.ffmpegdirect.dir/src/stream/platform/posix/XTimeUtils.cpp.o  -L/usr//usr/lib64 -lp8-platform -lpthread /usr/lib64/libz.so /usr/lib64/libbz2.so 
   65s] /usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lavcodec;-lavfilter;-lavformat;-lavutil;-lswscale;-lswresample;-lpostproc
   65s] collect2: error: ld returned 1 exit status

What am I missing here? Does anyone have a clue?

Thx in advance!

When I look at the g++ and gcc man pages, I don’t see how the GNU compilers would accept arguments like »–as-needed« or what appears to be libraries seperated by semicolons (»-lavcodec;-lavfilter;-lavformat;-lavutil;-lswscale;-lswresample;-lpostproc« just looks out of place to me).

My usual gcc/g++ invocations are admittedly far simpler than your build, for example:

  • gcc -Wall -ansi -ljpeg -I/usr/include/SDL2 -D_REENTRANT -L/usr/lib64 -lSDL2 viewer.c
  • g++ -lSDL2 *.cc
  • gcc -Wall -Wextra -Wshadow -ansi -pedantic -ggdb -o worker worker.c

… so I may be missing the finer points of what may be possible with gcc command-line params, but I suspect there might be some prior magic in your build process (a ./configure or pkgconfig run) that went arwry. Do you have any log files lying around of prior successful builds for reference?

[Edited to add: I just learned that »-Wl,–as-needed« is a linker flag, nevermind…]

Did you try to actually follow Linux build instructions listed on project home page?

I am building the same was as the other binary addons in the project. It was building fine until 7 days ago, but I cannot find a commit in the GIT that is causing this error. But as I am no developer I think I am overseeing something. That is why I opened this thread.

IMO your problem is the part O highlighted in red
I assume it’s not one of those others that are listed immediately after what I highlighted.
You have to determine if your codec is there or if not why (assuming you don’t have a permissions problem).

TSU

Hi
This is on OBS, building and any permissions issues are not a problem (abuild/abuild), it maybe on install if no buildroot is specified, but not build…

As pointed out, the user has not read the upstream build instructions/requirements which may be part of the issue.

Educated guess - this one: Add workaround for CMake and Frameworks for FFmpeg on Darwin · xbmc/inputstream.ffmpegdirect@14279a3 · GitHub

I went back to the previous version 1.2.1 which is building fine until I found the reason.

I understand,
But was just trying to cover all bases for the type of error whenever it occurs.
Permissions would never be an issue in any dedicated build environment, it only happens for instance building on a private machine that might need to set permissions for different uses.

TSU

I compared CMakeList.txt and FindFFmeg.cmake of the old working version with the current one and created two patches. Now it is building fine.