Unable to compile when libraries are installed in separate prefixes
Similarly to the person in #540 I ran into issues compiling on macOS. Drilling through the Makefiles, it appears that the lines setting a target-specific CFLAGS variable are not working on any OS.
Retesting in Linux, by manually installing one of the dependencies (protobuf) into its own prefix, and passing a PKG_CONFIG_PATH pointing to the lib/pkgconfig path within this prefix (as well as setting PATH appropriately for protoc), I also run into the same error.
The error output is as follows:
In file included from arch/amiga/decoder.cc:10:
.obj/lib/decoders/decoders.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found
#include <google/protobuf/port_def.inc>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
The same error output appears on macOS using Homebrew, which has separate prefixes for libraries, as well as on Linux when I install protobuf into its own prefix.
I went over the GNU Make documentation for target-specific variables and tried a bunch of stuff, but I was not able to make this work correctly.
This is unlikely to happen on an Intel Mac because Homebrew uses /usr/local there, as opposed to /opt/homebrew, and /usr/local is usually automatically included.
I also own a Mac M1. I just tried to build the latest source code from here and it works. The only (new) error I get at the very end is a strange:
MAKEAPP FluxEngine.app
/bin/sh: dylibbundler: command not found
gmake: *** [src/gui/build.mk:59: FluxEngine.app] Error 127
But the fluxengine command works, I tried to dump an Amiga disk with 100% success. And the FluxEngine graphical app also works.
Concerning your issue, I experimented the same when I moved from a Mac Intel to a Mac M1. The culprit was a bad Homebrew configuration on my system: old Intel formulas co-existed with new M1 formulas. You have many possibilities to cleanly migrate from an Intel to a M1 environment. Here is all the ones I know:
- Save the list of all your Homebrew's formulas into a file "Brewfile" in the current folder:
brew bundle dump - Remove the (broken) Homebrew installation:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" - Install a new fresh Homebrew installation:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Correctly define the new homebrew's path variables:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofileAlternatively, you can define each Homebrew's path variable in any starting shell script (.bash_profile for instance, if you prefer to use bash than zsh) by manually adding the following lines in your starting shell script:export HOMEBREW_PREFIX="/opt/homebrew";export HOMEBREW_CELLAR="/opt/homebrew/Cellar";export HOMEBREW_REPOSITORY="/opt/homebrew";export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}";export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:";export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"; - Reinstall your previous formulas:
brew bundle --file Brewfile - Update Homebrew and be sure to repair any issue with your old installation:
brew doctorbrew updatebrew upgradebrew cleanup - If you previously installed the truncate formula remove it:
brew uninstall truncate - Install all the packages needed to build fluxengine:
brew install make libusb pkg-config sqlite protobuf coreutils wxwidgets fmt-> yes, you have to install coreutils and NOT truncate (deprecated), and you have to install make, because it will install gmake, the compiler you need for fluxengine. - Download the latest flux engine's source code, unzip it, go into its folder, and, finally, build it with:
gmake-> DON'T USE make.
Then everything should work.
dylibbundler is an external tool which should be installed with brew --- I've just noticed it's not in the documentation as a required dependency, sorry. (You may also want to look at .github/workflows/cccp.yml for the known-good configuration used by the CI system.)
Are the rest of the build problems something that can be fixed in the makefile? I'm inclined to think that correctly setting up a Homebrew environment would be out of scope for FluxEngine itself, but I would also like to make builds as easy as possible...
This issue has to do with the Makefile and is not specific to macOS — I provided information on how I reproduced it on Linux.
The target-specific variable part seems to be a separate issue. What version of make are you using? Older ones don't support target-specific variables, but there's supposed to be version check to prevent you using one.
This issue report is about the target specific variable problem.
I’m using the latest version of gmake from homebrew on macOS, and I updated all packages on a VM of Arch Linux ARM for the testing on Linux.
hmmm. After having installed dylibbundler, I now have a new error that goes to d235j direction:
cp: /usr/local/opt/wxwidgets/README.md: No such file or directory
and, the fact is the correct path on my machine is:
/opt/homebrew/opt/wxwidgets/README.md
so, yes, maybe there is a hard "/usr/local/" somewhere in the makefile...
Hi, about making the built easy, ... make it a Brew formula brew install fluxengine as it has been done with Open CBM best PF