Lazarus
Programming => Operating Systems => macOS / Mac OS X => Topic started by: medamarko on October 31, 2011, 11:37:14 am
-
Hi All,
I'm trying to port demo app for libusb written in fpc on OSX.
I installed libusb and libusb dev packages using macport.
I also changed:
{$LINKLIB /usr/lib/libusb-1.0.a} to {$LINKLIB libusb-1.0} (i assume that it will use libusb-1.0dylib).
But when i try to recompile project i get following errors:
Undefined symbols:
"_libusb_exit", referenced from: _UMIKROUSB_CLOSELIBUSB in umikrousb.o
"_libusb_init", referenced from: _UMIKROUSB_OPENLIBUSB in umikrousb.o
ld: symbol(s) not found
Error: Error while linking
Probably I oversee something:
And here are prototypes of functions:
{$LINKLIB libusb-1.0}
function libusb_init(ctx:PPlibusb_context):longint;cdecl;external;
procedure libusb_exit(ctx:Plibusb_context);cdecl;external;
This is the same units and project that works fine on Linux.
Thanks in advance.
Marko
-
You can try executing something like "pkg-config --libs usb" (or maybe "pkg-config --libs libusb") to check whether you also have to link other libraries.
-
I get this output:
svps-Mac:~ svp$ pkg-config --libs libusb
Package libusb was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusb.pc'
to the PKG_CONFIG_PATH environment variable
Does this mean that libusb is not properly installed..?
Any hints?
Thanks.
-
Google suggests trying "pkg-config --libs libusb-1.0" (when searching for pkg-config libusb).
-
Thanks,
Yes you are right. I've got this output:
-L/opt/local/lib -lusb-1.0
It seems like Lazarus cannot link library. Because I'm getting the same errors when i remove {$LINKLIB libusb-1.0}.
I added in search path:
/usr/local/lib
and also tried with /opt/local/lib but without luck.
I'm beginner in OSX and im not sure that i correctly configured compiler to find libusb library...
Regards