UCBerkeleySETI / bl_sigproc

Breakthrough Listen fork of SigProc tools
2 stars 0 forks source link

`make` results in `ld` abort #10

Closed texadactyl closed 3 years ago

texadactyl commented 3 years ago

Successfully completed the bootstrap and configure steps. When running make, after all of the gcc, g++, and gfortran compilations are completed (oodles of warnings), ld reports multiple duplicate symbols and aborts:

/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:8: multiple definition of `isign'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:8: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `az_start'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `src_raj'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `za_start'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `src_dej'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `tstart'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `tsamp'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `fch1'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:18: multiple definition of `frequency_table'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:18: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `foff'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: multiple definition of `nchans'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: multiple definition of `telescope_id'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: multiple definition of `machine_id'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: multiple definition of `data_type'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:7: multiple definition of `ibeam'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:7: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:7: multiple definition of `nbeams'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:7: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: multiple definition of `nbits'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:4: multiple definition of `barycentric'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:4: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:4: multiple definition of `pulsarcentric'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:4: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: multiple definition of `nifs'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:19: multiple definition of `npuls'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:19: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `refdm'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:2: multiple definition of `source_name'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:2: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:2: multiple definition of `rawdatafile'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:2: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:15: multiple definition of `analog_power'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:15: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:14: multiple definition of `culprits'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:14: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:13: multiple definition of `project'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:13: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:12: multiple definition of `wapp_scan_number'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:12: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:11: multiple definition of `lst0'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:11: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:11: multiple definition of `ast0'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:11: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:10: multiple definition of `srcb'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:10: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:10: multiple definition of `srcl'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:10: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: multiple definition of `raw_foff'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: multiple definition of `raw_fch1'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: multiple definition of `header_tobs'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: multiple definition of `gal_b'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: multiple definition of `gal_l'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:6: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: multiple definition of `mjdobs'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:5: first defined here
/usr/bin/ld: read_header.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: multiple definition of `scan_number'; readtim.o:/home/elkins/Downloads/bl_sigproc-master/src/header.h:3: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: multiple definition of `nsmax'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: multiple definition of `nsubband'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: multiple definition of `ndm'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: multiple definition of `input_file'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: multiple definition of `file_name'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: multiple definition of `thresh'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: multiple definition of `iterate'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: first defined here
/usr/bin/ld: open_files.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:50: multiple definition of `optind'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:50: first defined here
/usr/bin/ld: open_files.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:55: multiple definition of `opterr'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:55: first defined here
/usr/bin/ld: open_files.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:36: multiple definition of `optarg'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:36: first defined here
/usr/bin/ld: open_files.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: multiple definition of `iindx'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: multiple definition of `nsmax'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: multiple definition of `nsubband'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: multiple definition of `ndm'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: multiple definition of `input_file'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: multiple definition of `file_name'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: multiple definition of `thresh'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: multiple definition of `iterate'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:20: multiple definition of `optind'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:50: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:19: multiple definition of `opterr'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:55: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:18: multiple definition of `optarg'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:36: first defined here
/usr/bin/ld: single_ch.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: multiple definition of `iindx'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: multiple definition of `nsmax'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: multiple definition of `nsubband'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: multiple definition of `ndm'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: multiple definition of `input_file'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: multiple definition of `file_name'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: multiple definition of `thresh'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: multiple definition of `iterate'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: first defined here
/usr/bin/ld: write_pulses.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:50: multiple definition of `optind'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:50: first defined here
/usr/bin/ld: write_pulses.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:55: multiple definition of `opterr'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:55: first defined here
/usr/bin/ld: write_pulses.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:36: multiple definition of `optarg'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:36: first defined here
/usr/bin/ld: write_pulses.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: multiple definition of `iindx'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: multiple definition of `iindx'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:11: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: multiple definition of `nsmax'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:33: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: multiple definition of `nsubband'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:31: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: multiple definition of `ndm'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:29: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: multiple definition of `input_file'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:27: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: multiple definition of `file_name'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:26: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: multiple definition of `thresh'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:24: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: multiple definition of `iterate'; pulse.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:22: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:20: multiple definition of `optind'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:50: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:19: multiple definition of `opterr'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:55: first defined here
/usr/bin/ld: thresh_1d.o:/home/elkins/Downloads/bl_sigproc-master/src/pulse.h:18: multiple definition of `optarg'; pulse.o:/usr/include/x86_64-linux-gnu/bits/getopt_core.h:36: first defined here
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:1341: seek] Error 1
make[3]: Leaving directory '/home/elkins/Downloads/bl_sigproc-master/src'
make[2]: *** [Makefile:1088: all] Error 2
make[2]: Leaving directory '/home/elkins/Downloads/bl_sigproc-master/src'
make[1]: *** [Makefile:444: all-recursive] Error 1
make[1]: Leaving directory '/home/elkins/Downloads/bl_sigproc-master'
make: *** [Makefile:376: all] Error 2
david-macmahon commented 3 years ago

What OS and tool versions are you using?

texadactyl commented 3 years ago

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

texadactyl commented 3 years ago

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
david-macmahon commented 3 years ago

The file header.h defines variables with global scope when #included 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 #includes 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.

texadactyl commented 3 years ago

I'll look at that tomorrow. Thanks.

texadactyl commented 3 years ago

@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.