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

Current glib check breaks build #223

Open
matze opened this issue Nov 27, 2022 · 3 comments
Open

Current glib check breaks build #223

matze opened this issue Nov 27, 2022 · 3 comments
Assignees

Comments

@matze
Copy link
Contributor

matze commented Nov 27, 2022

This is an interesting one. The error looks like this

In file included from /usr/include/glib-2.0/glib/glib-typeof.h:39,
                 from /usr/include/glib-2.0/glib/gatomic.h:28,
                 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/gobject/gbinding.h:28,
                 from /usr/include/glib-2.0/glib-object.h:22,
                 from /home/matthias/.local/share/cenv/mesa/include/ufo-0/ufo/ufo-basic-ops.h:27,
                 from /home/matthias/.local/share/cenv/mesa/include/ufo-0/ufo/ufo.h:25,
                 from ../deps/oclfft/oclFFT.h:68,
                 from ../deps/oclfft/fft_internal.h:52,
                 from ../deps/oclfft/fft_execute.cpp:49:
/usr/include/c++/11/type_traits:3300:3: error: template with C linkage
 3300 |   template<typename _Tp>
      |   ^~~~~~~~
In file included from ../deps/oclfft/fft_internal.h:52,
                 from ../deps/oclfft/fft_execute.cpp:49:
../deps/oclfft/oclFFT.h:58:1: note: ‘extern "C"’ linkage started here
   58 | extern "C" {
      | ^~~~~~~~~~

The problem is caused by this:

  1. oclfft declares C linkage but of course needs to be compiled with a C++ compiler
  2. oclfft includes ufo.h in order to integrate with the profiling infrastructure
  3. ufo.h needs GLib which at some point checks if it is compiled with a C++ compiler (which it is) but fails because templates do not work with C linkage

I see three options:

  1. Hack around with

    #pragma push_macro("__cplusplus")
    #undef __cplusplus
    #include <ufo/ufo.h>
    #pragma pop_macro("__cplusplus")

    in oclFFT.h.

  2. Ask upstream to improve the check somehow.

  3. Drop the profiling integration.

@tfarago
Copy link
Contributor

tfarago commented Nov 29, 2022

Oh man, that's just lovely. Hopefully early next year there will be more brainpower for doing these things, postponing until then ;-) Anyway, thanks for pointing this out.

@matze
Copy link
Contributor Author

matze commented Nov 29, 2022

Well, for a quick fix, number 1 works without much brainpower. 2 relies on external factors that could take years to land (i.e. Ubuntu 24.04) and 3, well one might not want to do that anyway.

@tfarago
Copy link
Contributor

tfarago commented Feb 15, 2023

@gabs1234 could you please take a look at this? We can then discuss how to go about this on Friday, thanks a lot! It's the stuff we briefly discussed the day before yesterday.

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

3 participants