[Linux] build fails: conflicting declaration of SNDFILE, ALCdevice, ALCcontext
castilma opened this issue · comments
Hi,
I'm building on artixlinux (based on arch). I followed the instructions in readme.md (installing dependencies with the script from linux/arch). The build fails:
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 libmpg123
with PKG_CONFIG_LIBDIR=
Compiling OF library for Release
make[1]: Entering directory '/home/mcd/code/stuff/OF/libs/openFrameworksCompiled/project'
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 libmpg123
with PKG_CONFIG_LIBDIR=
HOST_OS=Linux
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal libcurl glfw3 rtaudio libpulse-simple alsa gl glu glew gtk+-3.0 libmpg123
with PKG_CONFIG_LIBDIR=
Compiling /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp
g++ -O3 -march=native -mtune=native -DNDEBUG -Wall -Werror=return-type -std=c++14 -DGCC_HAS_REGEX -DOF_USING_GTK -DOF_USING_GTK -DOF_USING_MPG123 -I/usr/include/cairo -I/usr/include/lzo -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/include/harfbuzz -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/sysprof-4 -I/usr/include/pixman-1 -I/usr/include/gstreamer-1.0 -I/usr/include/orc-0.4 -I/usr/include/opus -I/usr/include/AL -I/usr/include/rtaudio -D_REENTRANT -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cloudproviders -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/at-spi-2.0 -pthread -I/home/mcd/code/stuff/OF/libs/fmodex/include -I/home/mcd/code/stuff/OF/libs/glm/include -I/home/mcd/code/stuff/OF/libs/glm/include/glm -I/home/mcd/code/stuff/OF/libs/glm/include/glm/detail -I/home/mcd/code/stuff/OF/libs/glm/include/glm/gtc -I/home/mcd/code/stuff/OF/libs/glm/include/glm/gtx -I/home/mcd/code/stuff/OF/libs/glm/include/glm/simd -I/home/mcd/code/stuff/OF/libs/json/include -I/home/mcd/code/stuff/OF/libs/kiss/include -I/home/mcd/code/stuff/OF/libs/pugixml/include -I/home/mcd/code/stuff/OF/libs/tess2/include -I/home/mcd/code/stuff/OF/libs/utf8/include -I/home/mcd/code/stuff/OF/libs/utf8/include/utf8 -I/home/mcd/code/stuff/OF/libs/openFrameworks -I/home/mcd/code/stuff/OF/libs/openFrameworks/3d -I/home/mcd/code/stuff/OF/libs/openFrameworks/types -I/home/mcd/code/stuff/OF/libs/openFrameworks/gl -I/home/mcd/code/stuff/OF/libs/openFrameworks/communication -I/home/mcd/code/stuff/OF/libs/openFrameworks/app -I/home/mcd/code/stuff/OF/libs/openFrameworks/math -I/home/mcd/code/stuff/OF/libs/openFrameworks/events -I/home/mcd/code/stuff/OF/libs/openFrameworks/utils -I/home/mcd/code/stuff/OF/libs/openFrameworks/video -I/home/mcd/code/stuff/OF/libs/openFrameworks/sound -I/home/mcd/code/stuff/OF/libs/openFrameworks/graphics -MMD -MP -MF /home/mcd/code/stuff/OF/libs/openFrameworksCompiled/lib/linux64/obj/Release/libs/openFrameworks/sound/ofOpenALSoundPlayer.d -MT/home/mcd/code/stuff/OF/libs/openFrameworksCompiled/lib/linux64/obj/Release/libs/openFrameworks/sound/ofOpenALSoundPlayer.o -o /home/mcd/code/stuff/OF/libs/openFrameworksCompiled/lib/linux64/obj/Release/libs/openFrameworks/sound/ofOpenALSoundPlayer.o -c /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:10:
/usr/include/sndfile.h:356:33: error: conflicting declaration 'typedef struct sf_private_tag SNDFILE'
356 | typedef struct sf_private_tag SNDFILE ;
| ^~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:1:
/home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.h:24:33: note: previous declaration as 'typedef struct SNDFILE_tag SNDFILE'
24 | typedef struct SNDFILE_tag SNDFILE ;
| ^~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:17:
/usr/include/AL/alc.h:34:16: error: using typedef-name 'ALCdevice' after 'struct'
34 | typedef struct ALCdevice ALCdevice;
| ^~~~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:1:
/home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.h:13:33: note: 'ALCdevice' has a previous declaration here
13 | typedef struct ALCdevice_struct ALCdevice;
| ^~~~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:17:
/usr/include/AL/alc.h:34:26: error: conflicting declaration 'typedef int ALCdevice'
34 | typedef struct ALCdevice ALCdevice;
| ^~~~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:1:
/home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.h:13:33: note: previous declaration as 'typedef struct ALCdevice_struct ALCdevice'
13 | typedef struct ALCdevice_struct ALCdevice;
| ^~~~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:17:
/usr/include/AL/alc.h:36:16: error: using typedef-name 'ALCcontext' after 'struct'
36 | typedef struct ALCcontext ALCcontext;
| ^~~~~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:1:
/home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.h:15:34: note: 'ALCcontext' has a previous declaration here
15 | typedef struct ALCcontext_struct ALCcontext;
| ^~~~~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:17:
/usr/include/AL/alc.h:36:27: error: conflicting declaration 'typedef int ALCcontext'
36 | typedef struct ALCcontext ALCcontext;
| ^~~~~~~~~~
In file included from /home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.cpp:1:
/home/mcd/code/stuff/OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.h:15:34: note: previous declaration as 'typedef struct ALCcontext_struct ALCcontext'
15 | typedef struct ALCcontext_struct ALCcontext;
| ^~~~~~~~~~
make[2]: *** [makefileCommon/compile.core.mk:240: /home/mcd/code/stuff/OF/libs/openFrameworksCompiled/lib/linux64/obj/Release/libs/openFrameworks/sound/ofOpenALSoundPlayer.o] Error 1
make[1]: *** [makefileCommon/compile.core.mk:204: Release] Error 2
make[1]: Leaving directory '/home/mcd/code/stuff/OF/libs/openFrameworksCompiled/project'
make: *** [../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:125: Release] Error 2
Hi, the current workaround I found is to use a docker container with ubuntu 16.04 (hoping it was old enough...), arch's packages are just too recent, building on arch and correcting every error probably will take more time than rewriting the entire code...
Edit: Also I needed to downgrade ffmpeg to version 3 (compiling it from source), because once again the dev is using an ancient version.
huh. no clue. but i know for sure that i don't use gstreamer or the openal soundplayer, so if it can be disabled somehow that should also fix it. it's just a standard part of OF.
maybe i'm mistaken, but i think it's a cross platform necessity to use gstreamer and openAL on linux (?)
anyway, partially replying to @castilma, a temporary workaround for that ALCdevice conflict is, according to this thread, to edit the OF file OF/libs/openFrameworks/sound/ofOpenALSoundPlayer.h
changing these lines:
typedef struct ALCdevice_struct ALCdevice;
typedef struct ALCcontext_struct ALCcontext;
into
typedef struct ALCdevice ALCdevice;
typedef struct ALCcontext ALCcontext;
and for the SNDFILE, also from the openframework forum, changing this line:
typedef struct SNDFILE_tag SNDFILE ;
into
typedef struct sf_private_tag SNDFILE;
Problem is, even after doing so, the compilation always fails with this error:
../../../libs/openFrameworksCompiled/project/makefileCommon/config.addons.mk:210: *** missing separator. Stop.
make[1]: Leaving directory '/mnt/data/git/OF/apps/myApps/Oscilloscope'
make: *** [../../../libs/openFrameworksCompiled/project/makefileCommon/compile.project.mk:129: Release] Error 2
so we need to downgrade make, to make (:P) this work: here are the older packages, I installed the oldest.
and for yet another time the compilation continues until another, much bigger problem occur: a buttload of errors, caused by the bleeding edge libavcodec provided by ffmpeg 5.0, when we try to feed it with functions deprecated two years ago... (examples)
here's the compilation error log if @kritzikratzi wants to take a look at it.
in conclusion i guess we are stuck, a solution could be to compile an ancient version of ffmpeg, and include these libraries for compiling Oscilloscope, i'll try maybe.
edit: i noticed this comment got pretty long, and so for answering a pretty obvious question: yes it's been a long time since i started struggling with these issues...
hi!
OF has a bit of a non-standard project structure, and i honestly (at this point) cannot be bothered to make it appear as if it was a standard CI workflow.
the following should work:
- use something like ubuntu 20.04
- grab openframeworks 10.1 from here https://openframeworks.cc/download/older/
- follow the build instructions for openframeworks https://openframeworks.cc/setup/linux-install/
- clone this repo into of_10.1/apps/myApps/Oscilloscope make sure to get all submodules too!
- download the extra binaries for ffmpeg from https://github.com/kritzikratzi/ofxAvCodec/releases and place them in apps/myApps/Oscilloscope/addons/ofxAvCodec/libs/avcodec/
- cd to myApps/Oscilloscope and run
make run
i can't say too much about the troubles you're running into without looking into it myself, but a good test is to test with any of the samples (e.g. of_10.1/examples/sound/audioOutputExample) and see if they compile&run fine. if not, then it doesn't make sense to try building the oscilloscope app at this point.
i already tried it and yes, it works indeed, problem is that any sort of virtualization i can think of will likely impact the performance, or in any case it could be problematic to send audio in real time to this said virtual systems
You can download the ffmpeg and change the includes using grep -rl
and sed -i
. Now I have a problem, where there is no rule to make /usr/include/glib-2.0/glib/gs
Actually no, FFmpeg v0.3 does not include the member codec
in struct AVStream.