Skip to content

Unable to compile MacOS wheel for Python 3.4 #78

Closed

Description

@lelit

Under MacOS/clang, the compilation of the module with Python 3.4 runtime fails, see https://travis-ci.org/python-rapidjson/python-rapidjson/jobs/273856525

Activity

  1. added a commit that references this issue on Sep 10, 2017
  2. lelit commented on Sep 11, 2017

    @lelit
    ContributorAuthor

    As I do not have MacOS around to do further experiments, it's unlikely I will be able to solve this by myself. Maybe @hynek or @carlpulley can shed some light?

  3. hynek commented on Sep 24, 2017

    @hynek
    Contributor

    Relevant errors are:

                  if (Py_IS_NAN(d)) {
                      ^
      /Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m/pymath.h:93:22: note: expanded from macro 'Py_IS_NAN'
      #define Py_IS_NAN(X) isnan(X)
                           ^
      /usr/include/c++/4.2.1/cmath:551:5: note: 'std::isnan' declared here
          isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }
          ^
      ./rapidjson.cpp:1654:24: error: use of undeclared identifier 'isinf'
                  } else if (Py_IS_INFINITY(d)) {
                             ^
      /Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m/pymath.h:113:31: note: expanded from macro 'Py_IS_INFINITY'
      #    define Py_IS_INFINITY(X) isinf(X)
                                    ^
    

    Could this be some C-header-used-in-C++ weirdness?

    Relevant Python code for 3.4 is at:

    https://github.com/python/cpython/blob/86a713cb0c110b6798ca7f9e630fc511ee0a4028/Include/pymath.h#L82-L118 and it at least seems to have detected the presence of the functions it's complaining about. So my mostly ignorant guess is that it's less about macOS per se and more about compiler versions/strictness?

  4. sontek commented on Sep 29, 2017

    @sontek
    Contributor

    I use OSX, I've only ever used python-rapidjson on 3.5 and 3.6 and it works perfectly. We don't test py34 with tox. We could add that in there and see if its specific to Py3.4 on OSX

  5. lelit commented on Sep 29, 2017

    @lelit
    ContributorAuthor

    Yes, the problem I got is only with py34.

  6. kenrobbins commented on Sep 29, 2017

    @kenrobbins
    Member

    I don't have an easy way to test either, but I think this idea might work except with math.h instead of cmath. 1ff9a18

  7. thanosd commented on Oct 27, 2017

    @thanosd

    I don't want to hijack the wrong thread, as I'm using Python 3.6, but I'm getting a similar error:

    https://pastebin.com/6QNStUQ1

  8. lelit commented on Oct 27, 2017

    @lelit
    ContributorAuthor

    Any chance you could investigate a bit, maybe trying out suggestions above?

  9. thanosd commented on Oct 27, 2017

    @thanosd

    Sure thing. The suggestion you are referring to is replacing that include? Giving that a shot right now...

  10. thanosd commented on Oct 27, 2017

    @thanosd

    So steps performed:

    • Checked out repo
    • Updated submodules
    • Edited rapidjson.cpp and replaced with "math.h"
    • Ran python setup.py build

    Same errors occur. https://pastebin.com/WRt17PaU

    Going to dig a bit more on versions of GCC running here, but I'm just jumping into this, so I don't have an intuition of where to look. If someone can throw me some pointers, I can put some time into it.

  11. lelit commented on Oct 27, 2017

    @lelit
    ContributorAuthor

    Thank you for trying, I'm thinking about asking advice to the RapidJSON folks...

  12. sontek commented on Oct 31, 2017

    @sontek
    Contributor

    I actually just ran into this on my other Mac... Not sure why but I think it might be related to an older version of clang or something. On my mac that I have no issues with:

    Apple LLVM version 8.0.0 (clang-800.0.42.1)
    

    on my mac I have this issue:

    Apple LLVM version 7.3.0 (clang-703.0.31)
    

    that is the only difference I've seen so far.

  13. sontek commented on Oct 31, 2017

    @sontek
    Contributor

    I'm using py35, so might be different... The errors are similar:

    /Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m/pymath.h:93:22: note: expanded from macro 'Py_IS_NAN'
        #define Py_IS_NAN(X) isnan(X)
                             ^
        /usr/include/c++/4.2.1/cmath:551:5: note: 'std::isnan' declared here
            isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }
            ^
        ./rapidjson.cpp:1652:24: error: use of undeclared identifier 'isinf'
                    } else if (Py_IS_INFINITY(d)) {
                               ^
        /Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m/pymath.h:113:31: note: expanded from macro 'Py_IS_INFINITY'
        #    define Py_IS_INFINITY(X) isinf(X)
                                      ^
    
  14. sontek commented on Oct 31, 2017

    @sontek
    Contributor

    I did:

    export CC=gcc
    export CXX=g++
    

    and still get the errors:

     ./rapidjson.cpp:1137:60: warning: conversion from string literal to 'char *' is deprecated [-Wc++11-compat-deprecated-writable-strings]
             T_UINT, offsetof(DecoderObject, parseMode), READONLY, "parse_mode"},
                                                                   ^
        ./rapidjson.cpp:1644:17: error: use of undeclared identifier 'isnan'; did you mean 'std::isnan'?
                    if (Py_IS_NAN(d)) {
                        ^
        /Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m/pymath.h:93:22: note: expanded from macro 'Py_IS_NAN'
        #define Py_IS_NAN(X) isnan(X)
                             ^
        /usr/include/c++/4.2.1/cmath:551:5: note: 'std::isnan' declared here
            isnan(_Tp __f) { return ::__gnu_cxx::__capture_isnan(__f); }
            ^
        ./rapidjson.cpp:1652:24: error: use of undeclared identifier 'isinf'
                    } else if (Py_IS_INFINITY(d)) {
                               ^
        /Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m/pymath.h:113:31: note: expanded from macro 'Py_IS_INFINITY'
        #    define Py_IS_INFINITY(X) isinf(X)
    

    so its not clang.

  15. lelit commented on Oct 31, 2017

    @lelit
    ContributorAuthor

    That's so strange! But system/compiler versions may explain why the trouble does not always manifest itself: for example, the Travis build succeeds except with Python 3.4...

  16. sontek commented on Oct 31, 2017

    @sontek
    Contributor

    This is on El Capitan, I'm upgrading to Sierra now, so I'll let you know if that fixes the issue on this system.

  17. lelit commented on Dec 14, 2017

    @lelit
    ContributorAuthor

    It seems that #88 fixes the problem, at least on Travis CI: any chance some of you could try it and confirm?

  18. sontek commented on Dec 15, 2017

    @sontek
    Contributor

    Just tested and it works.

  19. lelit commented on Dec 15, 2017

    @lelit
    ContributorAuthor

    This should be fixed in current master, I will probably release 0.3 next week or so. Thank you all.

  20. hynek commented on Dec 15, 2017

    @hynek
    Contributor

    Can I interest you into calling it 1.0? 😇

  21. lelit commented on Dec 20, 2017

    @lelit
    ContributorAuthor

    I just released v0.3, let's see whether the macOS wheel appears on PyPI.

    Wrt v1.0, I'd like to have further attempts at issue #80 before that...

  22. lelit commented on Dec 20, 2017

    @lelit
    ContributorAuthor

    Well, it seems there's still something wrong with the MacOS recipe, it fails to find twine, even if it appears to be installed...

  23. added a commit that references this issue on Dec 21, 2017
  24. lelit commented on Dec 21, 2017

    @lelit
    ContributorAuthor

    Yay! It seems I ruled it, at last!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions