You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vendor/github.com/adrg/libvlc-go/v3/av.go:4:11: fatal error: vlc/vlc.h: No such file or directory
4 | // #include <vlc/vlc.h>
| ^~~~~~~~~~~
compilation terminated.
I have installed VLC via ports like the instructions say to do. However it does say that ldconfig command not found. I am on latest Macos using Apple Silicon
I have the exact issue myself; however, in my case, I'm not using MacPorts to install VLC, but rather Homebrew, which also installs VLC as a "cask", meaning that it goes straight into /Applications. That said, the remaining configuration is precisely the same. Instead of Apple Silicon, I'm using a 10-year-old Mac with plain ancient Intel chips :)
The issue with v3.1.6 is the extra instruction requiring VLC_CONFIG_PATH to be set to the directory where the libraries and include files are, namely, inside the directory structure of the VLC application itself. There is no question that these libraries/include files are, indeed, there. And the symbolic links are also supposed to be fine. The problem is that the cgo subsystem ignores all of that.
CGO_CFLAGS="-I/Applications/VLC.app/Contents/MacOS/include" CGO_LDFLAGS="-L/Applications/VLC.app/Contents/MacOS/lib" go build
(this assumes that VLC was installed on its default /Applications path; adapt if necessary).
I haven't tested this approach in v2, only under v3.16, but my feeling is that it will be exactly the same issue, since nothing in the legacy code refers to VLC_CONFIG_PATH, either.
One alternative, of course, is to follow the conventions set in the CGO reference manual. This requires some extra effort, since it means that each operating system variant would require its own set of parameters (and thus diefferent files...). The alternative is actually quite cool: use pkg-config to provide the correct CFLAGS and LDFLAGS! Alas... if only VLC had added a vlc.pc and automatically placed it in the proper location... but I'm sure that's asking too much 😢 (you can do it manually, of course).
The alternative of just passing the CGO-specific variables on the command-line has at least the advantage that it works on any operating system, so long as you know in advance where VLC has placed its include files and libraries. This may be important in servers and other headless environments where VLC proper is not installed (it wouldn't do much anyway), but its very useful libraries are!
If a kind soul could double-check all of the above and add the correct instructions to the Wiki (I hate to fork the whole Wiki just to remove one line and add another...), I believe that future users would benefit a lot 😁
... or, alternatively, as mentioned, you can completely change the code to automagically self-configure itself to use the 'correct' paths for most operating systems. It's not such an easy task, but doable, and would have the advantage of allowing future users not to worry about where they have their VLC libraries installed.
I have a very similar issue that was mentioned in #113 when I try to run the example, or just simpy try to build the v3 version of the package. I'm on an Arch based distro though (Garuda linux).
I got:
# github.com/adrg/libvlc-go/v3
./event_manager.go: In function 'eventAttach':
./event_manager.go:10:40: error: passing argument 3 of 'libvlc_event_attach' from incompatible pointer type [-Wincompatible-pointer-types]
10 | return libvlc_event_attach(em, et, eventDispatch, (void*)userData);
| ^~~~~~~~~~~~~
| |
| void (*)(struct libvlc_event_t *, void *)
In file included from /usr/include/vlc/vlc.h:40,
from ./event_manager.go:5:
/usr/include/vlc/libvlc.h:339:59: note: expected 'libvlc_callback_t' {aka 'void (*)(const struct libvlc_event_t *, void *)'} but argument is of type 'void (*)(struct libvlc_event_t *, void *)'
339 | libvlc_callback_t f_callback,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
./event_manager.go: In function 'eventDetach':
./event_manager.go:13:33: error: passing argument 3 of 'libvlc_event_detach' from incompatible pointer type [-Wincompatible-pointer-types]
13 | libvlc_event_detach(em, et, eventDispatch, (void*)userData);
| ^~~~~~~~~~~~~
| |
| void (*)(struct libvlc_event_t *, void *)
/usr/include/vlc/libvlc.h:352:60: note: expected 'libvlc_callback_t' {aka 'void (*)(const struct libvlc_event_t *, void *)'} but argument is of type 'void (*)(struct libvlc_event_t *, void *)'
352 | libvlc_callback_t f_callback,
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
Based on the above, I've tried to run:
CGO_CFLAGS="-I/usr/include/vlc/" CGO_LDFLAGS="-L/usr/lib/vlc" go build
..but I got the same error.
Could you please advise? I have to admit I know close to nothing about C and even go is a new language for me, so sorry if I'm missing something painfully obvious..
if only VLC had added a vlc.pc and automatically placed it in the proper location...
We generate proper .pc files actually, just not for the app bundle, as we do not include any headers in there anyway for VLC 4.x, so it would be useless. What other downstream packagers do, is of course out of our control.
We probably could do it for VLC 3.x but I don't think you can have a relocatable .pc file, so we would need to assume a specific location where VLC is installed.
Activity
GwynethLlewelyn commentedon Nov 8, 2024
I have the exact issue myself; however, in my case, I'm not using MacPorts to install VLC, but rather Homebrew, which also installs VLC as a "cask", meaning that it goes straight into
/Applications. That said, the remaining configuration is precisely the same. Instead of Apple Silicon, I'm using a 10-year-old Mac with plain ancient Intel chips :)The issue with v3.1.6 is the extra instruction requiring
VLC_CONFIG_PATHto be set to the directory where the libraries and include files are, namely, inside the directory structure of the VLC application itself. There is no question that these libraries/include files are, indeed, there. And the symbolic links are also supposed to be fine. The problem is that thecgosubsystem ignores all of that.Instead, you should explicitly set the
cgoenvironment variables, namely,CGO_CFLAGS(include dirs) andCGO_LDFLAGS(library dirs, for the linker). Something like this:(this assumes that VLC was installed on its default
/Applicationspath; adapt if necessary).I haven't tested this approach in v2, only under v3.16, but my feeling is that it will be exactly the same issue, since nothing in the legacy code refers to
VLC_CONFIG_PATH, either.One alternative, of course, is to follow the conventions set in the CGO reference manual. This requires some extra effort, since it means that each operating system variant would require its own set of parameters (and thus diefferent files...). The alternative is actually quite cool: use
pkg-configto provide the correctCFLAGSandLDFLAGS! Alas... if only VLC had added avlc.pcand automatically placed it in the proper location... but I'm sure that's asking too much 😢 (you can do it manually, of course).The alternative of just passing the CGO-specific variables on the command-line has at least the advantage that it works on any operating system, so long as you know in advance where VLC has placed its include files and libraries. This may be important in servers and other headless environments where VLC proper is not installed (it wouldn't do much anyway), but its very useful libraries are!
If a kind soul could double-check all of the above and add the correct instructions to the Wiki (I hate to fork the whole Wiki just to remove one line and add another...), I believe that future users would benefit a lot 😁
... or, alternatively, as mentioned, you can completely change the code to automagically self-configure itself to use the 'correct' paths for most operating systems. It's not such an easy task, but doable, and would have the advantage of allowing future users not to worry about where they have their VLC libraries installed.
danielNemeth19 commentedon Nov 9, 2024
Hello,
I have a very similar issue that was mentioned in #113 when I try to run the example, or just simpy try to build the v3 version of the package. I'm on an Arch based distro though (Garuda linux).
I got:
Based on the above, I've tried to run:
..but I got the same error.
Could you please advise? I have to admit I know close to nothing about C and even go is a new language for me, so sorry if I'm missing something painfully obvious..
danielNemeth19 commentedon Nov 9, 2024
Apologies, In my case upgrading to the latest version (3.1.6) resolved the issue.
ePirat commentedon May 23, 2025
We generate proper .pc files actually, just not for the app bundle, as we do not include any headers in there anyway for VLC 4.x, so it would be useless. What other downstream packagers do, is of course out of our control.
We probably could do it for VLC 3.x but I don't think you can have a relocatable .pc file, so we would need to assume a specific location where VLC is installed.