Skip to content

Cannot build decord on MAC silicon #351

@Yahampath

Description

@Yahampath

System:
MAC M3 PRO MAX

I have tried to build dmic/decord v0.6.0 on Mac using the below steps.

# Create the environment with python and numpy (a common dependency)
conda create -n decord_build python=3.10 numpy
# Activate the environment
conda activate decord_build
git clone --recursive https://github.com/dmlc/decord
cd decord
mkdir build
cd build
cmake ..
# This command uses 4 cores. You can adjust the number.
make -j4

Then I got the below error and couldn't resolve it, but it seems to be an import path issue.

[ 14%] Building CXX object CMakeFiles/decord.dir/src/runtime/c_runtime_api.cc.o
[ 14%] Building CXX object CMakeFiles/decord.dir/src/runtime/cpu_device_api.cc.o
[ 14%] Building CXX object CMakeFiles/decord.dir/src/audio/audio_reader.cc.o
[ 14%] Building CXX object CMakeFiles/decord.dir/src/audio/audio_interface.cc.o
In file included from In file included from /Users/user/python-projects/decord/src/audio/audio_reader.cc/Users/user/python-projects/decord/src/audio/audio_interface.cc::55:
:
In file included from In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h/Users/user/python-projects/decord/src/audio/audio_reader.h::1010:
:
In file included from In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h/Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h::99:
:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:5: error: /Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:5unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?: 
error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
    187187 |  |     AVBSFContext, Deleterp<AVBSFContext,  void, av_bs  f A_Vfree> >;
      |     ^~~~~~~~~~~~
      |     AVIOContext
BSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |     ^~~~~~~~~~~~
      |     AVIOContext
/opt/homebrew/include/libavformat/avio.h:307:/opt/homebrew/include/libavformat/avio.h:307:3: 3: note: note: 'AVIOContext' declared here
'AVIOContext' declared here
  307 | } A  V307I | O}C oAnVtIeOxCto;nt
e      x| t;  ^

      |   ^
In file included from In file included from /Users/user/python-projects/decord/src/audio/audio_interface.cc/Users/user/python-projects/decord/src/audio/audio_reader.cc::55:
:
In file included from In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h/Users/user/python-projects/decord/src/audio/audio_reader.h::1010:
:
In file included from In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h/Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h::99:
:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h::187187::2828::  error: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?

    187187 |  |         AVBSFConAtVeBxStF,C oDnetleextte,r pD<eAlVeBtSeFrCpo<nAtVeBxStF,C onvtoeixdt,,  avvo_ibdsf,_ farve_eb>s f>;
_free>      |                            ^~~~~~~~~~~~ >;

      |       |                            ^~~~~~~~~~~~
                           AVIOContext
      |                            AVIOContext/opt/homebrew/include/libavformat/avio.h:307:
3: note: 'AVIOContext' declared here
/opt/homebrew/include/libavformat/avio.h:307:3: note: 'AVIOContext' declared here
  307 | } AVIOContext;  307
 |       }|  A  ^V
IOContext;
      |   ^
In file included from In file included from /Users/user/python-projects/decord/src/audio/audio_interface.cc/Users/user/python-projects/decord/src/audio/audio_reader.cc::55:
:
In file included from In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h/Users/user/python-projects/decord/src/audio/audio_reader.h::1010:
:
In file included from In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h/Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h::99:
:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h::187187::4848::  error: error: use of undeclared identifier 'av_bsf_free'; did you mean 'av_opt_free'?use of undeclared identifier 'av_bsf_free'; did you mean 'av_opt_free'?

  187 |     AVBSFContext, Del  eter187p | <    AVBSFConAVBSFConttext,e xDte,l etveoripd<A,V BaSvF_Cbosnft_efxrte,e > v>o;id
, a      |                                                ^~~~~~~~~~~
v_bsf      _| fr                                               av_opt_freee
e> >;
      |                                                ^~~~~~~~~~~
      |                                                av_opt_free
/opt/homebrew/include/libavutil/opt.h:576:6: note: 'av_opt_free' declared here
/opt/homebrew/include/libavutil/opt.h:576:6: note: 'av_opt_free' declared here
  576 | void av_opt_  f576r | eev(oivdoi dav _*oopbtj_)f;re
e      (| v     ^o
id *obj);
      |      ^
In file included from In file included from /Users/user/python-projects/decord/src/audio/audio_interface.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h/Users/user/python-projects/decord/src/audio/audio_reader.cc::105:
:
In file included from In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h/Users/user/python-projects/decord/src/audio/audio_reader.h::910:
:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h/Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h::1879::
48:/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h :187:error: 48: non-type template argument of type 'void (void *)' cannot be converted to a value of type 'void (*)(AVIOContext **)'
error: non-type template argument of type 'void (void *)' cannot be converted to a value of type 'void (*)(AVIOContext **)'
  187 |     AVBSF  C187o | n t e x tA,V BDSeFlCeotnetrepx<tA,V BDSeFlCetoenrtpe<xAtV,B SFvoid, av_bsf_Cfornetee>x t>,; 
v      o| id                                               ^~~~~~~~~~~
, av_bsf_free> >;
      |                                                ^~~~~~~~~~~
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:72/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:72::3737::  note: note: template parameter is declared heretemplate parameter is declared here

      7272 |  | tteemmppllaattee<<ttyyppeennaammee  TT,,  ttyyppeennaammee  RR,,  RR((**FFnn))((TT****))>>  ssttrruucctt  DDeleteerlpe t{er
p       | {                                    ^

      |                                     ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:131:52: error: no member named 'channels' in 'AVCodecParameters'
  131 |                 numChannels = tempCodecParameters->channels;
      |                               ~~~~~~~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:151:13: warning: 'avcodec_close' is deprecated [-Wdeprecated-declarations]
  151 |             avcodec_close(pCodecContext);
      |             ^
/opt/homebrew/include/libavcodec/avcodec.h:2397:1: note: 'avcodec_close' has been explicitly marked deprecated here
 2397 | attribute_deprecated
      | ^
/opt/homebrew/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
  100 | #    define attribute_deprecated __attribute__((deprecated))
      |                                                 ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:212:9: warning: 'avcodec_close' is deprecated [-Wdeprecated-declarations]
  212 |         avcodec_close(pCodecContext);
      |         ^
/opt/homebrew/include/libavcodec/avcodec.h:2397:1: note: 'avcodec_close' has been explicitly marked deprecated here
 2397 | attribute_deprecated
      | ^
/opt/homebrew/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
  100 | #    define attribute_deprecated __attribute__((deprecated))
      |                                                 ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:230:99: error: no member named 'channel_layout' in 'AVFrame'
  230 |         int outNumChannels = av_get_channel_layout_nb_channels(mono ? AV_CH_LAYOUT_MONO : pFrame->channel_layout);
      |                                                                                           ~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:279:28: error: no member named 'channel_layout' in 'AVCodecContext'
  279 |         if (pCodecContext->channel_layout == 0) {
      |             ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:280:28: error: no member named 'channel_layout' in 'AVCodecContext'
  280 |             pCodecContext->channel_layout = av_get_default_channel_layout( pCodecContext->channels );
      |             ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:280:91: error: no member named 'channels' in 'AVCodecContext'
  280 |             pCodecContext->channel_layout = av_get_default_channel_layout( pCodecContext->channels );
      |                                                                            ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:282:83: error: no member named 'channel_layout' in 'AVCodecContext'
  282 |         av_opt_set_channel_layout(this->swr, "in_channel_layout",  pCodecContext->channel_layout, 0);
      |                                                                    ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:283:110: error: no member named 'channel_layout' in 'AVCodecContext'
  283 |         av_opt_set_channel_layout(this->swr, "out_channel_layout", mono ? AV_CH_LAYOUT_MONO : pCodecContext->channel_layout,  0);
      |                                                                                               ~~~~~~~~~~~~~  ^
2 warnings and 11 errors generated.
make[2]: *** [CMakeFiles/decord.dir/src/audio/audio_reader.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
4 errors generated.
make[2]: *** [CMakeFiles/decord.dir/src/audio/audio_interface.cc.o] Error 1
make[1]: *** [CMakeFiles/decord.dir/all] Error 2
make: *** [all] Error 2
(decord_build) yahampath@Lahirus-MacBook-Pro build % make -j4
[ 14%] Building CXX object CMakeFiles/decord.dir/src/audio/audio_reader.cc.o
[ 14%] Building CXX object CMakeFiles/decord.dir/src/runtime/file_util.cc.o
[ 14%] Building CXX object CMakeFiles/decord.dir/src/audio/audio_interface.cc.o
[ 14%] Building CXX object CMakeFiles/decord.dir/src/runtime/dso_module.cc.o
In file included from /Users/user/python-projects/decord/src/audio/audio_interface.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:5: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |     ^~~~~~~~~~~~
      |     AVIOContext
/opt/homebrew/include/libavformat/avio.h:307:3: note: 'AVIOContext' declared here
  307 | } AVIOContext;
      |   ^
In file included from /Users/user/python-projects/decord/src/audio/audio_interface.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:28: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                            ^~~~~~~~~~~~
      |                            AVIOContext
/opt/homebrew/include/libavformat/avio.h:307:3: note: 'AVIOContext' declared here
  307 | } AVIOContext;
      |   ^
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:5: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |     ^~~~~~~~~~~~
      |     AVIOContext
/opt/homebrew/include/libavformat/avio.h:307:3: note: 'AVIOContext' declared here
  307 | } AVIOContext;
      |   ^
In file included from /Users/user/python-projects/decord/src/audio/audio_interface.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:48: error: use of undeclared identifier 'av_bsf_free'; did you mean 'av_opt_free'?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                                                ^~~~~~~~~~~
      |                                                av_opt_free
/opt/homebrew/include/libavutil/opt.h:576:6: note: 'av_opt_free' declared here
  576 | void av_opt_free(void *obj);
      |      ^
In file included from /Users/user/python-projects/decord/src/audio/audio_interface.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:48: error: non-type template argument of type 'void (void *)' cannot be converted to a value of type 'void (*)(AVIOContext **)'
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                                                ^~~~~~~~~~~
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:72:37: note: template parameter is declared here
   72 | template<typename T, typename R, R(*Fn)(T**)> struct Deleterp {
      |                                     ^
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:28: error: unknown type name 'AVBSFContext'; did you mean 'AVIOContext'?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                            ^~~~~~~~~~~~
      |                            AVIOContext
/opt/homebrew/include/libavformat/avio.h:307:3: note: 'AVIOContext' declared here
  307 | } AVIOContext;
      |   ^
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:48: error: use of undeclared identifier 'av_bsf_free'; did you mean 'av_opt_free'?
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                                                ^~~~~~~~~~~
      |                                                av_opt_free
/opt/homebrew/include/libavutil/opt.h:576:6: note: 'av_opt_free' declared here
  576 | void av_opt_free(void *obj);
      |      ^
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.cc:5:
In file included from /Users/user/python-projects/decord/src/audio/audio_reader.h:10:
In file included from /Users/user/python-projects/decord/src/audio/../../include/decord/audio_interface.h:9:
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:187:48: error: non-type template argument of type 'void (void *)' cannot be converted to a value of type 'void (*)(AVIOContext **)'
  187 |     AVBSFContext, Deleterp<AVBSFContext, void, av_bsf_free> >;
      |                                                ^~~~~~~~~~~
/Users/user/python-projects/decord/src/audio/../../include/decord/../../src/video/ffmpeg/ffmpeg_common.h:72:37: note: template parameter is declared here
   72 | template<typename T, typename R, R(*Fn)(T**)> struct Deleterp {
      |                                     ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:131:52: error: no member named 'channels' in 'AVCodecParameters'
  131 |                 numChannels = tempCodecParameters->channels;
      |                               ~~~~~~~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:151:13: warning: 'avcodec_close' is deprecated [-Wdeprecated-declarations]
  151 |             avcodec_close(pCodecContext);
      |             ^
/opt/homebrew/include/libavcodec/avcodec.h:2397:1: note: 'avcodec_close' has been explicitly marked deprecated here
 2397 | attribute_deprecated
      | ^
/opt/homebrew/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
  100 | #    define attribute_deprecated __attribute__((deprecated))
      |                                                 ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:212:9: warning: 'avcodec_close' is deprecated [-Wdeprecated-declarations]
  212 |         avcodec_close(pCodecContext);
      |         ^
/opt/homebrew/include/libavcodec/avcodec.h:2397:1: note: 'avcodec_close' has been explicitly marked deprecated here
 2397 | attribute_deprecated
      | ^
/opt/homebrew/include/libavutil/attributes.h:100:49: note: expanded from macro 'attribute_deprecated'
  100 | #    define attribute_deprecated __attribute__((deprecated))
      |                                                 ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:230:99: error: no member named 'channel_layout' in 'AVFrame'
  230 |         int outNumChannels = av_get_channel_layout_nb_channels(mono ? AV_CH_LAYOUT_MONO : pFrame->channel_layout);
      |                                                                                           ~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:279:28: error: no member named 'channel_layout' in 'AVCodecContext'
  279 |         if (pCodecContext->channel_layout == 0) {
      |             ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:280:28: error: no member named 'channel_layout' in 'AVCodecContext'
  280 |             pCodecContext->channel_layout = av_get_default_channel_layout( pCodecContext->channels );
      |             ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:280:91: error: no member named 'channels' in 'AVCodecContext'
  280 |             pCodecContext->channel_layout = av_get_default_channel_layout( pCodecContext->channels );
      |                                                                            ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:282:83: error: no member named 'channel_layout' in 'AVCodecContext'
  282 |         av_opt_set_channel_layout(this->swr, "in_channel_layout",  pCodecContext->channel_layout, 0);
      |                                                                    ~~~~~~~~~~~~~  ^
/Users/user/python-projects/decord/src/audio/audio_reader.cc:283:110: error: no member named 'channel_layout' in 'AVCodecContext'
  283 |         av_opt_set_channel_layout(this->swr, "out_channel_layout", mono ? AV_CH_LAYOUT_MONO : pCodecContext->channel_layout,  0);
      |                                                                                               ~~~~~~~~~~~~~  ^
2 warnings and 11 errors generated.
make[2]: *** [CMakeFiles/decord.dir/src/audio/audio_reader.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
4 errors generated.
make[2]: *** [CMakeFiles/decord.dir/src/audio/audio_interface.cc.o] Error 1
make[1]: *** [CMakeFiles/decord.dir/all] Error 2
make: *** [all] Error 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions