falkenber9 / falcon

FALCON - Fast Analysis of LTE Control channels
GNU Affero General Public License v3.0
241 stars 74 forks source link

Build error "template with C linkage" #8

Open NerdyProjects opened 2 years ago

NerdyProjects commented 2 years ago

Trying to build falcon (AUR tudo-falcon 1.3.0-1) on a recent manjaro,

I get build errors:

[ 50%] Building CXX object src/eye/phy/CMakeFiles/eye_phy.dir/SubframeWorker.cc.o
In file included from /usr/include/glib-2.0/glib/gatomic.h:31,
                 from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/glib-2.0/gmodule.h:28,
                 from /usr/include/cmnalib/at_sierra_wireless_em7565.h:12,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/probe_modem.h:27,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/TrafficGeneratorEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/DummyEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/src/meas/DummyEventHandler.cc:21:
/usr/include/c++/11.1.0/type_traits:56:3: error: template with C linkage
   56 |   template<typename _Tp, _Tp __v>
      |   ^~~~~~~~
In file included from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/TrafficGeneratorEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/DummyEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/src/meas/DummyEventHandler.cc:21:
/home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/probe_modem.h:24:1: note: ‘extern "C"’ linkage started here
   24 | extern "C" {
      | ^~~~~~~~~~
In file included from /usr/include/glib-2.0/glib/gatomic.h:31,
                 from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/glib-2.0/gmodule.h:28,
                 from /usr/include/cmnalib/at_sierra_wireless_em7565.h:12,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/probe_modem.h:27,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/TrafficGeneratorEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/DummyEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/src/meas/DummyEventHandler.cc:21:
/usr/include/c++/11.1.0/type_traits:71:3: error: template with C linkage
   71 |   template<typename _Tp, _Tp __v>
      |   ^~~~~~~~
In file included from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/TrafficGeneratorEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/DummyEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/src/meas/DummyEventHandler.cc:21:
/home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/probe_modem.h:24:1: note: ‘extern "C"’ linkage started here
   24 | extern "C" {
      | ^~~~~~~~~~
In file included from /usr/include/glib-2.0/glib/gatomic.h:31,
                 from /usr/include/glib-2.0/glib/gthread.h:32,
                 from /usr/include/glib-2.0/glib/gasyncqueue.h:32,
                 from /usr/include/glib-2.0/glib.h:32,
                 from /usr/include/glib-2.0/gmodule.h:28,
                 from /usr/include/cmnalib/at_sierra_wireless_em7565.h:12,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/probe_modem.h:27,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/TrafficGeneratorEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/include/falcon/meas/DummyEventHandler.h:23,
                 from /home/matthias/.cache/yay/tudo-falcon/src/falcon-1.3.0/lib/src/meas/DummyEventHandler.cc:21:
/usr/include/c++/11.1.0/type_traits:80:3: error: template with C linkage
   80 |   template<bool __v>
      |   ^~~~~~~~

and am a bit too stupid to look into it myself. Any hints what requirement I am missing? :D

NerdyProjects commented 2 years ago

I temporarily downgraded glib2 to version 2.66.7-1 (as I had this lying around) and it worked :-) Found that related issue: https://gitlab.gnome.org/GNOME/glib/-/issues/2331

bastian-src commented 8 months ago

@NerdyProjects thanks a lot for your comment! With your links to the glib issue, I was able to resolve the build error such that falcon can easily be build with glib version 2.72.4 (default of Ubuntu 22.04).

Here is the patch:

It just changes the import and moves it before the `extern "C"` statement: ``` diff --git a/lib/include/falcon/meas/probe_modem.h b/lib/include/falcon/meas/probe_modem.h index 5001867..09b93e1 100644 --- a/lib/include/falcon/meas/probe_modem.h +++ b/lib/include/falcon/meas/probe_modem.h @@ -20,11 +20,12 @@ */ #pragma once +#include "cmnalib/at_sierra_wireless_em7565.h" + #ifdef __cplusplus extern "C" { #endif -#include "cmnalib/at_sierra_wireless_em7565.h" //#define DEFAULT_URL "mptcp1.pi21.de:5002" #define DEFAULT_URL "www.kn.e-technik.tu-dortmund.de" ```