Bug#908904: /usr/include/mgl2/config.h: error: unable to find numeric literal operator ‘operator?=""=?UTF-8?Q?i’

Marius Mikucionis mmikucionis at gmail.com
Sat Sep 15 19:04:33 BST 2018


Package: libmgl-dev
Version: 2.4.2.1-2
Severity: normal
File: /usr/include/mgl2/config.h

Dear Maintainer,

The package is unusable in the context "g++ -std=c++11" or newer (c++14, c++17).
The same issue is in bug report 800460, but it is archived.
Here is a sample program:

#include <mgl2/mgl.h>
int main() {
	mglGraph gr;
	gr.FPlot("sin(pi*x)");
	gr.WriteFrame("mgl_test.svg");
}

The compiler responds as follows:

In file included from /usr/include/mgl2/abstract.h:23,
                 from /usr/include/mgl2/data_cf.h:23,
                 from /usr/include/mgl2/data.h:23,
                 from /usr/include/mgl2/mgl_cf.h:24,
                 from /usr/include/mgl2/mgl.h:23,
                 from tests.cpp:16:
/usr/include/mgl2/define.h:304:19: error: unable to find numeric literal operator ‘operator""i’
 const mdual mgl_I=_Complex_I;
                   ^~~~~~~~~~
/usr/include/mgl2/define.h:304:19: note: add ‘using namespace std::complex_literals’ (from <complex>) to enable the C++14 user-defined literal suffixes


I believe this is due to syntax clash between C99 and C++11
(C++14 introduces complex literals to support expressions like "1i").
libmgl-dev is trying to support both but C complex numbers do not make sense in C++ context.
I cannot see any userspace workaround other than downgrade my code to pre-C++11.

I propose to disable C complex numbers starting with C++11:

--- /usr/include/mgl2/config.h	2018-09-15 19:57:46.661432502 +0200
+++ /usr/include/mgl2/config.h.orig	2018-09-15 19:25:14.843095200 +0200
@@ -28,11 +28,7 @@
 #define MGL_HAVE_PTHREAD	1
 #define MGL_HAVE_PTHR_WIDGET	1
 #define MGL_HAVE_ATTRIBUTE	1
-#if defined(__cplusplus) && __cplusplus < 201103
 #define MGL_HAVE_C99_COMPLEX	1
-#else
-#define MGL_HAVE_C99_COMPLEX	0
-#endif
 #endif
 
 #define MGL_SIZEOF_LONG	8


Marius

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (900, 'testing'), (500, 'stable'), (500, 'oldstable'), (50, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libmgl-dev depends on:
ii  libgl1-mesa-dev [libgl-dev]  18.1.7-1
ii  libgsl-dev                   2.5+dfsg-5
ii  libmgl-fltk7.5.0             2.4.2.1-2
ii  libmgl-glut7.5.0             2.4.2.1-2
ii  libmgl-mpi7.5.0              2.4.2.1-2
ii  libmgl-qt5-7.5.0             2.4.2.1-2
ii  libmgl-wnd7.5.0              2.4.2.1-2
ii  libmgl-wx7.5.0               2.4.2.1-2
ii  libmgl7.5.0                  2.4.2.1-2
ii  libpng-dev                   1.6.34-2

libmgl-dev recommends no packages.

libmgl-dev suggests no packages.

-- no debconf information


More information about the debian-science-maintainers mailing list