Skip to content
Snippets Groups Projects
Commit 3e5205ea authored by Andrew E. Torda's avatar Andrew E. Torda
Browse files

A few more notes about cross compiling.

parent 16709af0
No related branches found
No related tags found
No related merge requests found
......@@ -4,46 +4,41 @@ Given Ackleys function in *n* dimensions and some arbitrary starting point, run
# Install and run
I do not have a mac for testing, so this is limited to linux and windows.
One can download the source, or perhaps there is a pre-built binary
It can be built with or without graphics.
I do not have a mac for testing, so this is limited to linux and windows. It is possible that the instructions for linux are helpful for a mac. We can cross compile for a Mac, but not with graphics. The makefile is useful to me under linux. It makes a pile of binaries and sticks them in the bin directory.
## Prerequisites
- You must have go installed. I have only tried with go back to version 1.16. It may well build with earlier versions. It requires support for `go.mod`.
- You need a C compiler and cgo for the graphics.
- cross compiling from linux to windows is easy without graphics, but not much fun if you want graphics.
- You must have go installed. I have only tried with go back to version 1.16. It probably builds with earlier versions. It requires support for `go.mod`.
- You need a C compiler for the graphics.
- cross compiling is easy without graphics, but not much fun if you want graphics.
- native compilation under windows is painless
## Build
git clone git@gitlab.rrz.uni-hamburg.de:Bae5157/ackley_mc.git
cd ackley_mc
go build .
and you should end up with an executable called `ackley_mc` or `ackley_mc.exe` under windows. To build without graphics,
and you should end up with an executable called `ackley_mc` or `ackley_mc.exe` under windows. To build without graphics:
git clone git@gitlab.rrz.uni-hamburg.de:Bae5157/ackley_mc.git
cd ackley_mc
go build -tags=no_gfx .
### Graphics yes / no
By default, it builds with the graphical interface. To turn off graphics, you need a build tag, `no_gfx`.
To build without graphics
### Graphics yes / no ?
The graphical interface makes it convenient to play with parameters. You can quickly see what happens if you raise the initial temperature by a factor of 10. The graphical interface does not make beautiful plots. One can export the data and plot it with gnuplot/excel/R/whatever.
## Binaries
If I have built them for linux and windows, they will be linked to from the course moodle page.
Binaries for linux and windows are linked to from the moodle page. If you download a linux binary, you will have to `chmod +x ackley_mc` to make it executable.
# Documentation
The real documentation is in `go doc` format.
# Plotting output
This is in csv format. For gnuplot, do not forget to `set datafile separator ','`.
# BUGS
A chart from go-chart in png format can be displayed by fyne.
A chart in svg format leads to parse errors.
The UI toolkit is "fyne". It does not do charts, so we use go-chart which makes a png, which we can store in memory and feed to the fyne toolkit. Unfortunately, an svg file from go-chart causes fyne to choke. This means we are stuck with png. One day, one should try out the charting library which is based on fyne.
The graphical interface follows no known style convention and looks like it was designed by a three-year old.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment