Closed paspro closed 1 year ago
A custom solution for this problem is the following:
LDRPATH="-Wl,-rpath,"
because otherwise on macOS this is an empty string.preprocessor/appli/Makefile.am
and src/apps/Makefile.am
replace the existing term with the following:# Relocatable installation
if HAVE_RELOCATABLE
ORIGINRUNPATH = $(LDRPATH)'\@loader_path/../../lib'
PLUGINRUNPATH_R = $(LDRPATH)'\@loader_path/../../lib/'$(PACKAGE)
else
PLUGINRUNPATH_N = $(LDRPATH)$(pkglibdir)
endif
On another note, for macOS in file src/base/cs_system_info.c the lines:
#if defined(__linux__)
#include <stdio.h>
#endif
have to be modified so that this include statement is active
#include <stdio.h>
because stdio.h is needed for proper compilation like in Linux.
Hello,
Regarding stdio.h
, I'll change it so that it is always included.
For LDRPATH
, this is built from an initial ldflags_rpath
variable, which should be set is in config/cs_auto_flags.sh
to be more consistent (see "default linker flags near the end). Could you confirm that "host_os" appears as "darwin" in for Mac OS so I can add the test ? There are other tests with "darwin*" in the same file.
I'll let you either propose a patch, or I can write one in the newt few days and let you test it, whichever you prefer.
Yes, it is called "darwin".
These modifications fixed the problems and code_saturne now builds correctly on macOS.
After the change to the makefiles and the introduction of the $ORIGIN parameter for relocatable builds, code_saturne can no longer compile under macOS because the native linker does not support this parameter, even when using the GNU toolchain since the native linker must always be used. The equivalent parameter for the macOS linker is called @loader_path.