These are chat archives for dropbox/pyston

7th
Jun 2016
Cullen Rhodes
@c-rhodes
Jun 07 2016 11:04

Hi, I'm following the build instructions and I've hit an error:

../../src/runtime/float.cpp:1355:13: error: use of undeclared identifier 'isinf'
if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x))
^
from_cpython/Include/pymath.h:121:31: note: expanded from macro 'Py_IS_INFINITY'

define Py_IS_INFINITY(X) isinf(X)

                          ^

../../src/runtime/float.cpp:1355:35: error: use of undeclared identifier 'isinf'
if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x))
^
from_cpython/Include/pymath.h:121:31: note: expanded from macro 'Py_IS_INFINITY'

define Py_IS_INFINITY(X) isinf(X)

                          ^

2 errors generated.

Marius Wachtler
@undingen
Jun 07 2016 12:13
what linux distro are you using?
Cullen Rhodes
@c-rhodes
Jun 07 2016 12:13
Ubuntu 16.04
Marius Wachtler
@undingen
Jun 07 2016 12:14
Hello World. Also new here. I managed to build pyston on ubuntu, but only after making small changes. I had to change source files src/runtime/{float.cpp, long.cpp, capi.cpp} to use std::isinf, and std::isnan (with std:: qualifier). In from_cpython/Include/pymath.h I tweaked the macro definition of Py_IS_INFINITY to test for __cpluspus.
#ifndef Py_IS_INFINITY
 #  if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1
-#    define Py_IS_INFINITY(X) isinf(X)
+#     if defined __cplusplus
+#         define Py_IS_INFINITY(X) std::isinf(X)
+#     else
+#         define Py_IS_INFINITY(X) isinf(X)
+#     endif
 #  else
 #    define Py_IS_INFINITY(X) ((X) &&                                   \
                                (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X)))
just found this older message... looks like we never applied a fix :-(

could you try this please:

Hi @McWeda, would it work to change our code from #include <cmath> to #include <math.h>?

Cullen Rhodes
@c-rhodes
Jun 07 2016 12:16
i'll give that a try
Cullen Rhodes
@c-rhodes
Jun 07 2016 12:22
math.h makes no difference
Marius Wachtler
@undingen
Jun 07 2016 12:32
:-(
Marius Wachtler
@undingen
Jun 07 2016 12:42
I'm working on a workaround. I think I will just move the usage inside float.cpp into float.c because it should actually live there in the first place and would also fix workaround the issue.
Marius Wachtler
@undingen
Jun 07 2016 13:05
do you run into a similar issue for other math functions? otherwise dropbox/pyston#1236 should fix your issue I guess
Cullen Rhodes
@c-rhodes
Jun 07 2016 13:15

I'll give that patch a try but there is also an isnan error:

../../src/runtime/long.cpp:411:9: error: use of undeclared identifier 'isnan'
if (isnan(v)) {

Marius Wachtler
@undingen
Jun 07 2016 13:25
ok I added another commit which removes this. Can you please try again. If there are still problems I will fix the issues later today when I have access to a 16.04 machine :-D
Cullen Rhodes
@c-rhodes
Jun 07 2016 13:29
that seems to do the trick! Thanks :)
Cullen Rhodes
@c-rhodes
Jun 07 2016 13:44

I should also mention i hit another error when building:

../../src/runtime/builtin_modules/builtins.cpp:1238:29: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
iterators.push_back(std::move(range.begin()));
^
../../src/runtime/builtin_modules/builtins.cpp:1238:29: note: remove std::move call here
iterators.push_back(std::move(range.begin()));
^~~~~~ ~
1 error generated.

I fixed this by removing the std::move and I have the commit on a branch if this is something you're interested in merging
Marius Wachtler
@undingen
Jun 07 2016 13:55
if you like you can create a PR for this move change and I will merge it :-)
Cullen Rhodes
@c-rhodes
Jun 07 2016 13:56
great thanks, dropbox/pyston#1237
Marius Wachtler
@undingen
Jun 07 2016 13:57
and you would also have to sign the dropbox CLA... it's a very small change which I would do exactly the same as you so I'm not sure if it is absolutely required but if you don't mind...
thanks
Cullen Rhodes
@c-rhodes
Jun 07 2016 14:01
no problem, signed :)
Marius Wachtler
@undingen
Jun 07 2016 14:19
thanks :-)