xthexder / go-jack

Go bindings for Jack Audio Connection Kit
MIT License
75 stars 22 forks source link

Jack C++ headers on Mac? #32

Closed GeoffreyPlitt closed 1 month ago

GeoffreyPlitt commented 2 months ago

Hi Jacob, sorry to bother you, just wondering if you found a solution to the following.

I have "github.com/xthexder/go-jack" in the imports of my main.go file. Things run fine on linux (my Raspberry Pi) because the Jack C++ headers are in a standard place.

On Mac, I don't expect my code to run, exactly (I don't think Mac's audio system is compatible with Jack), but that's where I edit the code, and I'm always getting errors in my IDE about missing header files.

An easy way to reproduce this is, I run "go run main.go" on the Mac, and get:

# github.com/xthexder/go-jack
../../go/pkg/mod/github.com/xthexder/go-jack@v0.0.0-20220805234212-bc8604043aba/jack.go:11:10: fatal error: 'jack/jack.h' file not found
#include <jack/jack.h>
         ^~~~~~~~~~~~~
1 error generated.

However, I did install Jack with brew install jack already, so it seems to not be finding the headers. For example, when I run brew install jack again, I get: Warning: jack 1.9.22_1 is already installed and up-to-date

Do you know how to get Go to find Jack's C++ headers in the Brew install folder?

xthexder commented 1 month ago

Unfortunately I do not have any Apple devices to test go-jack on, so I can't really give you any specific instructions.

You'll need to figure out where brew install jack is installing its header files and make sure they're in the C compiler include path. On windows the include path is set at the top of jack.go, with #cgo windows,amd64 CFLAGS: -I "C:/Program Files/JACK2/include" If the headers aren't being installed to the default system include path, then you'll probably have to add the C flags manually like windows does.

GeoffreyPlitt commented 1 month ago

Thanks!