1 |
On Mon, 2017-02-06 at 03:17 +0700, grozin@g.o wrote: |
2 |
> Hello *, |
3 |
> |
4 |
> Sorry, I'm not a C++ expert, and I need some help. I'm trying to |
5 |
> bump |
6 |
> sci-mathematics/ginac and some of its revdeps. The current ginac is |
7 |
> 1.7.2, |
8 |
> and it needs -std=c++11 (or gnu++11). I added append-cxxflags |
9 |
> -std=c++11 |
10 |
> to src_configure; also added src_test which was missing previously. |
11 |
> ginac |
12 |
> compiles and passes tests, also ginsh works. Fine. |
13 |
> |
14 |
> The current sci-physics/nestedsums is 1.5.1, it depends on |
15 |
> > =sci-mathematics/ginac-1.7 and needs -std=c++11. I've made the |
16 |
> > necessary |
17 |
> |
18 |
> changes to the ebuild, it compiles and seems to work (its testsuite |
19 |
> is |
20 |
> broken, cannot use it). Also fine. |
21 |
> |
22 |
> Then there's sci-physics/reduze. It is still 2.1, no new versions |
23 |
> have |
24 |
> appeared. It has to be recompiles after upgrading ginac. |
25 |
> |
26 |
> If I compile it without -std=c++11, I get a lot of syntax errors in |
27 |
> .h |
28 |
> files from ginac: |
29 |
> |
30 |
> /usr/include/ginac/ptr.h:37:13: error: expected ‘;’ at end of member |
31 |
> declaration |
32 |
> /usr/include/ginac/ptr.h:37:15: error: ‘noexcept’ does not name a |
33 |
> type |
34 |
> /usr/include/ginac/ptr.h:57:31: error: ‘>>’ should be ‘> >’ within a |
35 |
> nested template argument list |
36 |
> /usr/include/ginac/ptr.h:124:44: error: expected initializer before |
37 |
> ‘noexcept’ |
38 |
> |
39 |
> etc. etc. |
40 |
> |
41 |
> If I compile it with -std=c++11, I get errors about operators from |
42 |
> stdlib: |
43 |
> |
44 |
> /var/tmp/portage/sci-physics/reduze-2.1/work/reduze- |
45 |
> 2.1/reduze/files.cpp:726:27: |
46 |
> error: no match for ‘operator<<’ (operand types are |
47 |
> ‘std::basic_ostream<char>’ and ‘std::ofstream {aka |
48 |
> std::basic_ofstream<char>}’) |
49 |
> /var/tmp/portage/sci-physics/reduze-2.1/work/reduze- |
50 |
> 2.1/reduze/functions.h:258:46: |
51 |
> error: cannot bind ‘std::basic_ostream<char>’ lvalue to |
52 |
> ‘std::basic_ostream<char>&&’ |
53 |
> |
54 |
> etc. |
55 |
> |
56 |
> Does this mean that in order to compile it stdlib should be |
57 |
> recompiled |
58 |
> with -std=c++11? Will it break all the other C++ packages in the |
59 |
> system? |
60 |
> |
61 |
> Many thanks in advance, |
62 |
> Andrey |
63 |
|
64 |
Dear Andrey, |
65 |
GCC C++ versions are in general ABI compatible, i.e. linking a package |
66 |
built against -std=c++98 will generally link against a package built |
67 |
with -std=c++11, unless you do some __cplusplus macro black magic. The |
68 |
error you're saying is caused by crappy code, mainly stuff such as |
69 |
|
70 |
std::cout << std::cout |
71 |
|
72 |
for instance, which is broken, wrong and overall meaningless. In C++98 |
73 |
this used to compile, as the void* conversion operator was implicitly |
74 |
called, printing the address of the std::cout global object. This |
75 |
conversion operator has been removed in C++11 in favour of the save |
76 |
bool idiom, and hence this code won't compile anymore. So: |
77 |
|
78 |
1) You will likely require C++11 |
79 |
2) and you will need to fix the crappy code in sci-physics/reduze |
80 |
|
81 |
if you're on IRC, we can discuss this a bit, I don't want to litter the |
82 |
mailing list with tips on how to make code C++11 ready. If I have time |
83 |
next week I could maybe look at it. |
84 |
|
85 |
Regards |
86 |
David |