From 10cc3c77d5f6d385807f019b7894d4b87820cab4 Mon Sep 17 00:00:00 2001 From: Pjotr Prins Date: Sat, 15 Sep 2018 11:59:49 +0000 Subject: Using Guix container to build with gcc and clang --- INSTALL.md | 12 ++++++++++++ Makefile | 14 ++++++++++---- src/mathfunc.cpp | 15 --------------- test/dev_test_suite.sh | 2 +- test/test_suite.sh | 2 +- 5 files changed, 24 insertions(+), 21 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index be4469f..db7a6e5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -53,6 +53,18 @@ To build GEMMA from source you can opt to install the build tools with GNU Guix guix package -i make gcc linux-libre-headers gsl eigen openblas lapack glibc ld-wrapper +Even better you can create a container in the source tree and run + + guix environment -C guix --ad-hoc gcc gdb gfortran:lib gsl eigen openblas zlib bash ld-wrapper perl + make clean + make GUIX=$GUIX_ENVIRONMENT check -j 4 + +and for the Clang edition + + guix environment -C guix --ad-hoc clang gcc gdb gfortran:lib gsl eigen openblas zlib bash ld-wrapper perl + make clean + make GUIX=$GUIX_ENVIRONMENT CXX=clang++ check -j 4 + #### GNU Guix reproducible build system One of the challenges of developing software is dealing with diff --git a/Makefile b/Makefile index 047911f..97bbc68 100644 --- a/Makefile +++ b/Makefile @@ -76,15 +76,15 @@ ifeq ($(SYS), WIN) else OPENBLAS_INCLUDE_PATH = /usr/local/opt/openblas/include ifeq ($(SYS), MAC) - EIGEN_INCLUDE_PATH = /usr/local/include/eigen3 + EIGEN_INCLUDE_PATH = /usr/local/include/eigen3 else - EIGEN_INCLUDE_PATH = /usr/include/eigen3 + EIGEN_INCLUDE_PATH = /usr/include/eigen3 endif ifdef GUIX # Effectively disable paths for GNU Guix OPENBLAS_INCLUDE_PATH = . EIGEN_INCLUDE_PATH = $(GUIX)/include/eigen3 - RPATH = -Xlinker --rpath=$(GUIX)/lib + # RPATH = -Xlinker --rpath=$(GUIX)/lib PROFILE =$(realpath $(GUIX)) endif endif @@ -106,7 +106,8 @@ endif ifeq ($(CPP), clang++) # macOS Homebrew settings (as used on Travis-CI) - GCC_FLAGS=-O3 -std=c++11 -stdlib=libc++ -isystem$(OPENBLAS_INCLUDE_PATH) -isystem$(EIGEN_INCLUDE_PATH) -Wl,-L/usr/local/opt/openblas/lib + # GCC_FLAGS=-O3 -std=c++11 -stdlib=libc++ -isystem$(OPENBLAS_INCLUDE_PATH) -isystem$(EIGEN_INCLUDE_PATH) -Wl,-L/usr/local/opt/openblas/lib + GCC_FLAGS=-O3 -std=c++11 -isystem$(OPENBLAS_INCLUDE_PATH) -isystem$(EIGEN_INCLUDE_PATH) -Wl,-L/usr/local/opt/openblas/lib endif ifdef WITH_OPENBLAS @@ -119,6 +120,11 @@ ifdef WITH_OPENBLAS endif endif +ifeq ($(CXX), clang++) + # CPPFLAGS += -isystem$(GUIX)/include/c++ -isystem$(GUIX)/include/c++/x86_64-unknown-linux-gnu + CPPFLAGS += -I$(GUIX)/include/c++ -I$(GUIX)/include/c++/x86_64-unknown-linux-gnu -L$(GUIX)/lib +endif + ifdef DEBUG CPPFLAGS += -g -Og $(GCC_FLAGS) $(GSL_INCLUDE_PATH) -isystem$(EIGEN_INCLUDE_PATH) -Icontrib/catch-1.9.7 -Isrc $(RPATH) else diff --git a/src/mathfunc.cpp b/src/mathfunc.cpp index 8acbd52..21d5c09 100644 --- a/src/mathfunc.cpp +++ b/src/mathfunc.cpp @@ -604,18 +604,3 @@ double UcharToDouble02(const unsigned char c) { return (double)c * 0.01; } unsigned char Double02ToUchar(const double dosage) { return (int)(dosage * 100); } - -/* -void uchar_matrix_get_row(const vector> &X, - const size_t i_row, VectorXd &x_row) { - if (i_row < X.size()) { - for (size_t j = 0; j < x_row.size(); j++) { - x_row(j) = UcharToDouble02(X[i_row][j]); - } - } else { - std::cerr << "Error return genotype vector...\n"; - exit(1); - } -} - -*/ diff --git a/test/dev_test_suite.sh b/test/dev_test_suite.sh index 381d20a..9c2850e 100755 --- a/test/dev_test_suite.sh +++ b/test/dev_test_suite.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh gemma=../bin/gemma # gemmaopts="-debug -strict" diff --git a/test/test_suite.sh b/test/test_suite.sh index faddd43..0162d08 100755 --- a/test/test_suite.sh +++ b/test/test_suite.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/sh gemma=../bin/gemma gemmaopts="-debug" -- cgit v1.2.3