Proxmark3 Client Compilation on OSX 10.7+

Proxmark3_裸板

Recently, I tried to compile the proxmark3 client on OSX using the most recent codebase from the SVN (r756).  I was plagued by errors, regarding the use of QT and missing frameworks.  Consensus on the forums was to strip the QT libraries from the Makefile, and recompile. But the client object files hook a lot of graphical calls useful for researching tag modulation.  Stripping QT is just not an acceptable option.

A familiar looking error:

g++ -I/Library/Frameworks/QtGui.framework/Versions/Current/Headers -I/Library/Frameworks/QtCore.framework/Versions/Current/Headers -c -o obj/proxgui.o proxgui.cpp
In file included from proxgui.cpp:12:0:
proxguiqt.h:11:24: fatal error: QApplication: No such file or directory
compilation terminated.
make: *** [obj/proxgui.o] Error 1

I prefer to use Macports (http://www.macports.org), and already have QT4 libraries installed; so everything typically appears under /opt/local/, so I simply modified the Makefile, and now it saftely compiles with no errors, and correctly works on OSX Lion (10.7) and OSX Mountain Lion (10.8).

Below is the patch:

--- Makefile.bak 2013-08-11 20:42:11.000000000 +0100
+++ Makefile 2013-08-11 21:34:39.000000000 +0100
@@ -21,8 +21,8 @@ CXXFLAGS = -I$(QTDIR)/include -I$(QTDIR)
QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQtGui4
MOC = $(QTDIR)/bin/moc
else ifeq ($(platform),Darwin)
-CXXFLAGS = -I/Library/Frameworks/QtGui.framework/Versions/Current/Headers -I/Library/Frameworks/QtCore.framework/Versions/Current/Headers
-QTLDLIBS = -framework QtGui -framework QtCore
+CXXFLAGS = -I/opt/local/Library/Frameworks/QtGui.framework/Versions/Current/Headers -I/opt/local/Library/Frameworks/QtCore.framework/Versions/Current/Headers
+QTLDLIBS = -lQtCore -lQtGui
MOC = moc
else
CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4

UPDATE (30/12/2013):Patch for OSX 10.9:

--- Makefile.old 2013-12-30 09:34:00.000000000 +0000
+++ Makefile 2013-12-30 09:35:08.000000000 +0000
@@ -24,9 +24,9 @@ QTLDLIBS = -L$(QTDIR)/lib -lQtCore4 -lQt
MOC = $(QTDIR)/bin/moc
LUAPLATFORM = mingw
else ifeq ($(platform),Darwin)
-CXXFLAGS = -I/opt/local/Library/Frameworks/QtGui.framework/Versions/4/Headers -I/opt/local/Library/Frameworks/QtCore.framework/Versions/4/Headers
-QTLDLIBS = -lQtCore -lQtGui
-MOC = moc
+CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4
+QTLDLIBS = $(shell pkg-config --libs QtCore QtGui 2>/dev/null)
+MOC = $(shell pkg-config --variable=moc_location QtCore)
LUAPLATFORM = macosx
else
CXXFLAGS = $(shell pkg-config --cflags QtCore QtGui 2>/dev/null) -Wall -O4

The Proxmark3 client in operation:

$ ./proxmark3 /dev/tty.usbmodemfd121
proxmark3> hw version
#db# Prox/RFID mark3 RFID instrument
#db# bootrom: svn 756 2013-08-02 02:38:44
#db# os: svn 756 2013-08-02 02:39:07
#db# FPGA image built on 2012/ 1/ 6 at 15:27:56