Proxmark3 Client Compilation on OSX 10.7+
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
Hi,
I made the changes you mentioned but i get following error.. Could you please help?
In file included from /opt/local/Library/Frameworks/QtGui.framework/Versions/Current/Headers/QApplication:1,
from proxguiqt.h:11,
from proxgui.cpp:12:
/opt/local/Library/Frameworks/QtGui.framework/Versions/Current/Headers/qapplication.h:45:37: error: QtCore/qcoreapplication.h: No such file or directory
/opt/local/Library/Frameworks/QtGui.framework/Versions/Current/Headers/qapplication.h:46:31: error: QtGui/qwindowdefs.h: No such file or directory
/opt/local/Library/Frameworks/QtGui.framework/Versions/Current/Headers/qapplication.h:47:27: error: QtCore/qpoint.h: No such file or directory
have you used Macports to install QT4?
sudo port install qt4-mac-devel
I have installed qt4-mac from macport which they say is a replacement of qt4-mac-devel.
Quite right, I have “qt4-mac @4.8.5_0” installed.
All the QT4 files, and the ones that your missing are inside that directory in my patch, the only thing I can think of right now is that mac ports is installed to a different directory? My instructions worked from a clean build on a fellow colleagues OSX laptop.
I am sure that I have installed QT4 in the correct directory, these are the files in the /opt/local/Library/Frameworks/ directory. Please let me know if I am missing anything
$ ls /opt/local/Library/Frameworks/
Python.framework QtNetwork.framework
Qt3Support.framework QtOpenGL.framework
QtCLucene.framework QtScript.framework
QtCore.framework QtScriptTools.framework
QtDBus.framework QtSql.framework
QtDeclarative.framework QtSvg.framework
QtDesigner.framework QtTest.framework
QtDesignerComponents.framework QtUiTools.framework
QtGui.framework QtWebKit.framework
QtHelp.framework QtXml.framework
QtMultimedia.framework QtXmlPatterns.framework
Hmm, strangely looks a bit sparse, is your mac ports up-to-date? “sudo port selfupdate”.
Hi,
I have updated mac port but I still have the same error. Moreover I don’t have more packages in the Framwork. Here are the outputs.
I don’t know what went wrong.
$ sudo port -v selfupdate
—> Updating MacPorts base sources using rsync
receiving file list … done
base.tar
sent 13396 bytes received 10189 bytes 6738.57 bytes/sec
total size is 4925440 speedup is 208.84
receiving file list … done
base.tar.rmd160
sent 64 bytes received 635 bytes 279.60 bytes/sec
total size is 512 speedup is 0.73
MacPorts base version 2.2.0 installed,
MacPorts base version 2.2.0 downloaded.
—> Updating the ports tree
Synchronizing local ports tree from rsync://rsync.macports.org/release/tarballs/ports.tar
receiving file list … done
ports.tar
sent 51669 bytes received 112 bytes 14794.57 bytes/sec
total size is 54261760 speedup is 1047.91
receiving file list … done
ports.tar.rmd160
sent 64 bytes received 117 bytes 72.40 bytes/sec
total size is 512 speedup is 2.83
Creating port index in /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports
Total number of ports parsed: 0
Ports successfully parsed: 0
Ports failed: 0
Up-to-date ports skipped: 17533
—> MacPorts base is already the latest version
The ports tree has been updated. To upgrade your installed ports, you should run
port upgrade outdated
——————————————————-
$ sudo port upgrade outdated
Nothing to upgrade.
——————————————————-
$ sudo port install qt4-mac
—> Computing dependencies for qt4-mac
—> Cleaning qt4-mac
—> Scanning binaries for linking errors: 100.0%
—> No broken files found.
——————————————————-
$ ls /opt/local/Library/Frameworks/
Python.framework QtNetwork.framework
Qt3Support.framework QtOpenGL.framework
QtCLucene.framework QtScript.framework
QtCore.framework QtScriptTools.framework
QtDBus.framework QtSql.framework
QtDeclarative.framework QtSvg.framework
QtDesigner.framework QtTest.framework
QtDesignerComponents.framework QtUiTools.framework
QtGui.framework QtWebKit.framework
QtHelp.framework QtXml.framework
QtMultimedia.framework QtXmlPatterns.framework
I fixed the problem by adding -I/opt/local/include to the CXXFLAGS like below
CXXFLAGS = -I/opt/local/include -I/opt/local/Library/Frameworks/QtGui.framework/Versions/Current/Headers -I/opt/local/Library/Frameworks/QtCore.framework/Versions/Current/Headers
QTLDLIBS = -lQtCore -lQtGui
Thank you for the article and your support.
Glad we’ve got it working in the end.
If you keep running into QT dependency issues, and don’t need the GUI, you can just put “QTGUI = guidummy.o” in there (eg. before the CORESRCS = line )
I can not see the device over the /dev directory, can you please tell me how to get it working?
Which version of OSX are you using?
How many /dev/tty.usb* devices have you got?
If you proxmark3 is new and not updated it may be appearing as a HID device?
mine appears as /dev/tty.usbmodem
what firmware are you running? if you have not updated your bootloader it may be appearing as a HID device?