brentp / hts-nim

nim wrapper for htslib for parsing genomics data files

Home Page:https://brentp.github.io/hts-nim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Static build with libRmath-nim library causing undefined reference

ruqianl opened this issue · comments

Hi @brentp ,

I have been trying to build static binaries of my CLT [sscocaller] (https://gitlab.svi.edu.au/biocellgen-public/sscocaller.git) some of the instructions from your hts_nim_static_builder. On top of hts-nim, sscocaller also depends on the libRmath-nim library and I have been getting the undefined reference error.

I have used the docker image:

docker run -it -v $PWD:/mnt/mcfiles/ brentp/musl-hts-nim /bin/bash
and then nsb

/usr/local/bin/nsb -s src/sscocaller.nim -n sscocaller.nimble -- --d:release --threads:on

@m..@s..@s..@sroot@s.nimble@spkgs@sdistributions-0.1.0@sdistributions@srmath.nim.c:(.text+0x15): undefined reference to `dbinom'

/usr/lib/gcc/x86_64-alpine-linux-musl/9.3.0/../../../../x86_64-alpine-linux-musl/bin/ld: /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sdistributions-0.1.0@sdistributions@srmath.nim.c.o: in function dbinom__UYyjXXE0GgmIfuGpc2rPqA': @m..@s..@s..@sroot@s.nimble@spkgs@sdistributions-0.1.0@sdistributions@srmath.nim.c:(.text+0x15): undefined reference to dbinom'
collect2: error: ld returned 1 exit status
Error: execution of an external program failed: 'gcc -o /mnt/mcfiles/src/xx_exe_out /root/.cache/nim/sscocaller_r/stdlib_assertions.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_dollars.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_locks.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_sharedlist.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_formatfloat.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_io.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_system.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_parseutils.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_math.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_algorithm.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_unicode.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_strutils.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_times.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_os.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_hashes.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_tables.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_sequtils.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_sets.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sunicodedb-0.9.0@sunicodedb@sproperties_data.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sunicodedb-0.9.0@sunicodedb@sproperties.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@scommon.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@snodetype.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@snfa.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sunicodedb-0.9.0@sunicodedb@stypes_data.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sunicodedb-0.9.0@sunicodedb@stypes.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sunicodeplus-0.8.0@sunicodeplus.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@snodematch.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@slitopt.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@snfatype.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@snfafindall.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sregex-0.16.2@sregex@snfamacro.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sdocopt-0.6.8@sdocopt@sutil.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sdocopt-0.6.8@sdocopt.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@shts-0.3.12@shts@sprivate@shts_concat.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_strformat.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@shts-0.3.12@shts@sbam.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@shts-0.3.12@shts@svcf.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@shts-0.3.12@shts.nim.c.o /root/.cache/nim/sscocaller_r/@m..@s..@s..@sroot@s.nimble@spkgs@sdistributions-0.1.0@sdistributions@srmath.nim.c.o /root/.cache/nim/sscocaller_r/stdlib_streams.nim.c.o /root/.cache/nim/sscocaller_r/@msscocaller.nim.c.o -pthread -lm -lrt -static -no-pie -fno-pie /usr/lib/libm.a /usr/local/lib/libhts.a /usr/local/lib/libdeflate.a /usr/local/lib/libz.a /usr/local/lib64/libzip.a /usr/lib/libbz2.a /usr/lib/liblzma.a /usr/lib/libpthread.a /usr/lib/libopenblas.a /usr/lib/libgfortran.a /usr/lib/libquadmath.a /usr/lib/libssl.a /usr/lib/libcrypto.a /usr/lib/libdl.a /usr/lib/libc.a /usr/lib/librt.a /usr/lib/libpcre.a /usr/lib/libd4binding.a -ldl'
error compiling code

I was wondering if you any idea/suggestion/direction of where to look at to fix this.

Thank you very much.
Ruqian

Hi,
sorry for delay. I would take the docker file and the directory and add R (and libRmath libraries if they aren't installed by default) to the docker file and add path to libRmath.a (If that's what it's called.) to docker/docker.nim.cfg.

Let me know if any questions.
-Brent

Hi Brent,

Thanks a lot! That worked!

https://gitlab.svi.edu.au/biocellgen-public/sscocaller

Best,
Ruqian