kritzikratzi / Oscilloscope

Oscilloscope for Mac/Windows written in OF.

Home Page:https://oscilloscopemusic.com/osci.php

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Linux] Compilation fails due to non-declared flags

DJLevel3 opened this issue · comments

I am compiling the latest version on Linux, and I was having compilation problems that I eventually tracked down to the version of make I was using. I have now downgraded to make 4.2.1, and compilation progresses further but still fails. The errors now seem to be in OsciVideoWriter.cpp. The three errors thrown are:

line 219: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope; did you mean ‘AV_CODEC_FLAG_GLOBAL_HEADER’?

line 427: error: ‘CODEC_FLAG_GLOBAL_HEADER’ was not declared in this scope; did you mean ‘AV_CODEC_FLAG_GLOBAL_HEADER’?

line 483: error: ‘AVFMT_RAWPICTURE’ was not declared in this scope

I have tried replacing the first two with the suggested replacements, and the errors disappeared, but the one on line 483 I cannot figure out how to fix.

Update: I found another application with this problem and their solution was to add sed -i '1s/^/#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22)\n#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER\n#define AVFMT_RAWPICTURE 0x0020\n/' "$(OPENCV_BASENAME)/modules/highgui/src/cap_ffmpeg_impl.hpp" to their makefile. May be relevant.

Update 2: Adding these lines to OsciVideoWriter.cpp just below the ifndef seems to have fixed the problems. I'm now having different errors, so I'm leaving this open for now, but I've progressed!

#define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER
#define AVFMT_RAWPICTURE 0x0020

Aaaand, I seem to have fixed all the errors! To summarize what I did:

  • Add #define CODEC_FLAG_GLOBAL_HEADER AV_CODEC_FLAG_GLOBAL_HEADER and #define AVFMT_RAWPICTURE 0x0020 to OsciVideoWriter.hpp
  • Add #include <cstdio> to LaserdockDeviceManager.h

thanks for your findings! i haven't yet tried to build on linux. is this with a custom ffmpeg, or the system ffmpeg?

I didn't supply any ffmpeg, so I believe it was the system one or the included one if that exists. By the way, the build completed, but audio files are now playing extremely quickly for some reason.

Scratch that, I just relaunched the application and it's working!

happy (and suprised) to hear this works with your ffmpeg version. i'm leaving this bug up open until i've made my own linux build uploaded it.

I can send you the build I have completed if you have the stuff to test it. Should(tm) be working fine.

Or you can do it on WSL if you have a Windows PC.

I didn't supply any ffmpeg, so I believe it was the system one or the included one if that exists. By the way, the build completed, but audio files are now playing extremely quickly for some reason.

I just realized, I did the recursive clone as instructed in the Linux build instructions, so if ffmpeg is included there then I think it used that one.

only the heaeders are in the repo, but if you didn't take any extra steps there are no binaries.

As far as I can tell the build doesn't work with ffmpeg 5, it says that AVStream doesn't have the member codec. I am not sure how to change the version of ffmpeg, other programs depend on it so i can't downgrade system-wide, and I am not sure how to make it use a different binary.

here are the ffmpeg binaries i'm using: https://github.com/kritzikratzi/ofxAvCodec/releases/tag/0.3
they contain my own tiny patches to ffmpeg, and also the cisco openh264 libraries.

hope it helps. you'll have to google everything else, but LD_LIBRARY_PATH, rpath and patchelf are things you may or may not need :)

ps. also: i was always against ffmpeg as a system wide dependency don't want to use ffmpeg as a system wide dependency, as i don't have the time to change my code every.

if you feel like biting the bullet please try a PR, i'd be happy to assist a bit :)

PR in! Turns out I had some stuff totally wrong in how I was fixing it, retried with more accurate fixes and created a PR! There's also a PR out for ofxLiblaserdock and an issue out for ofxNative.