esuldin / dump1090

Dump1090 is a simple Mode S decoder for RTLSDR devices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

/usr/bin/ld: CMakeFiles/view1090.dir/mode_ac.c.o:(.bss+0x0): multiple definition of `tDF'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x0): first defined here

wx4cb opened this issue · comments

any help appreciated.

root@stratux:/usr/src/dump1090/build#  cmake ../ -DHAVE_HACKRF_SUPPORT=1 -DHAVE_RTLSDR_SUPPORT=1
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2")
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Checking for module 'libhackrf'
--   Found libhackrf, version 0.5
-- Checking for module 'librtlsdr'
--   Found librtlsdr, version 0.6.0-28-g0847
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/dump1090/build
root@stratux:/usr/src/dump1090/build# make
Scanning dependencies of target view1090
[  7%] Building C object CMakeFiles/view1090.dir/anet.c.o
[ 14%] Building C object CMakeFiles/view1090.dir/interactive.c.o
[ 21%] Building C object CMakeFiles/view1090.dir/mode_ac.c.o
[ 28%] Building C object CMakeFiles/view1090.dir/mode_s.c.o
[ 35%] Building C object CMakeFiles/view1090.dir/net_io.c.o
/usr/src/dump1090/net_io.c: In function ‘modesSendSBSOutput’:
/usr/src/dump1090/net_io.c:357:5: warning: ‘ftime’ is deprecated [-Wdeprecated-declarations]
  357 |     ftime(&epocTime_now);                                         // get the current system time & date
      |     ^~~~~
In file included from /usr/src/dump1090/dump1090.h:59,
                 from /usr/src/dump1090/net_io.c:33:
/usr/include/aarch64-linux-gnu/sys/timeb.h:39:12: note: declared here
   39 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
[ 42%] Building C object CMakeFiles/view1090.dir/view1090.c.o
[ 50%] Linking C executable view1090
/usr/bin/ld: CMakeFiles/view1090.dir/mode_ac.c.o:(.bss+0x0): multiple definition of `tDF'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/view1090.dir/mode_ac.c.o:(.bss+0x40): multiple definition of `Modes'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x40): first defined here
/usr/bin/ld: CMakeFiles/view1090.dir/mode_s.c.o:(.bss+0x0): multiple definition of `tDF'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/view1090.dir/mode_s.c.o:(.bss+0x40): multiple definition of `Modes'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x40): first defined here
/usr/bin/ld: CMakeFiles/view1090.dir/net_io.c.o:(.bss+0x0): multiple definition of `tDF'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/view1090.dir/net_io.c.o:(.bss+0x40): multiple definition of `Modes'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x40): first defined here
/usr/bin/ld: CMakeFiles/view1090.dir/view1090.c.o:(.bss+0x0): multiple definition of `tDF'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/view1090.dir/view1090.c.o:(.bss+0x40): multiple definition of `Modes'; CMakeFiles/view1090.dir/interactive.c.o:(.bss+0x40): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/view1090.dir/build.make:178: view1090] Error 1
make[1]: *** [CMakeFiles/Makefile2:177: CMakeFiles/view1090.dir/all] Error 2
make: *** [Makefile:103: all] Error 2
root@stratux:/usr/src/dump1090/build#

Could you please check the code from fix_compilation_with_gcc branch and let me know it it works for you?

@esuldin

havent tried it on the target pi yet, but on the nas it seemed to work

charlesb@debnas:~/src/dump1090/build$  cmake ../ -DHAVE_HACKRF_SUPPORT=1 -DHAVE_RTLSDR_SUPPORT=1
-- The C compiler identification is GNU 9.4.0

-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE
-- Checking for module 'libhackrf'
--   Found libhackrf, version 0.5
-- Checking for module 'librtlsdr'
--   Found librtlsdr, version 0.6.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/charlesb/src/dump1090/build
charlesb@debnas:~/src/dump1090/build$
charlesb@debnas:~/src/dump1090/build$ make -j 7
[  7%] Building C object CMakeFiles/view1090.dir/anet.c.o
[ 14%] Building C object CMakeFiles/view1090.dir/interactive.c.o
[ 21%] Building C object CMakeFiles/dump1090.dir/mode_ac.c.o
[ 35%] Building C object CMakeFiles/dump1090.dir/anet.c.o
[ 35%] Building C object CMakeFiles/dump1090.dir/mode_s.c.o
[ 42%] Building C object CMakeFiles/view1090.dir/mode_ac.c.o
[ 50%] Building C object CMakeFiles/dump1090.dir/interactive.c.o
[ 57%] Building C object CMakeFiles/view1090.dir/mode_s.c.o
[ 64%] Building C object CMakeFiles/dump1090.dir/net_io.c.o
[ 71%] Building C object CMakeFiles/dump1090.dir/dump1090.c.o
[ 78%] Building C object CMakeFiles/view1090.dir/net_io.c.o
[ 85%] Building C object CMakeFiles/view1090.dir/view1090.c.o
/home/charlesb/src/dump1090/net_io.c: In function ‘modesSendSBSOutput’:
/home/charlesb/src/dump1090/net_io.c:357:5: warning: ‘ftime’ is deprecated [-Wdeprecated-declarations]
  357 |     ftime(&epocTime_now);                                         // get the current system time & date
      |     ^~~~~
In file included from /home/charlesb/src/dump1090/dump1090.h:59,
                 from /home/charlesb/src/dump1090/net_io.c:33:
/usr/include/x86_64-linux-gnu/sys/timeb.h:39:12: note: declared here
   39 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
/home/charlesb/src/dump1090/net_io.c: In function ‘modesSendSBSOutput’:
/home/charlesb/src/dump1090/net_io.c:357:5: warning: ‘ftime’ is deprecated [-Wdeprecated-declarations]
  357 |     ftime(&epocTime_now);                                         // get the current system time & date
      |     ^~~~~
In file included from /home/charlesb/src/dump1090/dump1090.h:59,
                 from /home/charlesb/src/dump1090/net_io.c:33:
/usr/include/x86_64-linux-gnu/sys/timeb.h:39:12: note: declared here
   39 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
/home/charlesb/src/dump1090/dump1090.c: In function ‘modesInit’:
/home/charlesb/src/dump1090/dump1090.c:151:5: warning: ‘ftime’ is deprecated [-Wdeprecated-declarations]
  151 |     ftime(&Modes.stSystemTimeBlk);
      |     ^~~~~
In file included from /home/charlesb/src/dump1090/dump1090.h:59,
                 from /home/charlesb/src/dump1090/dump1090.c:35:
/usr/include/x86_64-linux-gnu/sys/timeb.h:39:12: note: declared here
   39 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
/home/charlesb/src/dump1090/dump1090.c: In function ‘rtlsdrCallback’:
/home/charlesb/src/dump1090/dump1090.c:281:5: warning: ‘ftime’ is deprecated [-Wdeprecated-declarations]
  281 |     ftime(&Modes.stSystemTimeRTL[Modes.iDataIn]);
      |     ^~~~~
In file included from /home/charlesb/src/dump1090/dump1090.h:59,
                 from /home/charlesb/src/dump1090/dump1090.c:35:
/usr/include/x86_64-linux-gnu/sys/timeb.h:39:12: note: declared here
   39 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
/home/charlesb/src/dump1090/dump1090.c: In function ‘readDataFromFile’:
/home/charlesb/src/dump1090/dump1090.c:432:9: warning: ‘ftime’ is deprecated [-Wdeprecated-declarations]
  432 |         ftime(&Modes.stSystemTimeRTL[Modes.iDataIn]);
      |         ^~~~~
In file included from /home/charlesb/src/dump1090/dump1090.h:59,
                 from /home/charlesb/src/dump1090/dump1090.c:35:
/usr/include/x86_64-linux-gnu/sys/timeb.h:39:12: note: declared here
   39 | extern int ftime (struct timeb *__timebuf)
      |            ^~~~~
[ 92%] Linking C executable dump1090
[100%] Linking C executable view1090
[100%] Built target dump1090
[100%] Built target view1090
charlesb@debnas:~/src/dump1090/build$

Hello,

I had the exact same problem with my GCC version. Using the fix_compilation_with_gcc branch worked for me. I'm using the following version of GCC on Manjaro Linux :

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/12.2.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++,d --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-build-config=bootstrap-lto --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-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.0 (GCC)

In Kali-Linux 2022.04, I can confirm the following steps work:

sudo apt install libusb-dev libhackrf-dev librtlsdr-dev
git clone --branch fix_compilation_with_gcc --recurse-submodules https://github.com/esuldin/dump1090/
mkdir dump1090/build && cd $_
cmake ../ -DHAVE_HACKRF_SUPPORT=1 -DHAVE_RTLSDR_SUPPORT=1
make
$ gcc -v
...
gcc version 12.2.0 (Debian 12.2.0-13) 

Thank you for checking the fix! I appreciate your help. The fix has been included into master branch.