Appendix B — mvBIMBAM Installation Hack
B.1 Mac
The motivation behind modifying the makefile was that during installation (of mvBIMBAM “first release”), test users were getting the following error:
cd src && /Applications/Xcode.app/Contents/Developer/usr/bin/make
g++ -static-libgcc -DIMPUTATION -O3 control.o fpmath.o indiv.o diploid.o haploid.o model.o param.o fp.o -lm libgsl.a libgslcblas.a -o bimbam
clang: error: unsupported option '-static-libgcc'
make[1]: *** [fp] Error 1
make: *** [all] Error 2
which suggests there is an issue with the build process. To get around this, we “hacked” a solution by modifying the Makefile (located within the src
folder). See a summary below, or a “track changes” comparison in makefile_compare_AppleIntel.docx
or makefile_compare_AppleSilicon_M1.docx
(located in the InstallationAppendix
folder of the GitHub repository) for details on how the makefile was modified.
Note that the makefile changes are different for an Apple Silicon (e.g., 2021 M1) vs. an Apple Intel. If you are not sure which Mac you have, you can click on the apple symbol in the upper left corner of your machine. If you have an Apple silicon, the Chip will be listed as Apple M1 or M2. If you have the Apple Intel, you will see the processor listed as Intel Core i5, i7, or similar.
B.1.1 APPLE INTEL INSTRUCTIONS
CHANGE A Add GSL Compiler and Linker Flags
CFLAGS += -I/usr/local/Cellar/gsl/2.7.1/include
LDFLAGS += -L/usr/local/Cellar/gsl/2.7.1/lib
These flags include the GSL headers and dynamically specify the location of the GSL libraries on a machine.
CHANGE B Update LIBS Variable. Specifically, modify:
LIBS += -lm libgsl.a libgslcblas.a
to:
LIBS += -lm -lgsl -lgslcblas
This directly links the GSL libraries for math, GSL core, and GSL CBLAS.
CHANGE C Update Compilation Command: Remove the -static-libgcc
flag. Specifically, modify this line:
fp: fp.o $(OBJS); $(CC) -static-libgcc $(CFLAGS) $(OBJS) fp.o $(LIBS) -o bimbam
to
fp: fp.o $(OBJS); $(CC) $(CFLAGS) $(OBJS) fp.o $(LIBS) -o bimbam
The -static-libgcc
flag is related to linking the GCC (GNU Compiler Collection) runtime libraries statically. However, this flag is not supported by the Clang compiler, which is commonly used on macOS (including Apple Silicon M1 Macs). By removing it, the build rule becomes compatible with Clang and more common macOS build setups.
A copy of the original Makefile, modified Makefile, and a Word document comparing the two can be found in the Install_Problems
folder.
Note that this problem has been opened as an issue on the mvBIMBAM GitHub page. Please check there for updates from the program architects.
B.1.2 APPLE SILICON (M1)
CHANGE A Add GSL Compiler and Linker Flags
CFLAGS += `gsl-config --cflags`
LIBS += `gsl-config --libs`
These flags include the GSL headers and dynamically specify the location of the GSL libraries on your machine.
CHANGE B Update LIBS Variable: Specifically, modify:
LIBS += -lm libgsl.a libgslcblas.a
to:
LIBS += -lm -lgsl -lgslcblas
This directly links the GSL libraries for math, GSL core, and GSL CBLAS.
CHANGE C Update Compilation Command: The compilation command for the “fp” target should be updated to remove the -static-libgcc
flag and add a linker. Specifically, modify:
fp: fp.o $(OBJS); $(CC) -static-libgcc $(CFLAGS) $(OBJS) fp.o $(LIBS) -o bimbam
to
fp: fp.o $(OBJS); $(CC) $(CFLAGS) $(OBJS) fp.o $(LDFLAGS) $(LIBS) -o bimbam
The -static-libgcc
flag is related to linking the GCC (GNU Compiler Collection) runtime libraries statically. However, this flag is not supported by the Clang compiler, which is commonly used on macOS (including Apple Silicon M1 Macs). By removing it, the build rule becomes compatible with Clang and more common macOS build setups.
Note also that Apple Silicon also requires the extra $(LDFLAGS)
(where Intel does not) which is used to specify linker-related flags and options that may be specific to the architecture of M1 (not needed by Intel).
A copy of the original Makefile, modified Makefile, and a Word document comparing the two can be found in the InstallationAppendix
folder of the GitHub repository.
Note that this problem has been opened as an issue on the mvBIMBAM GitHub page https://github.com/heejungshim/mvBIMBAM/issues/3. Please check there for updates from the program architects.