OpenSCAD includes convenience scripts to cross-build Windows installer binaries using the MXE system (http://mxe.cc). If you wish to use them, you can first install the MXE Requirements such as cmake, perl, scons, using your system's package manager (click to view a complete list of requirements). Then you can perform the following commands to download OpenSCAD source and build a windows installer:
The x-build-dependencies process takes several hours, mostly to cross-build QT. It also requires several gigabytes of disk space. If you have multiple CPUs you can speed up things by running export NUMCPU=x before running the dependency build script. By default it builds the dependencies in $HOME/openscad_deps/mxe. You can override the mxe installation path by setting the BASEDIR environment variable before running the scripts. The OpenSCAD binaries are built into a separate build path, openscad/mingw32.
Hi Sternas, I used to cross-compile my project from Win to Linux without any issue. Lately, I also had to deal with Mac. So I installed CT on Mac and compiled. Use the Mac to write code. You don't have to use NetBeans as the IDE, although I suggest you do, since we will be using it to debug on the target. Use the makefile to transfer the binary to the pi. Use NetBeans to debug the code running on the Pi (remotely) Cross compiling. It took me a long time to find a cross compiler.
Note that if you want to then build linux binaries, you should log out of your shell, and log back in. The 'setenv' scripts, as of early 2013, required a 'clean' shell environment to work.
If you wish to cross-build manually, please follow the steps below and/or consult the release-common.sh source code.
The easiest way to cross-compile OpenSCAD for Windows on Linux or Mac is to use mxe (M cross environment). You will need to install git to get it. Once you have git, navigate to where you want to keep the mxe files in a terminal window and run:
Add the following line to your ~/.bashrc
file:
replacing <where mxe is installed>
with the appropriate path.
The requirements to cross-compile for Windows are just the requirements of mxe. They are listed, along with a command for installing them here. You don't need to type 'make'; this will make everything and take up >10 GB of diskspace. You can instead follow the next step to compile only what's needed for openscad.
Now that you have the requirements for mxe installed, you can build OpenSCAD's dependencies (CGAL, Opencsg, MPFR, and Eigen2). Just open a terminal window, navigate to your mxe installation and run:
This will take a few hours, because it has to build things like gcc, qt, and boost. Just go calibrate your printer or something while you wait. To speed things up, you might want do something like 'make -j 4 JOBS=2' for parallel building. See the mxe tutorial for more details.
Optional: If you want to build an installer, you need to install the nullsoft installer system. It should be in your package manager, called 'nsis'.
Now that all the requirements have been met, all that remains is to build OpenSCAD itself. Open a terminal window and enter:
Then get MCAD:
You need to create a symbolic link here for the build system to find the libraries:
again replacing <where mxe is installed>
with the appropriate path
Now to build OpenSCAD run:
When that is finished, you will have openscad.exe in ./release and you can build an installer with it as described in the instructions for building with Microsoft Visual C++, described here.
The difference is that instead of right-clicking on the *.nsi file you will run:
Note that as of early 2013, OpenSCAD's 'scripts/release-common.sh' automatically uses the version of nsis that comes with the MXE cross build system, so you may wish to investigate the release-common.sh source code to see how it works, if you have troubles.
The Pi is great, but, alas, it's slow. Also, I configured mine to be headless, so no IDE for me while working on it.I used this little 'hello world' project to set up my environment for cross compiling, running and debugging arbitrary code from my Mac on to the Pi.
Outline is a powerful, full featured note-taker for iPad and Mac OS X, perfect for students, teachers, physicians, lawyers, executives and everyone who needs to sketch ideas, organize notes, annotate documents, keep any kind of journals. Onenote for mac outlining.
The development workflow is:
It took me a long time to find a cross compiler. Most of the Googles came back with set up from Linux, and required a VM to connect to. This, of course, is an overkill, and I opted for the solution presented here.Thank you Jared Wolff!
I used Jared's DMG that he created, and since I am running my Mac case-insensitive, I could not copy the toochain locally, and quickly got used to referencing the cross-compiler toolchain off a mounted volume.
Using the command line, it looks like this:
To test that it works, scp it to your Pi and run it there.
NetBeans is the only IDE that I could get to configure for cross-platform development. XCode is a horror to work with when it comes to general, non-iOS or Mac development. CLion is awesome, but does not lend itself to such configurations and is based on CMAKE, which is an overkill for my needs.So NetBeans it is:
Create your project, or use the one in github.Select preferences (Command+,), select the 'C/C++' tab at the top of the pane.There, click on the 'Build tools' tab and hit click on 'Add' at the bottom.Fill in the pane like so:
As you can see, NetBeans asks for the 'Base Directory'. I thought that supplying the tool names would suffice, based on the base dir.For me at least, this did not work and Make complained about finding the tools.To solve it, I put the full path of the tools in the dialog and added them again in the project's properties page.If you encounter the same problem, right click the project's root and select 'properties'.There, select 'Build' and then 'C Compiler' etc to add in the full paths:
Once you have some code worthy of being run on the Pi, you transfer the executable to it and run it remotely:
Step-debugging the code in NetBeans is a treat.
Run the remote debugger:
Here you're telling gdbserer to run the welcome app on port 1234.
From the menu, select 'Debug'/'Attach debugger' and fill in the form:
gdbserver
command above.Hit OK, and a few seconds later, you will see NetBeans's debugger interface.Step through the exanple to see it in action.
Unless specified otherwise, gdbdebugger will exit after a single run. That means you'll have to re-issue the gdbserver command for a subsequent session.
Please feel free to use, fork and improve this snippet, posted on github.
I hope you find the example useful!
Happy hacking!