gindemit / unity-wrapper-vorbis

Unity3d Vorbis Ogg integration. Saving and loading AudioClip in Vorbis Ogg file format
MIT License
44 stars 4 forks source link

Xcode build error: undefined symbols for architecture x86_64 #1

Closed cabauman closed 4 years ago

cabauman commented 4 years ago

The Xcode project is created successfully after executing the cmake command, but I'm running into the following error when trying to build:

Undefined symbols for architecture x86_64:
  "_vorbis_encode_init_vbr", referenced from:
    _WriteAllPcmDataToFileStream in VorbisPluginEncoder.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Do you happen to know what I might be missing?

gindemit commented 4 years ago

Hi! Thanks for trying out the plugin! I have currently no opportunity to test it out. But if I remember correctly, the "_vorbis_encode_init_vbr" function is defined in the "vorbisenc.c" source file. This source file is included only for WIN32 platform into the plugin (see "Build on Windows for Android operating system" section in the notes for this repository). So to fix this, you need to comment out the if(WIN32) and endif() in the "unity-vorbis\dependency\vorbis\lib\CMakeLists.txt" file. It will look like this:

if(WIN32)

list(APPEND VORBIS_SOURCES vorbisenc.c)

endif()

Hope this helps. Let me please know!

cabauman commented 4 years ago

Thank you for sharing the plugin! It works great. I was originally going to make a Vorbis plugin myself, but finding this gave me a huge head start.

Oh man, what a silly mistake. I followed the CMakeLists instructions for Android on my Windows machine and it worked. But then I cloned a new copy of this repository when I moved to my Mac and forgot to repeat that step. Builds fine now. Thanks again!