KhronosGroup/ANARI-SDK

build failing, v0.3.0 and latest main

ExpandingMan opened this issue · 5 comments

Trying to build, I attempted a few variations similar to the github workflow to get it working, but I always get the following syntax error:

[ 68%] Building CXX object libs/debug_device/CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o
cd /workspace/srcdir/ANARI-SDK/build/libs/debug_device && /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-g++ --sysroot=/opt/x86_64-linux-gnu/x86_64-linux-gnu/sys-root/ -Danari_library_debug_EXPORTS -I/workspace/srcdir/ANARI-SDK/livice/include -I/workspace/srcdir/ANARI-SDK/build/libs/anari/include/anari -I/workspace/srcdir/ANARI-SDK/libs/anari/include -I/workspace/srcdir/ANARI-SDK/libs/anari -I/workspace/srcdir/ANARI-SDK/libs/anari_utilities/include -O3 -DNDEBUG -fPIC -st -MT libs/debug_device/CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o -MF CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o.d -o CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o -c /workspace/srcdir/ANARI-SDK/libs/debug_device/Debug
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp: In member function ‘virtual void anari::debug_device::DebugBasics::anariGetProperty(ANARIDevice, ANARIObject, const char*, ANARIDataType, void*, uint64_t, ANARIWaitMask)’:
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:272:36: error: expected ‘)’ before ‘PRIu64’
  272 |             "%s: buffer of size %" PRIu64 " is to small for property of type %s.", DEBUG_FUNCTION_NAME, size, toString(type));
      |                                    ^~~~~~
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:51:17: note: in definition of macro ‘DEBUG_REPORT’
   51 |         STATUS, __VA_ARGS__);
      |                 ^~~~~~~~~~~
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:47:21: note: to match this ‘(’
   47 |     td->reportStatus(\
      |                     ^~
   48 |         DEBUG_SOURCE_OBJECT,\
      |                      
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:47:21: note: in definition of macro ‘DEBUG_REPORT’
   47 |     td->reportStatus(\
      |                     ^~
   48 |         DEBUG_SOURCE_OBJECT,\
      |                      
/workspace/srcdir/ANARI-SDK/libs/debug_device/DebugBasics.cpp:6:1: note: ‘PRIu64’ is defined in header ‘<cinttypes>’; did you forget to ‘#include <cinttypes>’?
    5 | #include <inttypes.h>
  +++ |+#include <cinttypes>
    6 | 
make[2]: *** [libs/debug_device/CMakeFiles/anari_library_debug.dir/build.make:104: libs/debug_device/CMakeFiles/anari_library_debug.dir/DebugBasics.cpp.o] Error 1

I have tried this on g++ versions 11 and 12, but get identical errors.

I am building with

mkdir build && cd build
cmake .. \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_BUILD_PARALLEL_LEVEL=$nproc \
    -DCMAKE_INSTALL_PREFIX=${prefix} \
    -DCMAKE_TOOLCHAIN_FILE=$CMAKE_TARGET_TOOLCHAIN \
    -DBUILD_SHARED_LIBS=ON \
    -DBUILD_EXAMPLES=OFF \
    -DBUILD_HELIDE_DEVICE=OFF \
    -DBUILD_TESTING=OFF \
    -DBUILD_VIEWER=OFF \
    -DBUILD_CTS=OFF
cmake --build . -t install

cmake gives the following configuration dialogue

-- The C compiler identification is GNU 12.1.0
-- The CXX compiler identification is GNU 12.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-gcc - 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: /opt/bin/x86_64-linux-gnu-libgfortran5-cxx11/x86_64-linux-gnu-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found Python3: /usr/bin/python3.9 (found version "3.9.7") found components: Interpreter 
-- Configuring done
-- Generating done

What kind of platform is this?
The error is weird to me since it suggests to include cinttypes but the file already includes inttypes.h which clearly should have PRIu64 defined unless the platform somehow doesn't define uint64_t. But then there would be WAY more errors.

Does adding the cinttypes header as the error suggests fix it?

Apparently this is some quirk of old glibc versions. I hope changing to cinttypes fixes it which I included in the presumably soon to be merged maintenance PR. #141

It's just good old x86_64 linux.

Cool, thanks. In the meantime I'll try it with newer glibc. I forgot that the build system I'm using here tends to use older libs.

Is this still a problem?

No, closing, thanks.