Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error during compilation - code may need update with gcc 10.2.0? #7

Open
kinestetika opened this issue Apr 18, 2021 · 2 comments
Open

Comments

@kinestetika
Copy link

While making pullseq with gcc 10.2.0, I got the following error during linking:
...
gcc -g -O2 -o pullseq hash.o output.o size_filter.o search_header.o file_read.o pull_by_re.o pull_by_name.o pull_by_size.o pullseq.o -lpcre -lz
/usr/bin/ld: output.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here /usr/bin/ld: output.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here
/usr/bin/ld: output.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here /usr/bin/ld: size_filter.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here
/usr/bin/ld: size_filter.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here /usr/bin/ld: size_filter.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here
/usr/bin/ld: search_header.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here /usr/bin/ld: search_header.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here
/usr/bin/ld: search_header.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here /usr/bin/ld: file_read.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here
/usr/bin/ld: file_read.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here /usr/bin/ld: file_read.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here
/usr/bin/ld: pull_by_re.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here /usr/bin/ld: pull_by_re.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here
/usr/bin/ld: pull_by_re.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here /usr/bin/ld: pull_by_name.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here
/usr/bin/ld: pull_by_name.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here /usr/bin/ld: pull_by_name.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here
/usr/bin/ld: pull_by_size.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here /usr/bin/ld: pull_by_size.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here
/usr/bin/ld: pull_by_size.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here /usr/bin/ld: pullseq.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: multiple definition of progname'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:26: first defined here
/usr/bin/ld: pullseq.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: multiple definition of verbose_flag'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:28: first defined here /usr/bin/ld: pullseq.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: multiple definition of QUALITY_SCORE'; hash.o:/home/kinestetika/bin/util/pullseq/src/global.h:27: first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:376: pullseq] Error 1
make[2]: Leaving directory '/home/kinestetika/bin/util/pullseq/src'
make[1]: *** [Makefile:283: all] Error 2
make[1]: Leaving directory '/home/kinestetika/bin/util/pullseq/src'
make: *** [Makefile:344: all-recursive] Error 1

@ItIsI-Orient
Copy link

Adding -fcommon to CFLAGS resolved this issue for me

@GerardTromp
Copy link

GerardTromp commented Jan 18, 2023

Modern C standards require declaration of the variables in a header (.h) file as extern <variable> and then only define the variables in one code (.c) file.

Here is a patch file that cleans this up -- the final code still needs the commented out variable deleted to make it really clean. I left them in as a learning tool for my student(s).

I have modified the patchfile, it was causing some hiccups when applying.
patch -s -p0 < pullseq20230119.patch
now works flawlessly.
pullseq20230119.patch

sjaenick added a commit to MGX-metagenomics/tools that referenced this issue Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants