gindemit / unity-wrapper-vorbis

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

Not working on Unity Editor with Macbook Pro M1 #6

Open elic-sightful opened 3 months ago

elic-sightful commented 3 months ago

I'm trying this in a project running in Android, and it is working correctly there.

However, on my Unity Editor, I'm getting this error: DllNotFoundException: VorbisPlugin assembly:<unknown assembly> type:<unknown type> member:(null)

Tried putting in different locations, adding an assembly definition, but nothing helped.

I'm thinking it might be that the binaries are compiled for Intel processors (since the readme states it was tested on those), and that's why it's failing to load.

So to test this, I'm trying to compile from sources as well, but getting problems there as well:

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

** BUILD FAILED **

The following build commands failed:
    Ld /Users/eliasc/Stuff/unity-wrapper-vorbis/projects/CMake/buildOSX/VorbisPluginBuild/Release/libVorbisPlugin.dylib normal (in target 'VorbisPlugin' from project 'VorbisPlugin')
(1 failure)
zhangxiaojun92 commented 2 months ago

Hi there,

I'm experiencing the same issue as described here. Have you found a solution yet? Any help or updates would be greatly appreciated!

Thanks!

elic-sightful commented 2 months ago

I didn't find any solution, had to give up using it.

zhangxiaojun92 commented 2 months ago

I found solution.

  1. add target_link_libraries(VorbisPlugin ${CMAKE_CURRENT_BINARY_DIR}/vorbis_build/lib/Release/libvorbisenc.a) to projects/CMake/CMakeLists.txt
  2. cmake -S . -B ./buildOSX -G Xcode -DVORBIS_OSX=1 -DCMAKE_OSX_ARCHITECTURES=arm64
  3. cmake --build ./buildOSX --config Release

Good luck.

gindemit commented 2 months ago

Hi guys! Sorry for the late reply. I am currenly busy on other projects.

I already fixed similar issue in my other plugin where the Mac arm64 was not supported. I will try to find time in the next days to apply the same fix also to this plugin.

As I remember the fix is similar to the new @zhangxiaojun92 shared. But the fix I made will include both architectures at the end: for intel and arm processors. So that it works on old and new Mac OSX systems.