scythe icon indicating copy to clipboard operation
scythe copied to clipboard

Building can't find zlib and math functions on newer Ubuntu

Open feltstykket opened this issue 11 years ago • 3 comments

Will send a PR

feltstykket avatar Apr 04 '14 21:04 feltstykket

It does not seem like this issue was addressed yet. The build fails on Ubuntu Trusty (14.04.1-Ubuntu). This seems to be related to the issues reported by @feltstykket.
Error thrown (end):

In file included from src/util.c:8:0:
/usr/include/stdio.h:356:12: note: expected ‘struct FILE * restrict’ but argument is of type ‘gzFile’
 extern int fprintf (FILE *__restrict __stream,
            ^
gcc -Wall -pedantic -DVERSION=0.981 -std=gnu99 -c src/prob.c
gcc -Wall -pedantic -DVERSION=0.981 -std=gnu99 -lz -lm match.o scythe.o util.o prob.o -o scythe
scythe.o: In function `ks_getc':
scythe.c:(.text+0x18c): undefined reference to `gzread'
scythe.o: In function `ks_getuntil':
scythe.c:(.text+0x284): undefined reference to `gzread'
scythe.o: In function `main':
scythe.c:(.text+0xc54): undefined reference to `gzopen'
scythe.c:(.text+0xfaf): undefined reference to `gzclose'
scythe.c:(.text+0xfd6): undefined reference to `gzopen'
scythe.c:(.text+0x1490): undefined reference to `gzclose'
util.o: In function `ks_getc':
util.c:(.text+0x18c): undefined reference to `gzread'
util.o: In function `ks_getuntil':
util.c:(.text+0x284): undefined reference to `gzread'
prob.o: In function `qual_to_probs':
prob.c:(.text+0x115): undefined reference to `powf'
prob.c:(.text+0x183): undefined reference to `powf'
collect2: error: ld returned 1 exit status
make: *** [build] Error 1

Has this been addressed? Is there a solution somewhere?

emmaggie avatar Sep 10 '15 15:09 emmaggie

Hi @emmaggie — the issue appears to be in linking zlib. Have other applications that need zlib compiled alright on your system? For example, can you compile https://github.com/lh3/seqtk?

We had a similar issue a while ago, but we solved it by moving the order of $(LDFLAGS) in the gcc call, and that should have fixed it.

vsbuffalo avatar Sep 10 '15 20:09 vsbuffalo

Had the same issue while building sickle in Ubuntu 15.10 machine. Solved it the same way as @vsbuffalo.

In Makefile's build function:

Switch:

build: sliding.o trim_single.o trim_paired.o sickle.o print_record.o
    $(CC) $(CFLAGS) $(LDFLAGS) $(OPT) $? -o sickle $(LIBS)

To:

build: sliding.o trim_single.o trim_paired.o sickle.o print_record.o
    $(CC) $(CFLAGS) $(OPT) $? -o sickle $(LIBS) $(LDFLAGS)

Notice the order of the $(LDFLAGS) argument.

Omig12 avatar Feb 25 '16 13:02 Omig12