Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to build, "error: template with C linkage" #1083

Open
alerque opened this issue Apr 6, 2021 · 20 comments
Open

Unable to build, "error: template with C linkage" #1083

alerque opened this issue Apr 6, 2021 · 20 comments

Comments

@alerque
Copy link
Contributor

alerque commented Apr 6, 2021

Arch Linux recently updated the SWORD library in the official repos. This makes the unofficial SVN one I've been hosting to provide Xiphos builds obsolete and the current builds are dead.

In trying to update and for some reason I can't rebuild Xiphos at all. I've tried with both the official SWORD 1.9.0 package and and updated SVN release and got nowhere.

The errors start here and go on ad nauseam:

[  6%] Building CXX object src/main/CMakeFiles/main.dir/configs.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/gtk-3.0/gdk/gdkconfig.h:8,                                                                                                                                                    
                 from /usr/include/gtk-3.0/gdk/gdk.h:30,                                                                                                                                                         
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,                                                                                                                                                         
                 from /home/caleb/projects/aur/xiphos-git/src/xiphos/src/main/sword.h:28,                                                                                                                        
                 from /home/caleb/projects/aur/xiphos-git/src/xiphos/src/main/configs.cc:28:                                                                                                                     
/usr/include/c++/10.2.0/type_traits:56:3: error: template with C linkage                                                                                                                                         
   56 |   template<typename _Tp, _Tp __v>                                                                                                                                                                        
      |   ^~~~~~~~                                                                                                                                                                                               
In file included from /home/caleb/projects/aur/xiphos-git/src/xiphos/src/main/configs.cc:28:                                                                                                                     
/home/caleb/projects/aur/xiphos-git/src/xiphos/src/main/sword.h:26:1: note: ‘extern "C"’ linkage started here                                                                                                    
   26 | 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/gtk-3.0/gdk/gdkconfig.h:8,                                                                                                                                                    
                 from /usr/include/gtk-3.0/gdk/gdk.h:30,                                                                                                                                                         
                 from /usr/include/gtk-3.0/gtk/gtk.h:30,                                                                                                                                                         
                 from /home/caleb/projects/aur/xiphos-git/src/xiphos/src/main/sword.h:28,                                                                                                                        
                 from /home/caleb/projects/aur/xiphos-git/src/xiphos/src/main/configs.cc:28:                                                                                                                     
/usr/include/c++/10.2.0/type_traits:71:3: error: template with C linkage                                                                                                                                         
   71 |   template<typename _Tp, _Tp __v>
      |   ^~~~~~~~
@karlkleinpaste
Copy link
Contributor

i'm really not sure what to tell you. fedora has had sword 1.9 since christmas eve, and the obligatory xiphos rebuild appeared the same day. all is good here.

@greg-hellings ?

@greg-hellings
Copy link
Contributor

Xiphos hasn't been building the entirety of the Fedora 34 rawhide/beta cycle. Same error. Something has changed in the toolchain and I haven't the slightest idea what it is.

@alerque
Copy link
Contributor Author

alerque commented Apr 9, 2021

Some fresh gcc update perhaps?

@greg-hellings
Copy link
Contributor

Some fresh gcc update perhaps?

gcc or glibc. I'm not sure which it would be

@ildar
Copy link

ildar commented Apr 14, 2021 via email

@ildar
Copy link

ildar commented Apr 15, 2021 via email

@ildar
Copy link

ildar commented Apr 15, 2021 via email

@alerque
Copy link
Contributor Author

alerque commented Apr 15, 2021

Thanks for the info. I left a machine compiling gcc-9 last night and tried it this morning with no luck. I'll look into the glib work around you posted.

@alerque
Copy link
Contributor Author

alerque commented Apr 15, 2021

Wow thanks for tracking that down. I can confirm the suggestion works to get Xiphos compiling again on Arch Linux. For now I've add this patch to the packaging just to get things running again, but clearly the right thing to do is figure out what the proper fix is and apply it here upstream.

@karlkleinpaste
Copy link
Contributor

it wouldn't have been the compiler itself in any event, as f33 has had 10 all along:

$ gcc --version
gcc (GCC) 10.2.1 20201125 (Red Hat 10.2.1-9)

thanx to @ildar for the discovery.

@greg-hellings
Copy link
Contributor

Recently came across this suggestion due to upcoming changes in Fedora Rawhide (dealing with autotools). But, they suggest, it's no longer necessary to do extern "C" calls for GLib headers from C++ code. It seems related to what we're looking at here. https://src.fedoraproject.org/rpms/dasher/c/0b0c2b17e6cf68766bb828a4b51ed539b8381961?branch=rawhide

@ildar
Copy link

ildar commented Apr 26, 2021 via email

@greg-hellings
Copy link
Contributor

How new of GLib, though? Our real issue is we want to stay on a downright archaic version of GTK+. I don't think we have a specific need to stay on older GLib except where it is necessary for our older GTK+ dependency.

I don't know when GLib began to support C++, but I do know it is currently incorrect to include GLib headers in an extern "C" declaration.

@ildar
Copy link

ildar commented Apr 28, 2021 via email

@karlkleinpaste
Copy link
Contributor

if we apply @alerque 's patch above -- a 1-line addition to cmake/config.h.cmake.in -- is that sufficient to get us back into business in F34? i'm still on F33 and can't afford to make the jump forward yet.

@greg-hellings
Copy link
Contributor

Yes, his patch fixes us up on Fedora. We are live in F34 and Rawhide again with that change. We do need to spread the patch to others as well. I just got a notice that SUSE builds have also started failing. Presumably for the same reason. Presumably other distros will as well as they update. Glib maintainers have rejected fixing this in their code base, instead preferring to tell applications it is their responsibility to properly not call their headers with extern. So we should adopt some form of final fix into Xiphos based on detected Glib versions.

@karlkleinpaste
Copy link
Contributor

We are live in F34 and Rawhide again with that change.

does this mean that a working build is in testing now?

@greg-hellings
Copy link
Contributor

netgate-git-updates pushed a commit to pfsense/FreeBSD-ports that referenced this issue Jul 24, 2021
@LAfricain
Copy link
Contributor

I have also a build problem with Ubuntu:

In file included from /home/cyrille/Documents/github/xiphos/src/webkit/wk-html.c:37:
/home/cyrille/Documents/github/xiphos/src/webkit/wk-html.h:30:10: fatal error: webkit/webkit.h: Aucun fichier ou dossier de ce type
   30 | #include <webkit/webkit.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/webkit/CMakeFiles/webkit.dir/build.make:71 : src/webkit/CMakeFiles/webkit.dir/wk-html.c.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:525 : src/webkit/CMakeFiles/webkit.dir/all] Erreur 2
make[1]: *** Attente des tâches non terminées....
[  3%] Building C object src/editor/CMakeFiles/editor.dir/editor.c.o
[  4%] Building C object src/editor/CMakeFiles/editor.dir/webkit_editor.c.o
/home/cyrille/Documents/github/xiphos/src/editor/webkit_editor.c:32:10: fatal error: webkit/webkit.h: Aucun fichier ou dossier de ce type
   32 | #include <webkit/webkit.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/editor/CMakeFiles/editor.dir/build.make:89 : src/editor/CMakeFiles/editor.dir/webkit_editor.c.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
[  4%] Building CXX object src/main/CMakeFiles/main.dir/configs.cc.o
/home/cyrille/Documents/github/xiphos/src/editor/editor.c:35:10: fatal error: webkit/webkit.h: Aucun fichier ou dossier de ce type
   35 | #include <webkit/webkit.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/editor/CMakeFiles/editor.dir/build.make:76 : src/editor/CMakeFiles/editor.dir/editor.c.o] Erreur 1
make[1]: *** [CMakeFiles/Makefile2:471 : src/editor/CMakeFiles/editor.dir/all] Erreur 2
[  6%] Building CXX object src/main/CMakeFiles/main.dir/display.cc.o
In file included from /home/cyrille/Documents/github/xiphos/src/xiphos_html/xiphos_html.h:29,
                 from /home/cyrille/Documents/github/xiphos/src/main/display.cc:44:
/home/cyrille/Documents/github/xiphos/src/webkit/wk-html.h:30:10: fatal error: webkit/webkit.h: Aucun fichier ou dossier de ce type
   30 | #include <webkit/webkit.h>
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/main/CMakeFiles/main.dir/build.make:89 : src/main/CMakeFiles/main.dir/display.cc.o] Erreur 1
make[2]: *** Attente des tâches non terminées....
[  6%] Building CXX object src/backend/CMakeFiles/backend.dir/sword_main.cc.o
make[1]: *** [CMakeFiles/Makefile2:498 : src/main/CMakeFiles/main.dir/all] Erreur 2
[  7%] Linking CXX static library libbackend.a
[  7%] Built target backend
make: *** [Makefile:152 : all] Erreur 2

@ildar
Copy link

ildar commented Aug 4, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants