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

multiple definition of `THREAD_NUM' during compilation #10

Open
maxdudek opened this issue Aug 25, 2023 · 0 comments
Open

multiple definition of `THREAD_NUM' during compilation #10

maxdudek opened this issue Aug 25, 2023 · 0 comments

Comments

@maxdudek
Copy link

Hi,

After running make I got the following output and error:

gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/esthmm.o src/esthmm.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/BaumWelch.o src/BaumWelch.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/nrutil.o src/nrutil.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/hmmutils.o src/hmmutils.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/emutils.o src/emutils.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/logmath.o src/logmath.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/fwd_bwd.o src/fwd_bwd.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/viterbi.o src/viterbi.c
gcc -fopenmp -DNDEBUG -D_FORTIFY_SOURCE=2 -O2  -c -o src/fileutils.o src/fileutils.c
gcc -fopenmp -fcommon -lgsl -lgslcblas -o TRACE src/esthmm.o src/nrutil.o \
    src/emutils.o src/hmmutils.o src/logmath.o src/fwd_bwd.o \
    src/BaumWelch.o src/viterbi.o src/fileutils.o -lm
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/nrutil.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/nrutil.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/emutils.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/emutils.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/hmmutils.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/hmmutils.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/logmath.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/logmath.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/fwd_bwd.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/fwd_bwd.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/BaumWelch.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/BaumWelch.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/viterbi.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/viterbi.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/fileutils.o:(.bss+0x0): multiple definition of `THREAD_NUM'; src/esthmm.o:(.bss+0x0): first defined here
/cm/shared/easybuild/software/binutils/2.38-GCCcore-11.3.0/bin/ld: src/fileutils.o:(.bss+0x4): multiple definition of `MAXITERATION'; src/esthmm.o:(.bss+0x4): first defined here
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: TRACE] Error 1

After troubleshooting and following this advice I added -fcommon to CFLAGS in the Makefile and that fixed it. Not sure if that will cause other problems down the road but I thought I'd post here in case anyone else has the same problem.

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

1 participant