mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00
bwa-mem2: fix compilation isssue
On latest unstable, there are several implicit function declaration. in safestrlib, which was not a seperate package but simply a submodule. It is now a separate package (see previous commit) and using latest unstable for this libary fixes the issue.
This commit is contained in:
parent
5bfb437d33
commit
6fc6d7e8ed
2 changed files with 79 additions and 15 deletions
42
pkgs/by-name/bw/bwa-mem2/no-submodule.patch
Normal file
42
pkgs/by-name/bw/bwa-mem2/no-submodule.patch
Normal file
|
@ -0,0 +1,42 @@
|
|||
diff --git a/Makefile b/Makefile
|
||||
index 359585f..13ec279 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -49,7 +49,6 @@ OBJS= src/fastmap.o src/bwtindex.o src/utils.o src/memcpy_bwamem.o src/kthread.
|
||||
src/FMI_search.o src/read_index_ele.o src/bwamem_pair.o src/kswv.o src/bwa.o \
|
||||
src/bwamem_extra.o src/kopen.o
|
||||
BWA_LIB= libbwa.a
|
||||
-SAFE_STR_LIB= ext/safestringlib/libsafestring.a
|
||||
|
||||
ifeq ($(arch),sse41)
|
||||
ifeq ($(CXX), icpc)
|
||||
@@ -101,16 +100,6 @@ CXXFLAGS+= -g -O3 -fpermissive $(ARCH_FLAGS) #-Wall ##-xSSE2
|
||||
all:$(EXE)
|
||||
|
||||
multi:
|
||||
- rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
|
||||
- $(MAKE) arch=sse41 EXE=bwa-mem2.sse41 CXX=$(CXX) all
|
||||
- rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
|
||||
- $(MAKE) arch=sse42 EXE=bwa-mem2.sse42 CXX=$(CXX) all
|
||||
- rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
|
||||
- $(MAKE) arch=avx EXE=bwa-mem2.avx CXX=$(CXX) all
|
||||
- rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
|
||||
- $(MAKE) arch=avx2 EXE=bwa-mem2.avx2 CXX=$(CXX) all
|
||||
- rm -f src/*.o $(BWA_LIB); cd ext/safestringlib/ && $(MAKE) clean;
|
||||
- $(MAKE) arch=avx512 EXE=bwa-mem2.avx512bw CXX=$(CXX) all
|
||||
$(CXX) -Wall -O3 src/runsimd.cpp -Iext/safestringlib/include -Lext/safestringlib/ -lsafestring $(STATIC_GCC) -o bwa-mem2
|
||||
|
||||
|
||||
@@ -120,12 +109,8 @@ $(EXE):$(BWA_LIB) $(SAFE_STR_LIB) src/main.o
|
||||
$(BWA_LIB):$(OBJS)
|
||||
ar rcs $(BWA_LIB) $(OBJS)
|
||||
|
||||
-$(SAFE_STR_LIB):
|
||||
- cd ext/safestringlib/ && $(MAKE) clean && $(MAKE) CC=$(CC) directories libsafestring.a
|
||||
-
|
||||
clean:
|
||||
rm -fr src/*.o $(BWA_LIB) $(EXE) bwa-mem2.sse41 bwa-mem2.sse42 bwa-mem2.avx bwa-mem2.avx2 bwa-mem2.avx512bw
|
||||
- cd ext/safestringlib/ && $(MAKE) clean
|
||||
|
||||
depend:
|
||||
(LC_ALL=C; export LC_ALL; makedepend -Y -- $(CXXFLAGS) $(CPPFLAGS) -I. -- src/*.cpp)
|
|
@ -2,6 +2,7 @@
|
|||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
safestringlib,
|
||||
zlib,
|
||||
}:
|
||||
|
||||
|
@ -13,21 +14,11 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
owner = "bwa-mem2";
|
||||
repo = "bwa-mem2";
|
||||
rev = "cf4306a47dac35e7e79a9e75398a35f33900cfd0";
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-1AYSn7nBrDwbX7oSrdEoa1d3t6xzwKnA0S87Y/XeXJg=";
|
||||
hash = "sha256-hY8nLRFWt0GAElhDIcYdUX6cJrzOE3NlYRQr0tC3on4=";
|
||||
};
|
||||
|
||||
buildInputs = [ zlib ];
|
||||
|
||||
# see https://github.com/bwa-mem2/bwa-mem2/issues/93
|
||||
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
sed -i 's/memset_s/memset8_s/g' ext/safestringlib/include/safe_mem_lib.h
|
||||
sed -i 's/memset_s/memset8_s/g' ext/safestringlib/safeclib/memset16_s.c
|
||||
sed -i 's/memset_s/memset8_s/g' ext/safestringlib/safeclib/memset32_s.c
|
||||
sed -i 's/memset_s/memset8_s/g' ext/safestringlib/safeclib/memset_s.c
|
||||
sed -i 's/memset_s/memset8_s/g' ext/safestringlib/safeclib/wmemset_s.c
|
||||
'';
|
||||
|
||||
buildFlags = [
|
||||
(
|
||||
if stdenv.hostPlatform.sse4_2Support then
|
||||
|
@ -43,14 +34,45 @@ stdenv.mkDerivation (finalAttrs: {
|
|||
)
|
||||
];
|
||||
|
||||
env = lib.optionalAttrs stdenv.hostPlatform.isDarwin {
|
||||
NIX_CFLAGS_COMPILE = toString [
|
||||
patches = [
|
||||
./no-submodule.patch
|
||||
];
|
||||
|
||||
# Also, patch the tests
|
||||
postPatch =
|
||||
# Force path to static link, otherwise, it fails at runtime to
|
||||
# find the shared library
|
||||
''
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail "-Iext/safestringlib/include" "-I${safestringlib}/include" \
|
||||
--replace-fail "-Lext/safestringlib" "-L${safestringlib}/lib"
|
||||
''
|
||||
# Make test compile by changing the compiler and path to library
|
||||
# Remove xeonbsw test that fails to compile due to missing _rdsc
|
||||
# also, not portable
|
||||
+ ''
|
||||
substituteInPlace test/Makefile \
|
||||
--replace-fail "icpc" "g++" \
|
||||
--replace-fail "../ext/safestringlib/libsafestring.a" \
|
||||
"${safestringlib}/lib/libsafestring.a" \
|
||||
--replace-fail \
|
||||
"fmi_test smem2_test bwt_seed_strategy_test sa2ref_test xeonbsw" \
|
||||
"fmi_test smem2_test bwt_seed_strategy_test sa2ref_test"
|
||||
'';
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = toString (
|
||||
lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
"-Wno-error=register"
|
||||
"-Wno-error=implicit-function-declaration"
|
||||
];
|
||||
};
|
||||
]
|
||||
);
|
||||
|
||||
nativeBuildInputs = [
|
||||
safestringlib
|
||||
];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue