vsbuffalo / scythe

A 3'-end adapter contaminant trimmer
MIT License
91 stars 38 forks source link

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

Open feltstykket opened 10 years ago

feltstykket commented 10 years ago

Will send a PR

emmaggie commented 9 years ago

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?

vsbuffalo commented 9 years ago

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.

Omig12 commented 8 years ago

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.