Closed texadactyl closed 3 years ago
What OS and tool versions are you using?
Xubuntu 20.10 up-to-date
gcc 4:10.2.0-1ubuntu1
gfortran 4:10.2.0-1ubuntu1
g++ 4:10.2.0-1ubuntu1
autoconf 2.69-11.1
automake 1:1.16.2-4ubuntu1
autotools-dev 20180224.1
libtool 2.4.6-14
libcfitsio-dev:amd64 3.490-3
libgsl-dev 2.6+dfsg-2
Here is what I did:
Downloaded zip file. Unzipped cd to directory
sudo apt install csh autoconf automake libtool libcfitsio-dev libgsl-dev
./bootstrap
./configure --prefix=/path/to/install
make
The file header.h
defines variables with global scope when #include
d in C source files. The header.h
header file is also included in the libsigproc_a_SOURCES
list. My guess is that linking programs that include on object file that was compiled from a C source file that #include
s header.h
with libsigproc.a results in these "multiple definitions" errors when using newer build tools. Maybe older build tools were more tolerant of this?
I think the best thing to do would be to change the declarations in header.h
to be extern
declarations and then create a globals.c
file that has the actual definitions for the global variables. The resulting object file, globals.o
, would be linked into programs that need it (or linked in with libsigproc.a, but global variables in a library just seem wrong to me). Even if this isn't the underlying cause of the errors you're seeing, it still seems like a step in the right direction.
I'll look at that tomorrow. Thanks.
@david-macmahon
I agree with your long-term solution although I found a simpler one for the short-term (only concfigure.in
). More than one *.h file would need a review and the action that you mentioned for the long-term.
I am not a big fan of global variables although I have sparingly used them with C and have used singleton objects with C++, Java, and Python. Sometimes, it comes down to a practical decision, especially with a large and complex code-set like this one.
Successfully completed the bootstrap and configure steps. When running
make
, after all of thegcc
,g++
, andgfortran
compilations are completed (oodles of warnings),ld
reports multiple duplicate symbols and aborts: