dpilger26 / NumCpp

C++ implementation of the Python Numpy library
https://dpilger26.github.io/NumCpp
MIT License
3.58k stars 555 forks source link

numcpp 2.12.0 build failure #204

Closed chenrui333 closed 1 year ago

chenrui333 commented 1 year ago

👋 trying to build the latest release, but run into some build issue. The error log is as below:

error build log ``` ==> /usr/bin/clang++ -std=c++17 test.cpp -o test -I/opt/homebrew/Cellar/numcpp/2.12.0/include In file included from test.cpp:2: In file included from /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp.hpp:56: In file included from /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp/Random.hpp:30: In file included from /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp/Random/RNG.hpp:39: /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp/Random/choice.hpp:73:72: error: expected unqualified-id Replace replace = Replace::TRUE) ^ /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/mach/boolean.h:81:17: note: expanded from macro 'TRUE' #define TRUE 1 ^ In file included from test.cpp:2: In file included from /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp.hpp:[56](https://github.com/Homebrew/homebrew-core/actions/runs/6439272650/job/17486781813?pr=150022#step:3:57): In file included from /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp/Random.hpp:30: In file included from /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp/Random/RNG.hpp:39: /opt/homebrew/Cellar/numcpp/2.12.0/include/NumCpp/Random/choice.hpp:75:37: error: expected unqualified-id if (replace == Replace::FALSE && inNum > inArray.size()) ^ ```

full build log, https://github.com/Homebrew/homebrew-core/actions/runs/6439272650/job/17486781813?pr=150022 relates to Homebrew/homebrew-core#150022

dpilger26 commented 1 year ago

You've included another library file (/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/mach/boolean.h:81:17) that defines a macro that overwrites an enum field from NumCpp. Recommended you remove that.

chenrui333 commented 1 year ago

that is actually macOS sdk

toge commented 1 year ago

@dpilger26 @chenrui333 I met same problem on updating conan recipe. Cloud you consider renaming TRUE/FALSE symbols in Enums.hpp if possile.

dpilger26 commented 1 year ago

Sigh... Macros are evil! I'm on vacation right now but I'll change them and cut a new release when I get back.

dpilger26 commented 1 year ago

TRUE/FALSE enum fields have been updated to YES/NO in release version 2.12.1.