seedhartha / reone

Game engine capable of running KotOR and TSL
GNU General Public License v3.0
271 stars 24 forks source link

failure to build on Manjaro linux(Arch derivative) #47

Closed jimmon89 closed 2 years ago

jimmon89 commented 2 years ago
#make -j$(nproc)

Consolidate compiler generated dependencies of target movie
[  6%] Built target common
[ 10%] Built target audio
[ 15%] Built target gui
[ 24%] Built target scene
[ 60%] Built target script
[ 66%] Built target graphics
[ 69%] Built target resource
[ 70%] Building CXX object src/movie/CMakeFiles/movie.dir/format/bikreader.cpp.o
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::deinit()’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:78:13: error: ‘avcodec_free_context’ was not declared in this scope; did you mean ‘avformat_free_context’?
   78 |             avcodec_free_context(&_audioCodecCtx);
      |             ^~~~~~~~~~~~~~~~~~~~
      |             avformat_free_context
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:81:13: error: ‘avcodec_free_context’ was not declared in this scope; did you mean ‘avformat_free_context’?
   81 |             avcodec_free_context(&_videoCodecCtx);
      |             ^~~~~~~~~~~~~~~~~~~~
      |             avformat_free_context
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::load()’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:100:32: error: invalid use of incomplete type ‘struct AVCodecContext’
  100 |         _width = _videoCodecCtx->width;
      |                                ^~
In file included from /usr/include/libavformat/avformat.h:313,
                 from /home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:31:
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:101:33: error: invalid use of incomplete type ‘struct AVCodecContext’
  101 |         _height = _videoCodecCtx->height;
      |                                 ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::openCodec(int, AVCodecContext**)’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:162:46: error: invalid conversion from ‘const AVCodec*’ to ‘AVCodec*’ [-fpermissive]
  162 |         AVCodec *codec = avcodec_find_decoder(codecParams->codec_id);
      |                          ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
      |                                              |
      |                                              const AVCodec*
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:166:21: error: ‘avcodec_alloc_context3’ was not declared in this scope; did you mean ‘avio_alloc_context’?
  166 |         *codecCtx = avcodec_alloc_context3(codec);
      |                     ^~~~~~~~~~~~~~~~~~~~~~
      |                     avio_alloc_context
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:167:13: error: ‘avcodec_parameters_to_context’ was not declared in this scope; did you mean ‘avcodec_parameters_copy’?
  167 |         if (avcodec_parameters_to_context(*codecCtx, codecParams) != 0) {
      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |             avcodec_parameters_copy
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:170:13: error: ‘avcodec_open2’ was not declared in this scope; did you mean ‘avio_open2’?
  170 |         if (avcodec_open2(*codecCtx, codec, nullptr) != 0) {
      |             ^~~~~~~~~~~~~
      |             avio_open2
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::initFrames()’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:179:80: error: invalid use of incomplete type ‘struct AVCodecContext’
  179 |         int bufSize = av_image_get_buffer_size(AV_PIX_FMT_RGB24, _videoCodecCtx->width, _videoCodecCtx->height, 32);
      |                                                                                ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:179:103: error: invalid use of incomplete type ‘struct AVCodecContext’
  179 |         int bufSize = av_image_get_buffer_size(AV_PIX_FMT_RGB24, _videoCodecCtx->width, _videoCodecCtx->height, 32);
      |                                                                                                       ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:185:27: error: invalid use of incomplete type ‘struct AVCodecContext’
  185 |             _videoCodecCtx->width, _videoCodecCtx->height,
      |                           ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:185:50: error: invalid use of incomplete type ‘struct AVCodecContext’
  185 |             _videoCodecCtx->width, _videoCodecCtx->height,
      |                                                  ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::initScalingContext()’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:191:27: error: invalid use of incomplete type ‘struct AVCodecContext’
  191 |             _videoCodecCtx->width, _videoCodecCtx->height,
      |                           ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:191:50: error: invalid use of incomplete type ‘struct AVCodecContext’
  191 |             _videoCodecCtx->width, _videoCodecCtx->height,
      |                                                  ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:192:27: error: invalid use of incomplete type ‘struct AVCodecContext’
  192 |             _videoCodecCtx->pix_fmt,
      |                           ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:193:27: error: invalid use of incomplete type ‘struct AVCodecContext’
  193 |             _videoCodecCtx->width, _videoCodecCtx->height,
      |                           ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:193:50: error: invalid use of incomplete type ‘struct AVCodecContext’
  193 |             _videoCodecCtx->width, _videoCodecCtx->height,
      |                                                  ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::initResamplingContext()’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:202:65: error: invalid use of incomplete type ‘struct AVCodecContext’
  202 |             AV_CH_LAYOUT_MONO, AV_SAMPLE_FMT_S16, _audioCodecCtx->sample_rate,
      |                                                                 ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:203:27: error: invalid use of incomplete type ‘struct AVCodecContext’
  203 |             _audioCodecCtx->channel_layout, _audioCodecCtx->sample_fmt, _audioCodecCtx->sample_rate,
      |                           ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:203:59: error: invalid use of incomplete type ‘struct AVCodecContext’
  203 |             _audioCodecCtx->channel_layout, _audioCodecCtx->sample_fmt, _audioCodecCtx->sample_rate,
      |                                                           ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:203:87: error: invalid use of incomplete type ‘struct AVCodecContext’
  203 |             _audioCodecCtx->channel_layout, _audioCodecCtx->sample_fmt, _audioCodecCtx->sample_rate,
      |                                                                                       ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::loadVideoFrame(int64_t)’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:229:13: error: ‘avcodec_send_packet’ was not declared in this scope; did you mean ‘avcodec_get_name’?
  229 |             avcodec_send_packet(_videoCodecCtx, &packet);
      |             ^~~~~~~~~~~~~~~~~~~
      |             avcodec_get_name
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:230:24: error: ‘avcodec_receive_frame’ was not declared in this scope; did you mean ‘avcodec_profile_name’?
  230 |             if ((ret = avcodec_receive_frame(_videoCodecCtx, _avFrame)) < 0) {
      |                        ^~~~~~~~~~~~~~~~~~~~~
      |                        avcodec_profile_name
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:241:70: error: invalid use of incomplete type ‘struct AVCodecContext’
  241 |                 _avFrame->data, _avFrame->linesize, 0, _videoCodecCtx->height,
      |                                                                      ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:245:70: error: invalid use of incomplete type ‘struct AVCodecContext’
  245 |             auto pixels = make_shared<ByteArray>(3ll * _videoCodecCtx->width * _videoCodecCtx->height, '\0');
      |                                                                      ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:245:94: error: invalid use of incomplete type ‘struct AVCodecContext’
  245 |             auto pixels = make_shared<ByteArray>(3ll * _videoCodecCtx->width * _videoCodecCtx->height, '\0');
      |                                                                                              ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:246:47: error: invalid use of incomplete type ‘struct AVCodecContext’
  246 |             for (int y = 0; y < _videoCodecCtx->height; ++y) {
      |                                               ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:247:48: error: invalid use of incomplete type ‘struct AVCodecContext’
  247 |                 int dstIdx = 3 * _videoCodecCtx->width * y;
      |                                                ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:249:74: error: invalid use of incomplete type ‘struct AVCodecContext’
  249 |                 memcpy(pixels->data() + dstIdx, src, 3ll * _videoCodecCtx->width);
      |                                                                          ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp: In member function ‘void reone::movie::BinkVideoDecoder::loadAudioStream()’:
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:270:13: error: ‘avcodec_send_packet’ was not declared in this scope; did you mean ‘avcodec_get_name’?
  270 |             avcodec_send_packet(_audioCodecCtx, &packet);
      |             ^~~~~~~~~~~~~~~~~~~
      |             avcodec_get_name
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:271:27: error: ‘avcodec_receive_frame’ was not declared in this scope; did you mean ‘avcodec_profile_name’?
  271 |             while ((ret = avcodec_receive_frame(_audioCodecCtx, _avFrame)) >= 0) {
      |                           ^~~~~~~~~~~~~~~~~~~~~
      |                           avcodec_profile_name
/home/jimmy/Documents/repos/reone/src/movie/format/bikreader.cpp:285:50: error: invalid use of incomplete type ‘struct AVCodecContext’
  285 |                 frame.sampleRate = _audioCodecCtx->sample_rate;
      |                                                  ^~
/usr/include/libavcodec/codec.h:195:8: note: forward declaration of ‘struct AVCodecContext’
  195 | struct AVCodecContext;
      |        ^~~~~~~~~~~~~~
make[2]: *** [src/movie/CMakeFiles/movie.dir/build.make:93: src/movie/CMakeFiles/movie.dir/format/bikreader.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:416: src/movie/CMakeFiles/movie.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

everything else compiled fine

more info available on request

jimmon89 commented 2 years ago

output of cmake

#cmake -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo

-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Boost: /usr/lib64/cmake/Boost-1.78.0/BoostConfig.cmake (found version "1.78.0") found components: filesystem program_options regex system unit_test_framework 
-- Found OpenGL: /usr/lib/libOpenGL.so   
-- Found GLEW: /usr/include (found version "2.2.0") 
MAD library found
-- Found wxWidgets: -pthread;;;-lwx_gtk2u_core-3.0;-lwx_baseu-3.0 (found version "3.0.5") 
-- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.0") 
-- Checking for module 'openal'
--   Found openal, version 1.22.0
-- Checking for module 'sdl2'
--   Found sdl2, version 2.0.22
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Checking for modules 'libavcodec;libavformat;libavutil;libswresample;libswscale'
--   Found libavcodec, version 59.18.100
--   Found libavformat, version 59.16.100
--   Found libavutil, version 57.17.100
--   Found libswresample, version 4.3.100
--   Found libswscale, version 6.4.100
-- Configuring done
-- Generating done
-- Build files have been written to: /home/jimmy/Documents/repos/reone/build
nobodyCloak commented 2 years ago

@jimmon89 I'm not on Manjaro, but I ran into the same issue with macOS. While I couldn't find anything in their documentation or deprecated list that indicates why this worked, for whatever reason when I switched the referenced ffmpeg version from 5.0.1 to 4.4.2 it worked for me.

Granted, I was never able to finish compilation due to a separate issue (ld: library not found for -latomic) but it got me from failing at ~70% to failing at 100%... hopefully it works for you too!

seedhartha commented 2 years ago

Hey. Sorry for late response. Both issues should be fixed now. Had to add #include "libavcodec/avcodec.h" to fix FFmpeg errors and remove -latomic from CMakeLists.txt.