I suppose I owe the project an update on my attempts to build SALSA on FreeBSD. I can summarize by saying that I have not been successful so far, although it hasn't been a complete bust, and out of frustration I've resorted to installing SALSA 1.15 on Windows 10, on a Virtualbox instance, on a MacBook Pro. This basically works, although slowly.
Following is a fairly lengthy description of what I've done, in hopes it will be useful to anyone else wanting to do a build. I can't, of course, guarantee this will work for anyone else, but it might help them avoid needing to take the 1,000+ lines of notes that I took so far detailing all the dead ends I got myself into and then out of. Happy to diff my working directory against the published set and send a patch if that would be useful to show my work.
The environment that I wound up with was:
- GPSTk 2.12, as noted above.
- SWIG 2.0.12
- Doxygen 1.9.5
- CMake 3.24.0
- TexLive 20210325
- HDF5 1.12.2
- Base zlib
- QuaZIP-QT5 1.3
- Mesa 21.3.8. I'm using the graphics/mesa-dri and graphics/mesa-libs ports.
- Eigen 3.4.0
- QT5 5.15.5p165
- Marble 22.08.1 (which definitely caused trouble later)
- Probably a few other relevant dependencies and sub-dependencies I haven't counted.
GPSTk fought me a bit installing it manually, which I had to do since the Ports version is up to 8.0.0, mostly due to it not looking in the right places for its dependencies. I got that fixed, but this turned out to be a recurring issue once I got to actually building SALSA. I managed to get it straightened by setting environment variables as follows:
- $gpstk=$HOME/.local/gpstk
- $marble=/usr/local
- $eigen3=/usr/local/include/eigen3
- $QWT=/usr/local
- $CMAKE_PREFIX_PATH=/usr/local
Many of these result from FreeBSD's habit of putting third-party libraries and binaries in /usr/local rather than directly under /usr.
The provided CMake file searches for libqwt.so, which is actually installed for me as libqwt6.so.6. I had to tweak the CMake file to look for that instead. I think this may just be a difference between Debian and FreeBSD and how they handle installing libraries.
There is an unlisted dependency on the QT5 build tools. On FreeBSD, these are in devel/qt5-qmake (for qmake) and devel/qt5-buildtools (for moc and rcc).
The CMake process looks for "/usr/local/lib/marble/plugins/libAnnotatePlugin.so" and fails to find it. This traces back to it seeking the Marble plugins by prepending "${MARBLE_LIBRARY_DIRS}/marble/plugins/lib" to a list of plugins, which includes AnnotatePlugin. Those files are actually installed for me as AnnotatePlugin.so and so on, so I had to trim off the "lib" from the end of that prepend.
The CMake process locked up for me looking for an X server, and as I was building via SSH, it didn't have one. Opening an X session didn't actually help this at all, either. This was totally weird, but as it turns out, it was a simple problem. CMake was trying to run scripts/build/scrapePublicTestNames.py, but apparently it didn't grasp that's a Python script, so it just ran it as a shell script. It hits an "import" command, and it turns out that "import" for me is an X Windows utility to do a screen capture. (This comes with ImageMagick 6 according to my port records.) So, rather than importing a Python module, it was trying to capture an X screen, and since it's not formatted for the import command, widespread confusion results. The fix was to insert a shebang at the top of scrapePublicTestNames.py: "#!/usr/bin/env python3". This explicitly passes the script into Python where it operates properly.
CMake couldn't locate QuaZip. Partly this was it looking in /usr/lib rather than /usr/local/lib as noted above. Partly this was it looking for a filename I did not have. I have QuaZip installed as libquazip1-qt5.so and so on, and adding that to the CMake helped. CMake was also looking in /usr/include and /usr/local/include and the quazip subdirectories of each, but my QuaZip include is in /usr/local/include/QuaZip-Qt5-1.2/quazip. (I can't say I agree with that plan, but the port didn't ask me.) Tweaking the CMake file fixed that.
So far, this has all gone to get CMake to write the build files. Actually building the program introduced a couple of others.
Even with these edits, there were a few missed includes. In file src/lsacommon/expandpath.cpp, there is an include for <linux/limits.h> that (as you might expect) FreeBSD does not have. This turns out to be a simple enough one, since the FreeBSD limits.h itself already includes /usr/include/sys/syslimits.h, its equivalent to the Linux limits.h, so in short the include for <linux/limits.h> isn't needed.
In HistogramDialog.hpp, included file qwt_plot_histogram.h wasn't found. That comes down to needing the CMake file to set QWT_INCLUDE_DIRS to $QWT/include/qt5/qwt6 for how I have QWT installed. Similarly, CMake sets QMAKE_INCLUDE_DIRS to end in /quazip (for me, /usr/local/include/QuaZip-Qt5-1.2/quazip), but in src/gui/mapping.hpp the include is phrased as #include <quazip/JlCompress.h>. In other words, the include statement repeats the quazip directory. I think I fixed that by dropping the extra directory from the include, but it could probably also be fixed in CMake.
Now, I don't think it is a porting problem so much, but mapping.hpp also seems to omit a couple of necessary headers. Checking my working file, I had to add the following for various compilation errors:
#include <marble/GeoDataLineStyle.h>
#include <marble/GeoDataLinearRing.h>
#include <marble/GeoDataPolyStyle.h>
#include <marble/GeoDataLatLonAltBox.h>
#include <marble/GeoWriter.h>
#include <marble/GeoDataLookAt.h>
I'm not sure whether this reflects changes in the Marble API since version 16 or differences of installations.
Speaking of Marble, I didn't run the patch against my Marble version: since I was trying to build against current Marble, the patches would not quite work. (My notes aren't clear on the point, but I think they may not have worked against Marble 16.04 either, at least not the way I downloaded it.) The key problems this raised are that remoteIconLoader.h and FileManager.h aren't available without patching the Marble install. I did think through a couple of ways to fix this so they won't be required. For the file thing, I switched to GeoWriter::write, which appears to do the same thing and is in the published Marble API. For the remoteIconLoader calls, I just commented them out to get the build to work. I have not tested either of these so far, but they did remove the need for those two headers so the build could proceed.
At src/lsacommon/geoid.cpp:263, there is a call to
dataset.read(undulationsBuffer,H5::PredType::NATIVE_FLOAT,memspace,filespace,H5P_DEFAULT);
that fails to compile because it doesn't like the last argument, complaining that it's an ambiguous conversion from int to const H5::DSetMemXferPropList. The HDF5 documents do list H5P_DEFAULT as legal for the Fortran implementation, but also say that the final argument can be omitted to let it default to, well, DEFAULT. I took that shortcut.
This more or less let the program be built. It segfaults, however. I have pages of notes on this, but at its heart the segfault comes in when mapping.cpp calls into sortPointsInFolders() and hits:
std::sort(POSGFolder->begin(), POSGFolder->end(), Mapping::sortManner);
Calling POSGFolder->begin() seems to end up dereferencing a nearly-null pointer. My first impression is that this was a result of calling the function while the folder was empty, assuming that begin (and end) were uninitialized or undefined, or something like that. I fixed that by testing whether POSGFolder (and the other three being sorted here) is empty before going into the sort. This was enough to get the program to run, anyway, and it opens a window and looks fine. Opening a project file still crashes the program, however, because it calls sortPointsInFolders() again, and this time the folders aren't empty, so it goes through to the begin() method and segfaults. This problem appears to be in Marble and was reported in their bug tracker as bug number
458555. (I am somehow reassured to see that Sarah reported this originally.)
As limited as it is, I am at least able to get SALSA started at this point. It does report "ERROR - Unable to find . Unable to import instrumentation output." I haven't started trying to track that down and for the moment it does not seem to be affecting anything. The mapping widget does seem to work, at least: I'm able to open the base map and pan around the globe quite naturally. I am tempted to just comment out the sortPointsInFolders function to continue testing until KDE can address the bug report, but I want to put this aside for a little while.
Although I can get everything installed and apparently working on Windows 10, it is, as I noted, running in a virtual environment and is consequently quite slow to respond. I would still like to get this working on FreeBSD for better performance, so I don't think I'm ready to abandon the attempt.