Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: medamarko on October 31, 2011, 11:37:14 am

Title: Newbee question
Post 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:
Code: [Select]
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:
Code: [Select]
{$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
Title: Re: Newbee question
Post by: Jonas Maebe on October 31, 2011, 11:48:06 am
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.
Title: Re: Newbee question
Post by: medamarko on October 31, 2011, 12:19:13 pm
I get this output:
Code: [Select]
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.
Title: Re: Newbee question
Post by: Jonas Maebe on October 31, 2011, 08:10:07 pm
Google suggests trying "pkg-config --libs libusb-1.0" (when searching for pkg-config libusb).
Title: Re: Newbee question
Post by: medamarko on November 01, 2011, 12:01:53 pm
Thanks,

Yes you are right. I've got this output:
Code: [Select]
-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
TinyPortal © 2005-2018