AOMediaCodec / libiamf

Reference Software for IAMF
BSD 3-Clause Clear License
32 stars 12 forks source link

MacOS support #61

Open cconcolato opened 11 months ago

cconcolato commented 11 months ago

I tried compiling on MacOS and couldn't get it to work, some error about io.h not being found. Is MacOS supported? I suggest adding supported platforms explicitly to the README.

kr728-kim commented 11 months ago

We are working to ensure that the IAMF decoder supports MacOS. The IAMF decoder has dependent libraries that need to be checked and are being checked.

jwcullen commented 9 months ago

Does this build on MacOS now? We still should update the README.

yilun-zhangs commented 8 months ago

Does this build on MacOS now? We still should update the README. Yes, in #65 , it has fixed MacOS compile error, and I have updated README in #75

jwcullen commented 2 months ago

Re-opening this because we should make sure it builds in CI with standard features. At least it should build with both binaural libraries and any supported codecs.

trevorknight commented 2 months ago

I have been trying to build with codecs and renderers on MacOs and wanted to just share some tips and troubles.

Building with codecs but without renderers

I was able to build without binaural renders but with AAC/Flac/Opus codecs with the following technique

  1. Install homebrew
  2. Install $ brew install cmake opus fdk-aac flac
  3. Clone libiamf
  4. Delete the contents of libiamf/code/dep_codecs/lib/
    cd libiamf/code/dep_codecs/lib/
    rm *
    cd ..
  5. Copy the libs
    $ cp /opt/homebrew/opt/flac/lib/* ./dep_codecs/lib/
    $ cp /opt/homebrew/opt/fdk-aac/lib/* ./dep_codecs/lib/
    $ cp /opt/homebrew/opt/opus/lib/* ./dep_codecs/lib/
  6. build
    $ cmake -DCMAKE_INSTALL_PREFIX=${PWD}/build_libs  -DMULTICHANNEL_BINAURALIZER=OFF -DHOA_BINAURALIZER=OFF .
    $ make
    $ make install
  7. Make iamfdec

    $ cd test/tools/iamfdec
    $ cmake -DCMAKE_INSTALL_PREFIX=${PWD}/../../../build_libs  -DMULTICHANNEL_BINAURALIZER=OFF -DHOA_BINAURALIZER=OFF .
    $ make
    

Issues trying to build with renderers

For code/dep_external/src/binaural/build.sh:

Ignoring code/dep_external/src/binaural/build.sh, I was able to build Resonance and Bear with dependencies with this technique:

  1. $ brew install cmake opus fdk-aac flac boost

  2. Create a folders for builds and for repo clones

    $ cd ~
    $ mkdir -p libiamf_deps/bear
    $ export CMAKE_INSTALL_PREFIX=$PWD/libiamf_deps/bear/
    $ export CMAKE_PREFIX_PATH=$PWD/libiamf_deps/bear/
    $ mkdir github_clones && cd github_clones
  3. Starting with VISR

    $ git clone -b visr --single-branch https://github.com/ebu/bear.git visr
    $ cd visr
    $ cmake -B build . -DBUILD_PYTHON_BINDINGS=OFF -DBUILD_DOCUMENTATION=OFF -DBUILD_AUDIOINTERFACES_PORTAUDIO=OFF -DBUILD_USE_SNDFILE_LIBRARY=OFF
    $ cmake --build build -t install
  4. Cloning BEAR

    $ cd ~/github_clones
    $ git clone https://github.com/ebu/bear.git
    $ cd bear
    $ git submodule update --init --recursive
    $ cd visr_bear
  5. In visr_bear/CMakeLists.txt, I had to remove this section as there were build errors in the unit tests

    if(BEAR_UNIT_TESTS)
    include(CTest)
    add_subdirectory(test)
    endif()
  6. Build BEAR

    cmake -B build . -DBUILD_PYTHON_BINDINGS=OFF
    cmake --build build -t install
  7. Resonance

    cd ~
    mkdir -p libiamf_deps/resonance/
    export CMAKE_INSTALL_PREFIX=$PWD/libiamf_deps/resonance/
    export CMAKE_PREFIX_PATH=$PWD/libiamf_deps/resonance/
    cd ~/github_clones
    git clone https://github.com/resonance-audio/resonance-audio
    cd resonance-audio
    ./third_party/clone_core_deps.sh
    1. I then had to update the C++ version for Resonance because of the newer version of xsimd that uses C++14 features. So in CMakeLists.txt change set(CMAKE_CXX_STANDARD 11) to set(CMAKE_CXX_STANDARD 17) (14 probably works too)

    2. Build Resonance

      $ ./build.sh -t=RESONANCE_AUDIO_API -p=Release

And then I got stuck building iamf2bear.

$ cd ~/github_clones
$ git clone https://github.com/AOMediaCodec/libiamf
$ cd1 libiamf/code
$ cd dep_codecs/lib/
$ rm *
$ cd ../..
$ cd ~
$ export CMAKE_INSTALL_PREFIX=$PWD/libiamf_deps/bear/
$ cd github_clones/libiamf/code/dep_external/src/binaural/iamf2bear/
$ cmake .
$ make

For some reason make was not resolving the includes properly despite these lines in code/dep_external/src/binaural/iamf2bear/CMakeLists.txt

set(CODEC_INCLUDE_DIR  "${CMAKE_INSTALL_PREFIX}/include")

include_directories(
    ${CODEC_INCLUDE_DIR}
)

And I ran out of enthusiasm.

I hope this helps someone else trying to build or helps make changes to the build.sh.

yilun-zhangs commented 2 months ago

@trevorknight Thanks for your great efforts to compile externals, actually, we have made some changes to build.sh at local side, to let it work more efficiently. Now it it works under linux with only one step. We will try macOS as well.

trevorknight commented 2 months ago

Okay, great! Looking forward to seeing it

yilun-zhangs commented 2 months ago

@trevorknight Thanks for your valuable suggestions again, it help me a lot prepare the PR. Bear depends on too many other libraries, I need to make some modification. I have submitted #110 to make the binaural compile more efficient, I will share the steps.

  1. Compile dep_codecs. $ cd dep_codecs $ ./build.sh

  2. Compile dep_external(binaural libraries) Please install boost firstly, please refer to dep_external/src/binaural/README.md in PR #110 Because of network issue, default.tf downloading maybe failed, but it dose not affect the building, so pleaes remove 'set -e' in build.sh $ cd dep_external/src/binaural/ $ ./build.sh

  3. Compile libiamf $ cd code $ ./build.sh

I hope this change could help you, if are there any issue, please feel free to let me know. I'd always like to hear your opinions.

Thanks

yilun-zhangs commented 2 months ago

I don't know why the previous PR #110 is merged after PR111 is merged, but the patch seems be covered by PR111, so I create another #112

trevorknight commented 2 months ago

Okay, I'll give it another try and let you know! Thank you very much