adrg / libvlc-go

Go bindings for libVLC and high-level media player interface
https://pkg.go.dev/github.com/adrg/libvlc-go/v3
MIT License
421 stars 50 forks source link

libVLC instructions on Mac OS #13

Open adrg opened 5 years ago

adrg commented 5 years ago

Installation instructions on Debian based distributions are covered in the README file. Can someone provide installation instructions for the prerequisites of the library on Windows and Mac OS? I can then add the information to the README or create a wiki about this in order to help new users.

sc0Vu commented 5 years ago

Hi @adrg I tried many times on mac but it didn't work. Here was what I'd done on my mac pro:

  1. Download and compile vlc.
  2. Add build.go file to libvlc-go, and set the CFLAGS and LDFLAGS
  3. Put library and dynamic files of libvlc in directory.

Got this error: unknown image for @rpath/...

Right now I use vlc stream server instead, still try to find the root cause.

adrg commented 5 years ago

Hi @sc0Vu. Thank you for taking an interest in the library.

I see there are some instructions on the vlc wiki here: https://wiki.videolan.org/OSXCompile. Unfortunately I have no way of testing this as I don't have Mac OS machines.

gaurav-gogia commented 4 years ago

Hi @sc0Vu, I had similar error so something like this should work:

Make sure MacOSX.sdk exists by using following command ls SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

If its there then cool go for next command export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

If its not there then you'll need to install xcode-command-line-tools

I hope this helps

adrg commented 4 years ago

Thank you @gaurav-gogia. Ideally, there would be a wiki page similar to Install on Linux and Install on Windows with specific instructions for the whole installation process.

ansoni-san commented 3 years ago

The compilation instruction for VLC work fine for OSX including 11.1 (Big Sur). I also have it working fine for the M1 ARM architecture.

After following: https://wiki.videolan.org/MacOSCompile/

You'll have to set LIBRARY_PATH to the lib folder belonging to your compiled VLC, otherwise go get won't be able to link correctly.

export LIBRARY_PATH=<BUILD-DIR>/vlc_install_dir/lib

This was all I had to do.

adrg commented 3 years ago

@ansoni-san Awesome. Thank you for testing the library on macOS. That should be enough information for me to create an installation wiki page.

I noticed there's a NuGet package for macOS which provides an already built version of libVLC. Can that be used as an alternative to building the library yourself? The package is just a zip file so it can be opened with any archive manager.

adrg commented 3 years ago

I added a Install on macOS wiki page based on the information you provided. Please let me know if that looks ok.

zlatko5 commented 2 years ago

I do not understand "vlc_install_dir" part in following command export LIBRARY_PATH=BUILD-DIR/vlc_install_dir/lib Following instructions in https://wiki.videolan.org/MacOSCompile/, I have used directory ~/vlc. The build command has created directory ~/vlc/build/lib/ and there is file libvlc.la in there (and number of .lo files).

Linker gives me error: Undefined symbols for architecture x86_64: _libvlc_media_player_play and others.

I have one of following problems: (1) ~/vlc/build/lib/ is wrong directory to specify for link (2) directory is correct but library needed has not been built (3) directory and library (libvlc.la) are correct name but are for wrong architecture How do I determine which problem do I have?

adrg commented 2 years ago

I updated the Install on macOS wiki page with instructions on how to install libVLC through MacPorts. I find it to be a bit easier than building VLC from source.

@zlatko5 Can you try setting up your libVLC development environment this way?

zlatko5 commented 2 years ago

Thank you, libVLC through MacPorts works fine.

nkalait commented 2 months ago

I had raised a new issue before I saw this one, I have a problem running the example code on Mac so I found a workaround(#113) . I am no good with c or the c compiler but I somehow think that there could be a better solution than my workaround.