RustAudio / coreaudio-sys

Raw bindings to the OSX CoreAudio framework generated by bindgen (see coreaudio-rs for a more rust-esque wrapper).
MIT License
69 stars 38 forks source link

Build on MacOS 10.13 #14

Closed dan-f closed 6 years ago

dan-f commented 6 years ago

Hi there!

I couldn't get this library (0.2.1) to compile on my mac (macOS 10.13.4 High Sierra). This patch fixes that for me. I'm not super familiar with where macOS system libraries are kept, but I know for certain that I was getting the following error when trying to compile:

error: header '/Library/Developer/CommandLineTools/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreMIDI.frame work/Headers/CoreMIDI.h' does not exist.

The proper location on my system is /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/CoreMIDI.framework/Headers/CoreMIDI.h.

Rhuagh commented 6 years ago

Is xcode installed? What does xcode-select -p say?

dan-f commented 6 years ago

Yeah, I've got xcode and the xcode developer tools installed. xcode-select -p returns: /Library/Developer/CommandLineTools.

Rhuagh commented 6 years ago

Hmm, mine return a path inside /Applications/Xcode.app

Rhuagh commented 6 years ago

So this pr will cause the build to fail for all systems that behave like mine.

dan-f commented 6 years ago

Are you also on macOS 10.13?

Rhuagh commented 6 years ago

Yes, 10.13.4

dan-f commented 6 years ago

Well, currently the build fails on systems that behave like mine, so how about we figure out a method for deterministically locating the CoreAudio headers? :)

On May 28, 2018, at 12:24 PM, Simon Rönnberg notifications@github.com wrote:

Yes, 10.13.4

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RustAudio/coreaudio-sys/pull/14#issuecomment-392565375, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDACPpwFb514d1-ZiPwKFPKMXVnNO2cks5t3CSigaJpZM4UQZOC.

dan-f commented 6 years ago

Alright, running xcode-select --reset changed the active developer directory to one inside of /Applications/Xcode.app, and the compile worked! Very strange... I'll close this PR.

Rhuagh commented 6 years ago

Did you have Sierra before and upgraded xcode directly instead of reinstalling? That path looks like the one on older versions of osx.

dan-f commented 6 years ago

That's certainly possible.

On May 28, 2018, at 12:59 PM, Simon Rönnberg notifications@github.com wrote:

Did you have Sierra before and upgraded xcode directly instead of reinstalling? That path looks like the one on older versions of osx.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/RustAudio/coreaudio-sys/pull/14#issuecomment-392570690, or mute the thread https://github.com/notifications/unsubscribe-auth/ACDACPALAXCJ848puBcR2zSIRSCJVNUWks5t3Cz_gaJpZM4UQZOC.

Rhuagh commented 6 years ago

I don't really understand why they feel a need to move all frameworks every major version update :/

mitchmindtree commented 6 years ago

We just put on a workshop and ran into an issue where one user did not already have xcode installed. To avoid the 4GB Xcode download in the middle of the workshop, we attempted to just install the xcode command line tools, which at least allowed rust to link crates correctly etc. However we then ran into this issue where coreaudio-sys could not find CoreAudio.h.

xcode-select -p returns /Library/Developer/CommandLineTools, so we tried calling xcode-select --reset but it had no effect (I'm guessing because the Xcode.app itself did not exist yet). We noticed that Apple seems to allow for installing "Auxilliary tools" (with audio, opengl, etc - ~60mb rather than 4gb), however we didn't have time to investigate further and I don't have a mac available to investigate further right now.

It would be nice if it were possible to have coreaudio-sys work without having to install xcode in its entirety, but I don't personally have any solutions yet - just posting this for the record.

Rhuagh commented 6 years ago

Hmm, we could add support for that path specifically I guess, would have to be hardcoded most likely though.

mitchmindtree commented 6 years ago

We just ran another workshop and ran into a new variation of this issue - this time coreaudio-sys itself would link and compile fine, however the user's AudioUnit.h seemed to contain modified versions of some of the functions and in turn resulted in compiler errors in coreaudio-rs. The work around we ended up using was to basically uninstall xcode-select and re-install it. To do this we: