Compiling QCad on OS X with fink

UPDATE 2008.01.16: For some reason the original patch file I uploaded was wrong. I’ve corrected it and the correct file should be referenced now. Apply with “patch – p0 < qcad-2.0.5.0-1-fink-qt3mac.patch”.

NOTE: I can’t seem to build this on an Intel Mac due to problems with gcc-3.3 (see these posts about why you can’t build projects using gcc-3.3 on Intel Macs). I’m trying to get this to build properly on an Intel Mac using gcc-4.0, but haven’t been successful yet, unfortunately. Until then, this only works for Power PC Macs.

————————

Another technical post, so skip if you don’t like the words “compile”, “fink”, or “qmake”.

I’ve been looking for a good free or open-source CAD/CAAD software for OS X. Most products, like SolidWorks or Rhino, are not only not-free, but also not available on OS X. For my thesis work I’ve been trying to use as much open-source software as possible, perhaps as a means of masochism, but more because I want to results of my work to be available and used by as many as possible. One way to do that is to use software that anybody can get for themselves, building it on a variety of platforms as needed.

Of course, it might take a few days to get something built because of various strange issues, but that’s a matter for another post.

So QCad had gotten a lot of good responses from people online as the most full-featured open-source CAD software available for Linux, and thus for OS X as well. To give RibbonSoft credit where credit is due, they release the source for QCad under the GPL; however, binaries are available only in time-limited demos. Unless, of course, your Linux distribution prepares binaries for you. (Ubuntu does, so I had QCad up and running on my Linux machine in no time.) However, on OS X, the only compiled binaries are available from RibbonSoft. Cheap grad student that I am with fungible deadlines I decided to give compiling QCad a shot. I quickly ran into a number of problems, the solutions to which I will try and detail below.

So, in order to compile QCad on OS X with fink, do the following:

  1. Make sure you have gcc-3.3 installed.
  2. Install the qt3mac packages from fink (including -shlibs, -apps, etc.).
  3. Download the QCad Community Edition source.
  4. Apply the following patch to the source directory
  5. cd to scripts/, run “./build_qcad.sh notrans”

After a while you’ll have a QCad.app living in qcad/. Just copy to your /Applications folder (or wherever you want) and you should be set. Examples, library, and documentation can be copied from a downloaded demo version.

The reasons for the changes in the patch are the following:

  • For some reason fink splits the mkspecs, translations, etc., from qt3mac and puts it under /sw/share/qt3mac, instead of under /sw/lib/qt3mac, like it is with qt3.
  • I ran into linking problems when using gcc-4.0, and for some reason qmake wasn’t honoring the settings of gcc_select, so I had to explicitly give the names of the gcc binaries I wanted to use.
  • The “-pedantic” flag causes problems.

Note that I haven’t tried building from start to finish using this patch on a clean download, but I think it should work. Let me know if there are issues.

Comments

Thanks for posting this. I also ran into a problem. I'm getting the following error with the patch file: patch: **** malformed patch at line 11: +QMAKE_CXX = g++-3.3

I moved the patch to ~/qcad/src/ but I am unsure of how to "apply" it. Running "patch" at the command line just crashes X11's terminal. Also, I could not find qt3mac on fink; only qt3. Is that an issue?

don't know what happened to that last bit... rtholmes@minnow:~/tmp/qcad$ patch -p0 &lt; qcad-2.0.5.0-1-fink-qt3mac.patch patching file qcad-2.0.5.0-1-community.src/mkspecs/defs.pro patch: **** malformed patch at line 15: diff -Naur qcad-2.0.5.0-1-community.src.orig/scripts/build_qcad.sh qcad-2.0.5.0-1-community.src/scripts/build_qcad.sh

Hey... I've got into quite a mess here now. First specs: intel mac, 10.5.1, xcode 3 (so gcc4). I then installed gcc3.3 and messed with various files to make it compile using 3.3 instead of 4. I'm now lost with what i've done on this machine and think i need a reinstall. Can't do that right now tho as theres other work i need to do. If anyone manages to compile this for leopard pls say so here! thanks and hope to be back soon!

g++-3.3: installation problem, cannot exec `cc1plus': No such file or directory make[2]: *** [obj/rs_actioninterface.o] Error 1 make[1]: *** [lib/libqcad.a] Error 2 make: *** [all] Error 2 Building qcadlib failed

Hmm, looks like there is a major problem with your development environment. It's having a problem finding one of the main programs (cc1plus) needed to compile and link the code. It should live in a place like: /usr/libexec/gcc/darwin/ppc/3.3/cc1plus I'd try reinstalling the developer tools from scratch to try and reinstate your development environment. Note that I haven't tried compiling qcad on an intel machine yet; when I moved to my new machine I simply copied the executable bundle over.

For what it's worth, I have compiled QCAD successfully on a an Intel MacBook Pro with leopard and XCode 3 (gcc 4). I use macports, so I installed the qt3-mac port (which currently requires a patch itself), set my QTDIR=/opt/local, QMAKESPEC=/opt/local/share/qt3/mkspecs/macx-g++, set the OSTYPE and commented out the "-pedantic" flags in mkspecs/defs.pro (this is only slightly different than what you do in your patch file). I haven't tested it much yet, but it does start up.

Hi, here is a youg italian architect, who would like to work with an open-source cad, and it seems to me that qcad is the best...i've founded. I read all the posts about the problems running in Leopard, and i tried to solve them as you wrote in your post...but i have some problems... Well, i have to say that i've never work on a mac, this is the first time (i bought it in november..). I don't know what it means "compile", and what it is gcc-3.3 or fink. I searched through the web for, but the http://www.finkproject.org/ page seems to be stopped. I'm not a programmer, sometimes i'd like to, but now i would like fisrt to understand how to run qcad on a leopard mac. In future maybe also to help the project going on, i think a lot of user (not only mac) would like to work on a opensource cad (it's a little bit of time that i got some ideas to perform an opensource cad...including parametric function/object, like door, walls, windows...but i don't know how!!). So, thanks for any answer, and i think you're doing a interesting work. Bye, Danilo

Ed, That's great that you were able to get qcad compiled on an Intel and Leopard! I'm still on Tiger but was able to nearly get qcad compiled using gcc 4--my main problem came in the linking stage when it complained about not being able to find one symbol. This seemed to be due to an automatically generated PNG initialization function. Once I commented that out I was able to get qcad compiled, but without any images for the toolbar. I'm still trying to figure that out and will hopefully release a new patch soon. nick

Danilo, I'm glad some architects are interested in using an open-source CAD program! I'm not an architect myself, but I don't think qcad is quite ready to compete against something like AutoCAD--it's great for hobbyists and small projects, but I'm not sure if it can be used for a large-scale project. As for fink, the website seems to be working again. If you read their user's guide (http://www.finkproject.org/doc/users-guide/index.php) and use the "Fink Commander" program to install packages, getting the right software to make qcad work should be doable--difficult, but doable. For right now, though, getting and using qcad on OS X using this method is pretty involved. I'd recommend downloading the trial version (http://www.qcad.org/qcad.html) and checking it out. The cost is also reasonable--only €24, which is really quite good given what you are getting for that price. Since I'm in school and the source code was available, however, I wanted to see if I could compile it myself :-) Good luck with playing around with qcad! nick

i have an intel macbook running 10.5.1. to solve my compilation problem, i changed the following in "defs.pro" to reflect: #QMAKE_CXXFLAGS_DEBUG += -pedantic #QMAKE_CXXFLAGS += -pedantic QMAKE_CC = gcc-4.0 QMAKE_CXX = g++-4.0 i am using the fink qt3 dev. suite. hope this helps someone!

I'm trying to install qt3mac using the Fink Commander using 10.4 w/Developer Tools installed. I'm getting a error about unmet dependencies/conflicts. Is this normal? Also, has anyone compiled QCAD for PPC (10.4)? If so could you provide the binary it would sure save lots of headaches for me. I'm no programming expert.

My build failed. Here's the last bit of the build message: main.cpp: In function `int main(int, char**)': main.cpp:233: error: parse error before `(' token make[1]: *** [obj/main.o] Error 1 make: *** [qcad] Error 2 Building qcad binary failed I'll try to search for more info on the error. Thanks for any suggestions!! -Allen

I'm running 10.4 on a ppc. I get to step 5, and do a cd to System Folder/Scripts (the Scripts directory I see is there) and type: run “./build_qcad.sh notrans” and I get tcsh: run: Command not found. Am I missing a path, or doing something else wrong? Thanks

Add new comment