I am trying to compile the scotch
library embedded into the OpenFOAM.org third-party repository here. I ran the command
make -C ./ThirdParty-dev/scotch_6.0.9/src/
and I get the below error message:
(cd libscotch ; make VERSION=6 RELEASE=0 PATCHLEVEL=9 scotch && make install) make \ CC="gcc" \ CCD="gcc" \ scotch.h \ scotchf.h \ libscotch.so \ libscotcherr.so \ libscotcherrexit.so gcc -O3 -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME -Drestrict=__restrict -DSCOTCH_VERSION_NUM=6 -DSCOTCH_RELEASE_NUM=0 -DSCOTCH_PATCHLEVEL_NUM=9 dummysizes.c -o dummysizes -Xlinker --no-as-needed -lz -lm -lrt ld: unknown option: --no-as-needed clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [dummysizes] Error 1 make[1]: *** [scotch] Error 2 make: *** [libscotch] Error 2
I am not sure what this error message means. If it is complaining about scotch
not being available, that's why I'm compiling it in the first place. Out of desperation, I also tried to install it via brew install scotch
to no avail. I would appreciate it if you could help me understand the above error message and resolve the issue.
CodePudding user response:
The scotch build is a bit different in that they manage all of the OS/compiler-specific bits separately via a src/Makefile.inc
that the user is responsible for providing. Of course they also provide a number of examples in the src/Make.inc/ directory, but they may not properly cover your particular OS/compiler requirements.
Since you grabbed the scotch source files from a third-party source instead of from the pristine upstream sources, you also have someone else's src/Makefile.inc
that happens to be a Linux-specific version. So no surprise that it has incorrect link (or even compile) options.
The Darwin-specific makefile adjustments that are used by openfoam.com:
# Linux:
LIB = .so
ARFLAGS = $(WM_CFLAGS) -shared -o
LDFLAGS = -Xlinker --no-as-needed $(WM_LDFLAGS) -lm -lrt
# Darwin:
LIB = .dylib
ARFLAGS = $(WM_CFLAGS) -dynamiclib -undefined dynamic_lookup -o
LDFLAGS = $(WM_LDFLAGS) -lm
Without worrying about any other source of differences (in the OpenFOAM WM_CFLAGS
and WM_LDFLAGS
variables), it would appear that you are using Linux (gcc only?) link options for Darwin - so should be no surprise that they don't work.
CodePudding user response:
The scotch build is a bit different in that they manage all of the OS/compiler-specific bits separately via a src/Makefile.inc
that the user is responsible for providing. Of course they also provide a number of examples in the src/Make.inc/ directory, but they may not properly cover your particular OS/compiler requirements.
Since you grabbed the scotch source files from a third-party source instead of from the pristine upstream sources, you also have someone else's src/Makefile.inc
that happens to be a Linux-specific version. So no surprise that it has incorrect link (or even compile) options.
The Darwin-specific makefile adjustments that are used by openfoam.com:
# Linux:
LIB = .so
ARFLAGS = $(WM_CFLAGS) -shared -o
LDFLAGS = -Xlinker --no-as-needed $(WM_LDFLAGS) -lm -lrt
# Darwin:
LIB = .dylib
ARFLAGS = $(WM_CFLAGS) -dynamiclib -undefined dynamic_lookup -o
LDFLAGS = $(WM_LDFLAGS) -lm
Without worrying about any other source of differences (in the OpenFOAM WM_CFLAGS
and WM_LDFLAGS
variables), it would appear that you are using Linux (gcc only?) link options for Darwin - so should be no surprise that they don't work.