Topic: Mac Builds

Hey all,

I've spent sometime today & yesterday trying to get libnfc to build on my macbook. Os X 10.6.8, in the end I've given up and used MacPorts to install a slightly older version (newest isn't that important to me).  I'm reporting my problems, hopefully they're helpful to you.  I've was using the instructions here:

http://www.libnfc.org/documentation/installation

After updating macports using:

sudo port -v selfupdate

I can't install glib (ports gives a "Error: Port glib not found") error.  Libusb installs but under the name 'libusb-1.0', which means the libnfc ./configure can't find it.  I tried renaming the /opt/local/lib/pkgconfig/libusb-1.0.pc to libusb.pc, and that's good enough for ./configure to complete successfully.  I also needed to add some paths for pkg-config to use the /opt/local/lib dir, but that might just be my machine.  Before trying the rename I had libusb-devel installed, made no difference.

Now when building it's giving me a:

pn53x_usb.c:42:19: error: usb.h: No such file or directory

I can find this header in /opt/local/include, but even after using ./configure includedir=/opt/local/include, the build fails.

I notice though that ports has the dependency of 'libusb-compat'.  But even with that installed the code fails to build here. 

James

Re: Mac Builds

Hey,

MrNorris wrote:

Os X 10.6.8, in the end I've given up and used MacPorts to install a slightly older version (newest isn't that important to me).

Newer (called unstable till 1.6 release) version is highly recommended for UART devices. Its needed to be able to drive LLCP connection (using libnfc-llcp) and for emulation.
If you want to use your nfc device as initiator, older is fine.

MrNorris wrote:

I'm reporting my problems, hopefully they're helpful to you.

Thank you for feedback, indeed its helpful.

MrNorris wrote:

I can't install glib (ports gives a "Error: Port glib not found") error.

I don't know exactly if glib is needed...

MrNorris wrote:

Libusb installs but under the name 'libusb-1.0'

libnfc uses libusb-0.1 (to be able to keep Windows compatibility). So, according to MacPorts's website, you could use: libusb-legacy or maybe libusb-compat.

MrNorris wrote:

I tried renaming the /opt/local/lib/pkgconfig/libusb-1.0.pc to libusb.pc

No way to make libnfc works with libusb-1.0 so easily: libnfc's USB drivers need to be rewritten to work with this version.

Romuald Conty

Re: Mac Builds

This is great, thank rconty.  I've gone back and managed to build 1.4.2 stable.  If others are interested, the key was to use the correct version of libusb, on macports its listed under libusb-legacy.  So:

sudo port install libusb-legacy

I uninstalled all other libusb variants before doing this, so libusb-compat, libusb-devel, libusb all removed.  Needed to rename the .pc file for ./configure to pick this up:

sudo mv libusb-legacy.pc libusb.pc

From /opt/local/lib/pkgconfig.  Now.. to see if the build actually works smile

Thanks again,
James

Re: Mac Builds

MrNorris wrote:

sudo mv libusb-legacy.pc libusb.pc

Using r1166 version, this file moving should not be needed anymore.
Could you revert back your file moving and give it a try using latest version of libnfc ?

Thanks for feedback !
I hope it will fix the MacOS building.

Romuald Conty

Re: Mac Builds

rconty wrote:
MrNorris wrote:

sudo mv libusb-legacy.pc libusb.pc

Using r1166 version, this file moving should not be needed anymore.
Could you revert back your file moving and give it a try using latest version of libnfc ?

Thanks for feedback !
I hope it will fix the MacOS building.

Not the original poster, but I verified that libnfc-1.5.1 does NOT require the move, as you described. Thanks!