Skip to content

Compilation fails  #2

@mbq

Description

@mbq

I have tried compiling with the instructions provided, yet the process fails during linking. Log of make:

$ make
  CC       src/mp5-atom.o
  CC       src/mp5-cmd.o
  CC       src/mp5-dic.o
src/dic.c:978:29: warning: ‘fromDiracToSinCos’ is static but declared in inline function ‘getAtom’ which is not static
  978 |         static unsigned int fromDiracToSinCos;
      |                             ^~~~~~~~~~~~~~~~~
src/dic.c:977:29: warning: ‘fromDiracToGauss’ is static but declared in inline function ‘getAtom’ which is not static
  977 |         static unsigned int fromDiracToGauss;
      |                             ^~~~~~~~~~~~~~~~
src/dic.c:976:29: warning: ‘fromDirac’ is static but declared in inline function ‘getAtom’ which is not static
  976 |         static unsigned int fromDirac;
      |                             ^~~~~~~~~
src/dic.c:975:21: warning: ‘flag’ is static but declared in inline function ‘getAtom’ which is not static
  975 |         static char flag = NO;
      |                     ^~~~
  CC       src/mp5-io_mp5.o
src/io_mp5.c: In function ‘createNamesOfResultFiles’:
src/io_mp5.c:1010:9: warning: ‘strncat’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
 1010 |         strncat(nameOfResultsFile,mp5Parameters->nameOfDataFile,strlen(mp5Parameters->nameOfDataFile)-len);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/io_mp5.c:1010:65: note: length computed here
 1010 |         strncat(nameOfResultsFile,mp5Parameters->nameOfDataFile,strlen(mp5Parameters->nameOfDataFile)-len);
      |                                                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  CC       src/mp5-main.o
In file included from src/main.c:33:
./src/include/dic.h:37:22: warning: inline function ‘getAtom’ declared but never defined
   37 |         inline Atom* getAtom(const Dictionary *dictionary, unsigned int atomIndex);
      |                      ^~~~~~~
  CC       src/mp5-matrix.o
  CC       src/mp5-mmp.o
In file included from src/mmp.c:29:
./src/include/dic.h:37:22: warning: inline function ‘getAtom’ declared but never defined
   37 |         inline Atom* getAtom(const Dictionary *dictionary, unsigned int atomIndex);
      |                      ^~~~~~~
  CC       src/mp5-mp5.o
In file included from src/mp5.c:33:
./src/include/dic.h:37:22: warning: inline function ‘getAtom’ declared but never defined
   37 |         inline Atom* getAtom(const Dictionary *dictionary, unsigned int atomIndex);
      |                      ^~~~~~~
  CC       src/mp5-queue.o
  CC       src/mp5-r250.o
  CC       src/mp5-smp.o
In file included from src/smp.c:28:
./src/include/dic.h:37:22: warning: inline function ‘getAtom’ declared but never defined
   37 |         inline Atom* getAtom(const Dictionary *dictionary, unsigned int atomIndex);
      |                      ^~~~~~~
  CC       src/mp5-stringTools.o
  CC       src/mp5-tools.o
  CC       src/mp5-vector.o
  CC       src/mp5-random.o
  CC       src/mp5-mtwist.o
  CCLD     mp5
/usr/bin/ld: src/mp5-random.o: in function `mts_lrand':
[..]/matching-pursuit/./src/include/mtwist.h:393: multiple definition of `mts_lrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:393: first defined here
/usr/bin/ld: src/mp5-random.o: in function `mts_llrand':
[..]/matching-pursuit/./src/include/mtwist.h:419: multiple definition of `mts_llrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:419: first defined here
/usr/bin/ld: src/mp5-random.o: in function `mts_drand':
[..]/matching-pursuit/./src/include/mtwist.h:464: multiple definition of `mts_drand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:464: first defined here
/usr/bin/ld: src/mp5-random.o: in function `mts_ldrand':
[..]/matching-pursuit/./src/include/mtwist.h:480: multiple definition of `mts_ldrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:480: first defined here
/usr/bin/ld: src/mp5-random.o: in function `mt_lrand':
[..]/matching-pursuit/./src/include/mtwist.h:531: multiple definition of `mt_lrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:531: first defined here
/usr/bin/ld: src/mp5-random.o: in function `mt_llrand':
[..]/matching-pursuit/./src/include/mtwist.h:548: multiple definition of `mt_llrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:548: first defined here
/usr/bin/ld: src/mp5-random.o: in function `mt_drand':
[..]/matching-pursuit/./src/include/mtwist.h:595: multiple definition of `mt_drand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:595: first defined here
/usr/bin/ld: src/mp5-random.o: in function `mt_ldrand':
[..]/matching-pursuit/./src/include/mtwist.h:610: multiple definition of `mt_ldrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:610: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mts_lrand':
[..]/matching-pursuit/./src/include/mtwist.h:393: multiple definition of `mts_lrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:393: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mts_llrand':
[..]/matching-pursuit/./src/include/mtwist.h:419: multiple definition of `mts_llrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:419: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mts_drand':
[..]/matching-pursuit/./src/include/mtwist.h:464: multiple definition of `mts_drand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:464: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mts_ldrand':
[..]/matching-pursuit/./src/include/mtwist.h:480: multiple definition of `mts_ldrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:480: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mt_lrand':
[..]/matching-pursuit/./src/include/mtwist.h:531: multiple definition of `mt_lrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:531: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mt_llrand':
[..]/matching-pursuit/./src/include/mtwist.h:548: multiple definition of `mt_llrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:548: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mt_drand':
[..]/matching-pursuit/./src/include/mtwist.h:595: multiple definition of `mt_drand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:595: first defined here
/usr/bin/ld: src/mp5-mtwist.o: in function `mt_ldrand':
[..]/matching-pursuit/./src/include/mtwist.h:610: multiple definition of `mt_ldrand'; src/mp5-dic.o:[..]/matching-pursuit/./src/include/mtwist.h:610: first defined here
/usr/bin/ld: src/mp5-mmp.o: in function `firstIterationMMP':
[..]/matching-pursuit/src/mmp.c:383: undefined reference to `getAtom'
/usr/bin/ld: [..]/matching-pursuit/src/mmp.c:433: undefined reference to `getAtom'
/usr/bin/ld: src/mp5-mmp.o: in function `nextIterationMMP':
[..]/matching-pursuit/src/mmp.c:969: undefined reference to `getAtom'
/usr/bin/ld: [..]/matching-pursuit/src/mmp.c:894: undefined reference to `getAtom'
/usr/bin/ld: src/mp5-mmp.o: in function `firstIterationMultiChannelMultiTrial':
[..]/matching-pursuit/src/mmp.c:1336: undefined reference to `getAtom'
/usr/bin/ld: src/mp5-mmp.o:[..]/matching-pursuit/src/mmp.c:1386: more undefined references to `getAtom' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:491: mp5] Error 1

I'm using GCC 12

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions