Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacOS support #61

Open
cconcolato opened this issue Oct 3, 2023 · 10 comments
Open

MacOS support #61

cconcolato opened this issue Oct 3, 2023 · 10 comments
Labels
enhancement New feature or request

Comments

@cconcolato
Copy link
Contributor

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
Copy link
Collaborator

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
Copy link
Collaborator

jwcullen commented Dec 8, 2023

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

@yilun-zhangs
Copy link
Collaborator

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 jwcullen closed this as completed Jan 5, 2024
@jwcullen
Copy link
Collaborator

jwcullen commented Jun 12, 2024

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
Copy link
Contributor

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 ..
  1. 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/
  1. build
$ cmake -DCMAKE_INSTALL_PREFIX=${PWD}/build_libs  -DMULTICHANNEL_BINAURALIZER=OFF -DHOA_BINAURALIZER=OFF .
$ make
$ make install
  1. 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:

  • Maybe want to set -e so the script exits on error
  • VISR is now in a branch of the ebu/bear repo, which has been patched since that release, which helps some things. Can still put it in that folder if you want with git clone -b visr --single-branch https://github.com/ebu/bear.git rd-audio-visr-public-master
  • I wasn't able to successfully use/build boost using the technique of the script, I ran into errors building.
  • I was able to build BEAR/VISR/EAR etc from a brew install boost, so could just encourage that then use CMake's find_package(Boost
  • If -DBUILD_PYTHON_BINDINGS=ON was changed to -DBUILD_PYTHON_BINDINGS=OFF for both VISR and BEAR builds then things are much simpler (no python dependencies) and the pybind section could be removed.
  • I killed the script when something needed sudo.

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
  1. 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
  1. Cloning BEAR
$ cd ~/github_clones
$ git clone https://github.com/ebu/bear.git
$ cd bear
$ git submodule update --init --recursive
$ cd visr_bear
  1. 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()
  1. Build BEAR
cmake -B build . -DBUILD_PYTHON_BINDINGS=OFF
cmake --build build -t install
  1. 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
Copy link
Collaborator

@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
Copy link
Contributor

Okay, great! Looking forward to seeing it

@yilun-zhangs
Copy link
Collaborator

yilun-zhangs commented Jun 20, 2024

@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
Copy link
Collaborator

yilun-zhangs commented Jun 28, 2024

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants