olive-editor / olive

Free open-source non-linear video editor
https://olivevideoeditor.org/
GNU General Public License v3.0
8.27k stars 559 forks source link

[BUILD] compile error in oiioutils.cpp #1379

Closed jarro2783 closed 4 years ago

jarro2783 commented 4 years ago

Commit Hash afbd3ada3696bdef608c547bd1dd5d3a7e806e3b

Platform Gentoo

Summary I get a compile error as follows:

FAILED: app/CMakeFiles/olive-editor.dir/common/oiioutils.cpp.o 
/usr/bin/c++  -DAPPVERSION=\"0.2.0\" -DGITHASH=\"afbd3ada\" -DQT_CONCURRENT_LIB -DQT_CORE_LIB -DQT_DEPRECATED_WARNINGS -DQT_GUI_LIB -DQT_MULTIMEDIA_LIB -DQT_NETWORK_LIB -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_SVG_LIB -DQT_WIDGETS_LIB -Iapp -I../app -Iapp/olive-editor_autogen/include -I/usr/include/OpenEXR -isystem /usr/include/qt5 -isystem /usr/include/qt5/QtCore -isystem /usr/lib64/qt5/mkspecs/linux-g++ -isystem /usr/include/qt5/QtGui -isystem /usr/include/qt5/QtWidgets -isystem /usr/include/qt5/QtMultimedia -isystem /usr/include/qt5/QtNetwork -isystem /usr/include/qt5/QtOpenGL -isystem /usr/include/qt5/QtSvg -isystem /usr/include/qt5/QtConcurrent -Werror -Wuninitialized -pedantic-errors -Wall -Wextra -Wno-unused-parameter -Wshadow -fPIC -std=c++11 -MD -MT app/CMakeFiles/olive-editor.dir/common/oiioutils.cpp.o -MF app/CMakeFiles/olive-editor.dir/common/oiioutils.cpp.o.d -o app/CMakeFiles/olive-editor.dir/common/oiioutils.cpp.o -c ../app/common/oiioutils.cpp
../app/common/oiioutils.cpp: In static member function ‘static void olive::OIIOUtils::FrameToBuffer(const olive::Frame*, OpenImageIO_v1_8::ImageBuf*)’:
../app/common/oiioutils.cpp:33:41: error: ‘PixelFormat’ has not been declared
   33 |   int width_in_bytes = frame->width() * PixelFormat::BytesPerPixel(frame->format());
      |                                         ^~~~~~~~~~~
../app/common/oiioutils.cpp:42:23: error: passing ‘const olive::Frame’ as ‘this’ argument discards qualifiers [-fpermissive]
   42 |           frame->data() + i * frame->linesize_bytes(),
      |                       ^
In file included from ../app/common/oiioutils.h:27,
                 from ../app/common/oiioutils.cpp:21:
../app/codec/frame.h:103:9: note:   in call to ‘char* olive::Frame::data()’
  103 |   char* data()
      |         ^~~~
../app/common/oiioutils.cpp: In static member function ‘static void olive::OIIOUtils::BufferToFrame(OpenImageIO_v1_8::ImageBuf*, olive::Frame*)’:
../app/common/oiioutils.cpp:62:41: error: ‘PixelFormat’ has not been declared
   62 |   int width_in_bytes = frame->width() * PixelFormat::BytesPerPixel(frame->format());
      |  

Additional Information / Output

elsandosgrande commented 4 years ago

Could you share your make.conf as well as tell us which compiler and which version of it you're using?

ThomasWilshaw commented 4 years ago

@jarro2783 What OIIO library version are you using?

elsandosgrande commented 4 years ago

@ThomasWilshaw https://packages.gentoo.org/packages/media-libs/openimageio

jarro2783 commented 4 years ago

openimageio-1.8.17-r2

# g++ --version
g++ (Gentoo 9.3.0-r1 p3) 9.3.0

I don't see any make.conf.

elsandosgrande commented 4 years ago

@jarro2783 https://wiki.gentoo.org/wiki//etc/portage/make.conf

You did say that you're running Gentoo.

Simran-B commented 4 years ago

I had a similar issue regarding PixelFormat on Windows. An update to OIIO 2.1.16 helped.

jarro2783 commented 4 years ago

Oh that make.conf, got it.

# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-O2 -pipe -mtune=nehalem -march=nehalem"
#CFLAGS="-O2 -pipe" 
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-pc-linux-gnu"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
USE="X a52 aac acpi alsa apache2 apm bash-completion bzip2 cairo cdda cddb cdr cdparanoia cjk crypt css ctype cups curl cxx dbus dga directfb djvu dri dvb dvd dvdr encode ffmpeg fftw flac fontconfig ftp gd gdu gimp glut gmp gnome-keyring gnuplot gnutls gphoto2 graphviz gsl gsm gstreamer gtk gtk3 http2 iconv icu imagemagick ipv6 jack jpeg jpeg2k kpathsea lame latex libnotify lm_sensors lzma mad mmx mng mp3 mp4 mpeg mysql ncurses -networkmanager nsplugin ogg openal opengl openmp pdf php png policykit python qt3support readline smp spell sqlite sqlite3 sse sse2 ssl svg systemd tiff truetype unicode usb v4l v4l2 vaapi vdpau vim-syntax vorbis wavpack widevine win32codecs x264 xetex xinerama xinetd xml xvid -libav -consolekit pulseaudio -bluetooth"

CPU_FLAGS_X86="mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"

INPUT_DEVICES="evdev"
VIDEO_CARDS="nvidia"

MAKEOPTS="-j9"

#GENTOO_MIRRORS="http://liebre/gentoo http://mirror.cse.unsw.edu.au/pub/gentoo/ http://ftp.swin.edu.au/gentoo ftp://ftp.swin.edu.au/gentoo"

ACCEPT_LICENSE="* -@EULA AdobeFlash-11.x skype-4.0.0.7-copyright PUEL google-chrome NVIDIA-CUDA ut2003"

FEATURES="parallel-fetch splitdebug"

PYTHON_TARGETS="python3_6 python3_7 python2_7"
PYTHON_SINGLE_TARGET="python3_6"

PORTDIR_OVERLAY="/usr/local/portage/overlay"
source /var/lib/layman/make.conf

# Set PORTDIR for backward compatibility with various tools:
#   gentoo-bashcomp - bug #478444
#   euse - bug #474574
#   euses and ufed - bug #478318
#PORTDIR="/usr/portage"

PORTAGE_TMPDIR="/home/portagetmp"

I can't even work out where PixelFormat is declared. Do I need to be using a later version of openimageio?

ThomasWilshaw commented 4 years ago

~For some reason I can't include pixelformat.h in the file.~ Ignore this, I was looking at an old commit of the repo sorry

Simran-B commented 4 years ago

Do I need to be using a later version of openimageio?

I believe so. That would also explain why you can't find it in your current version.

elsandosgrande commented 4 years ago

Do I need to be using a later version of openimageio?

I believe so. That would also explain why you can't find it in your current version.

packages.gentoo.org says that the version is 2.2.8. Is that new enough?

jarro2783 commented 4 years ago

I might just have to update something. Although olive should probably require a much higher version than it currently does.

Simran-B commented 4 years ago

I wonder if this is coming from FFmpeg, which renamed it to AVPixelFormat in 2012:

https://github.com/FFmpeg/FFmpeg/blob/dbd4254a614012ca36d75800eb9a7525742a6144/doc/APIchanges#L1921

ThomasWilshaw commented 4 years ago

The workaround code in oiioutils.cpp for old versions of OIIO is currently broken. It's not been updated to work with render-singleton

elsandosgrande commented 4 years ago

:thinking:

The version which I have from a PPA which provides Blender Alpha is apparently 2.1.19, yet I'm not seeing these compilation errors. I compiled Olive today, that same commit in fact: Screenshot from 2020-11-19 00-08-19

itsmattkc commented 4 years ago

Yeah @ThomasWilshaw is right, the code that's ifdefd for older versions of OIIO hasn't been updated as the code's changed around it (since we all have newer versions, we've never triggered those bits of code).

A theoretically simple fix, but we should probably just increase the minimum version to reduce the code workload. 1.6 (the current minimum) is pretty old by this point.

ThomasWilshaw commented 4 years ago

I've got a fix (although I can't test it properly). Do you want a PR or just to increase the minimum version?

itsmattkc commented 4 years ago

I guess PR for now and we can discuss bumping the minimum version later - I haven't pinpointed a version to set as the minimum yet

jarro2783 commented 4 years ago

Well I can confirm that 2.2.8 works fine.

elsandosgrande commented 4 years ago

@jarro2783 Was something else out of date? I mean, your OpenImageIO version is higher than mine (2.2.8.0 is the only one available on Gentoo from what I can tell; I haven't used Gentoo in a while due to certain circumstances :sweat_smile:), so I already suspected that something else was at fault (I even checked the USE flags and they're all fine, though I would suggest that you enable jpeg2k and raw in case you ever have the need to use such image formats in Olive).

jarro2783 commented 4 years ago

These are the only things that updated just then:

[ebuild  N     ] media-libs/libde265-1.0.5::gentoo  USE="-debug -dec265 -enc265 -sdl -static-libs -tools" ABI_X86="(64) -32 (-x32)" CPU_FLAGS_X86="sse4_1" 373 KiB
[ebuild  N     ] dev-cpp/robin-map-0.6.3::gentoo  63 KiB
[ebuild  N     ] media-libs/x265-3.4:0/192::gentoo  USE="10bit 12bit -numa -pic -test" ABI_X86="(64) -32 (-x32)" 1,435 KiB
[ebuild  N     ] media-libs/libheif-1.9.1:0/1.9::gentoo  USE="threads -gdk-pixbuf -go -static-libs -test" ABI_X86="(64) -32 (-x32)" 1,520 KiB
[ebuild     U  ] media-libs/openimageio-2.2.8.0:0/2.2::gentoo [1.8.17-r2:0/0::gentoo] USE="ffmpeg jpeg2k opengl truetype (-dicom) -doc -field3d -gif -opencv -openvdb% -ptex (-python*) -qt5 -raw (-color-management%) (-libressl%) (-ssl%*)" CPU_FLAGS_X86="sse2 sse3 sse4_1 sse4_2 ssse3 -aes% -avx -avx2 -avx512f -f16c" PYTHON_SINGLE_TARGET="python3_6 -python3_7 -python3_8% -python3_9%" 28,518 KiB
elsandosgrande commented 4 years ago
[…] media-libs/openimageio-2.2.8.0:0/2.2::gentoo [1.8.17-r2:0/0::gentoo] […]

@jarro2783 If my memory of Portage serves, that means that you were on a way-too-old version of OpenImageIO after all.

jarro2783 commented 4 years ago

I updated a few weeks ago, so this version has been updated pretty recently in Gentoo.

elsandosgrande commented 4 years ago

Oh.