Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Clang C++ Compiler #153

Open
vedadux opened this issue Feb 5, 2025 · 0 comments
Open

Support for Clang C++ Compiler #153

vedadux opened this issue Feb 5, 2025 · 0 comments

Comments

@vedadux
Copy link

vedadux commented Feb 5, 2025

Is your feature request related to a problem? Please describe.

I have tried installing this library through PIP on Ubuntu, with a clang C++ compiler.
Unfortunately it fails due to -Werror,-Wunused-private-field and an unused member variable:

running build_ext
      cmake /tmp/pip-install-er5wal5j/intel-npu-acceleration-library_80c340c9e68d4c708aca1a106cf83c96 -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-er5wal5j/intel-npu-acceleration-library_80c340c9e68d4c708aca1a106cf83c96/build/lib.linux-x86_64-cpython-312/intel_npu_acceleration_library/lib -DCMAKE_BUILD_TYPE=Release -DSETUPTOOL_BUILD=True
      -- The C compiler identification is GNU 13.3.0
      -- The CXX compiler identification is Clang 18.1.3
      -- Detecting C compiler ABI info
      -- Detecting C compiler ABI info - done
      -- Check for working C compiler: /usr/bin/cc - 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/c++ - skipped
      -- Detecting CXX compile features
      -- Detecting CXX compile features - done
      -- Setting GCC/Clang specific flags for the entire build
      -- OpenVINO library URL: https://storage.openvinotoolkit.org/repositories/openvino/packages/2024.4/linux/l_openvino_toolkit_ubuntu24_2024.4.0.16579.c3152d32c9c_x86_64.tgz
      CMake Warning (dev) at /usr/share/cmake-3.28/Modules/FetchContent.cmake:1331 (message):
        The DOWNLOAD_EXTRACT_TIMESTAMP option was not given and policy CMP0135 is
        not set.  The policy's OLD behavior will be used.  When using a URL
        download, the timestamps of extracted files should preferably be that of
        the time of extraction, otherwise code that depends on the extracted
        contents might not be rebuilt if the URL changes.  The OLD behavior
        preserves the timestamps from the archive instead, but this is usually not
        what you want.  Update your project to the NEW behavior or specify the
        DOWNLOAD_EXTRACT_TIMESTAMP option with a value of true to avoid this
        robustness issue.
      Call Stack (most recent call first):
        CMakeLists.txt:81 (FetchContent_Declare)
      This warning is for project developers.  Use -Wno-dev to suppress it.

      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
      -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
      -- Found Threads: TRUE
      -- Configuring done (8.4s)
      -- Generating done (0.0s)
      -- Build files have been written to: /tmp/pip-install-er5wal5j/intel-npu-acceleration-library_80c340c9e68d4c708aca1a106cf83c96/build/temp.linux-x86_64-cpython-312
      cmake --build . --config Release
      [ 50%] Building CXX object CMakeFiles/intel_npu_acceleration_library.dir/src/bindings.cpp.o
      In file included from /tmp/pip-install-er5wal5j/intel-npu-acceleration-library_80c340c9e68d4c708aca1a106cf83c96/src/bindings.cpp:6:
      In file included from /tmp/pip-install-er5wal5j/intel-npu-acceleration-library_80c340c9e68d4c708aca1a106cf83c96/include/intel_npu_acceleration_library/nn_factory.h:7:
      In file included from /tmp/pip-install-er5wal5j/intel-npu-acceleration-library_80c340c9e68d4c708aca1a106cf83c96/include/intel_npu_acceleration_library/inference.h:21:
      /tmp/pip-install-er5wal5j/intel-npu-acceleration-library_80c340c9e68d4c708aca1a106cf83c96/include/intel_npu_acceleration_library/parameters.h:70:10: error: private field 'quantized' is not used [-Werror,-Wunused-private-field]
         70 |     bool quantized;
            |          ^
      1 error generated.
      gmake[2]: *** [CMakeFiles/intel_npu_acceleration_library.dir/build.make:76: CMakeFiles/intel_npu_acceleration_library.dir/src/bindings.cpp.o] Error 1
      gmake[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/intel_npu_acceleration_library.dir/all] Error 2
      gmake: *** [Makefile:91: all] Error 2
      error: command '/usr/bin/cmake' failed with exit code 2
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for intel-npu-acceleration-library
Failed to build intel-npu-acceleration-library
ERROR: Could not build wheels for intel-npu-acceleration-library, which is required to install pyproject.toml-based projects

Describe the solution you'd like
The code should compile with new-ish versions of clang, not only g++.
For me this version of clang did not work:
clang --version

Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

And this version of g++ worked, likely due to g++ not being as strict on -Werror:
g++ --version

g++ (Ubuntu 13.3.0-6ubuntu2~24.04) 13.3.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

This should be relatively easy to achieve through code cleanup.

Describe alternatives you've considered
The g++ alternative works on Ubuntu, but it would be good to have clang as an alternative.

Additional context
No additional context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant