IamSanjid / numpy_random

Simple C++ thread-safe interface to use NumPy's Random Legacy distributions directly.
MIT License
2 stars 2 forks source link

Build error #2

Open piotr-blaszyk-fyp opened 6 months ago

piotr-blaszyk-fyp commented 6 months ago

Hi,

I tried building your repo but got some errors. Here's how to reproduce:

I'm running on Ubuntu 22.04.4 LTS (Jammy Jellyfish) inside a Singularity container.

What am I doing wrong?

This is the output from cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-15 -DCMAKE_CXX_COMPILER=clang++-15 ..:

-- The C compiler identification is Clang 15.0.7
-- The CXX compiler identification is Clang 15.0.7
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-15 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++-15 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/ubuntu-image-repos/numpy_random/build

This is the output from make VERBOSE=1:

/usr/bin/cmake -S/mnt/ubuntu-image-repos/numpy_random -B/mnt/ubuntu-image-repos/numpy_random/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /mnt/ubuntu-image-repos/numpy_random/build/CMakeFiles /mnt/ubuntu-image-repos/numpy_random/build//CMakeFiles/progress.marks
make  -f CMakeFiles/Makefile2 all
make  -f src/CMakeFiles/numpy_random.dir/build.make src/CMakeFiles/numpy_random.dir/depend
cd /mnt/ubuntu-image-repos/numpy_random/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /mnt/ubuntu-image-repos/numpy_random /mnt/ubuntu-image-repos/numpy_random/src /mnt/ubuntu-image-repos/numpy_random/build /mnt/ubuntu-image-repos/numpy_random/build/src /mnt/ubuntu-image-repos/numpy_random/build/src/CMakeFiles/numpy_random.dir/DependInfo.cmake --color=
make  -f src/CMakeFiles/numpy_random.dir/build.make src/CMakeFiles/numpy_random.dir/build
[ 10%] Building CXX object src/CMakeFiles/numpy_random.dir/numpy_random.cpp.o
cd /mnt/ubuntu-image-repos/numpy_random/build/src && /usr/bin/clang++-15 -D_DEBUG -D_FILE_OFFSET_BITS=64 -I/mnt/ubuntu-image-repos/numpy_random/src/. -g -std=gnu++17 -MD -MT src/CMakeFiles/numpy_random.dir/numpy_random.cpp.o -MF CMakeFiles/numpy_random.dir/numpy_random.cpp.o.d -o CMakeFiles/numpy_random.dir/numpy_random.cpp.o -c /mnt/ubuntu-image-repos/numpy_random/src/numpy_random.cpp

In file included from /mnt/ubuntu-image-repos/numpy_random/src/numpy_random.cpp:3:
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:40:47: error: use of undeclared identifier 'CHAR_BIT'
    constexpr uint8_t DEST_BITS = DEST_SIZE * CHAR_BIT;
                                              ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:63:42: error: use of undeclared identifier 'CHAR_BIT'
    constexpr auto SRC_BITS = SRC_SIZE * CHAR_BIT;
                                         ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:89:47: error: use of undeclared identifier 'CHAR_BIT'
    constexpr uint8_t DEST_BITS = DEST_SIZE * CHAR_BIT;
                                              ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:119:44: error: use of undeclared identifier 'CHAR_BIT'
    constexpr size_t SRC_BITS = SRC_SIZE * CHAR_BIT;
                                           ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:165:1: error: unknown type name '_INLINE_VAR'
_INLINE_VAR constexpr bool is_static_castable_v =
^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:172:1: error: unknown type name '_INLINE_VAR'
_INLINE_VAR constexpr bool is_any_static_castable_v =
^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:176:1: error: unknown type name '_INLINE_VAR'
_INLINE_VAR constexpr bool is_arithmetic_castable_v =
^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:242:32: error: expected a qualified name after 'typename'
    using RngReturn = typename raw_type<decltype(std::declval<RngEngine>()())>;
                               ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:284:19: error: use of undeclared identifier 'legacy_beta'; did you mean 'numpy_random_internel::legacy_beta'?
        return (T)legacy_beta(_internal_state._aug_state, (double)a, (double)b);
                  ^~~~~~~~~~~
                  numpy_random_internel::legacy_beta
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:27:8: note: 'numpy_random_internel::legacy_beta' declared here
double legacy_beta(aug_bitgen* aug_state, double a, double b);
       ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:294:16: error: use of undeclared identifier 'legacy_random_binomial'; did you mean 'numpy_random_internel::legacy_random_binomial'?
        return legacy_random_binomial(_internal_state._bitgen, (double)p, (int64_t)n,
               ^~~~~~~~~~~~~~~~~~~~~~
               numpy_random_internel::legacy_random_binomial
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:28:9: note: 'numpy_random_internel::legacy_random_binomial' declared here
int64_t legacy_random_binomial(bitgen* bitgen_state, double p, int64_t n, s_binomial_t* binomial);
        ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:309:14: error: use of undeclared identifier 'isfinite'
        if (!isfinite(range) || _internal_state._bitgen == nullptr) {
             ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:618:28: error: binding reference of type 'vector<...>' to value of type 'vector<...>' drops 'const' qualifier
        _inner.set_entropy(std::move(entropy));
                           ^~~~~~~~~~~~~~~~~~
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:573:45: note: passing argument to parameter here
    void set_entropy(std::vector<uint32_t>&&);
                                            ^
/mnt/ubuntu-image-repos/numpy_random/src/./numpy_random.h:650:18: error: no member named 'reverse' in namespace 'std'
            std::reverse(start, finish);
            ~~~~~^
13 errors generated.
make[2]: *** [src/CMakeFiles/numpy_random.dir/build.make:76: src/CMakeFiles/numpy_random.dir/numpy_random.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:117: src/CMakeFiles/numpy_random.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Thanks

IamSanjid commented 2 months ago

Umm have you configured your project to target C++17 or above? Can you make sure?