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

Compile Error: ‘const class llvm::ConstantExpr’ has no member named ‘getIndices’ #208

Open
TommyJerryMairo opened this issue Nov 18, 2023 · 1 comment

Comments

@TommyJerryMairo
Copy link

Describe the bug

The bug causes a compilation error for Oclgrind on an Arch Linux workstation. The error message attached to this issue appears during the compilation process and prevents the software from building properly.

To Reproduce

  1. Clone the Oclgrind repo and checkout commit accf518f8623548417c344a0193aa9b531cc9486
  2. Applied the attached patch CMakeLists.txt.patch to ./CMakeLists.txt
  3. Run CMake with the following command:
   $ cmake -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DLIBDIR_SUFFIX="" \
          . -Bbuild
  1. Build the project with the command cmake --build build

Expected behavior

Build succeed without any errors.

CMake build log

CMake Deprecation Warning at CMakeLists.txt:9 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 13.2.1
-- The CXX compiler identification is GNU 13.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /sbin/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: /sbin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test HAVE_FFI_CALL
-- Performing Test HAVE_FFI_CALL - Success
-- Found FFI: /usr/lib/libffi.so
-- Performing Test Terminfo_LINKABLE
-- Performing Test Terminfo_LINKABLE - Success
-- Found Terminfo: /usr/lib/libtinfo.so
-- Found ZLIB: /usr/lib/libz.so (found version "1.3")
-- Found zstd: /usr/lib/libzstd.so
-- Found LibXml2: /usr/lib/libxml2.so (found version "2.11.5")
-- Found LLVM 16.0.6
-- Using LLVMConfig.cmake in: /lib/cmake/llvm
-- Using opencl-c.h: //lib/clang/16/include/opencl-c.h
-- Looking for include files stdio.h, readline/readline.h
-- Looking for include files stdio.h, readline/readline.h - found
-- Looking for include files stdio.h, readline/history.h
-- Looking for include files stdio.h, readline/history.h - found
-- Looking for readline in readline
-- Looking for readline in readline - found
-- Looking for add_history in readline
-- Looking for add_history in readline - found
-- Found Python: /sbin/python3.11 (found version "3.11.5") found components: Interpreter
-- Configuring done (6.0s)
-- Generating done (0.1s)
-- Build files have been written to: /home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/build
[  1%] Generating src/core/opencl-c.h.cpp
[  3%] Building CXX object CMakeFiles/oclgrind-exe.dir/src/runtime/oclgrind.cpp.o
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/runtime/oclgrind.cpp: In function ‘std::string getLibDirPath()’:
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/runtime/oclgrind.cpp:433:11: warning: ignoring return value of ‘char* realpath(const char*, char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
  433 |   realpath(exepath, path);
      |   ~~~~~~~~^~~~~~~~~~~~~~~
[  5%] Linking CXX executable oclgrind
[  5%] Built target oclgrind-exe
[  7%] Generating include/oclgrind/opencl-c.h
[  8%] Generating include/oclgrind/opencl-c-1.2-32.pch
[ 10%] Building CXX object CMakeFiles/oclgrind.dir/src/core/opencl-c.h.cpp.o
[ 12%] Building CXX object CMakeFiles/oclgrind.dir/src/core/common.cpp.o
[ 14%] Generating include/oclgrind/opencl-c-1.2-64.pch
[ 15%] Generating include/oclgrind/opencl-c-2.0-32.pch
[ 17%] Generating include/oclgrind/opencl-c-2.0-64.pch
[ 17%] Built target OPENCL_C_HEADERS
[ 19%] Building CXX object CMakeFiles/oclgrind.dir/src/core/Context.cpp.o
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp: In function ‘void oclgrind::getConstantData(unsigned char*, const llvm::Constant*)’:
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:338:13: warning: unused variable ‘undef’ [-Wunused-variable]
  338 |   if (auto* undef = llvm::dyn_cast<llvm::UndefValue>(constant))
      |             ^~~~~
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp: In function ‘llvm::Instruction* oclgrind::getConstExprAsInstruction(const llvm::ConstantExpr*)’:
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:461:48: error: ‘const class llvm::ConstantExpr’ has no member named ‘getIndices’
  461 |                                          expr->getIndices());
      |                                                ^~~~~~~~~~
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:463:62: error: ‘const class llvm::ConstantExpr’ has no member named ‘getIndices’
  463 |     return llvm::ExtractValueInst::Create(operands[0], expr->getIndices());
      |                                                              ^~~~~~~~~~
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:470:54: warning: ‘llvm::Type* llvm::Type::getPointerElementType() const’ is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Wdeprecated-declarations]
  470 |         operands[0]->getType()->getPointerElementType(), operands[0],
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from /usr/include/llvm/IR/DerivedTypes.h:23,
                 from /usr/include/llvm/IR/Function.h:29,
                 from /usr/include/llvm/IR/CFG.h:26,
                 from /usr/include/llvm/IR/Instructions.h:26,
                 from /home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:18:
/usr/include/llvm/IR/Type.h:409:9: note: declared here
  409 |   Type *getPointerElementType() const {
      |         ^~~~~~~~~~~~~~~~~~~~~
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:476:54: warning: ‘llvm::Type* llvm::Type::getPointerElementType() const’ is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Wdeprecated-declarations]
  476 |         operands[0]->getType()->getPointerElementType(), operands[0],
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/llvm/IR/Type.h:409:9: note: declared here
  409 |   Type *getPointerElementType() const {
      |         ^~~~~~~~~~~~~~~~~~~~~
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp: In function ‘size_t oclgrind::resolveGEP(size_t, const llvm::Type*, std::vector<long int>&)’:
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:834:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<long int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
  834 |   for (int i = 0; i < offsets.size(); i++)
      |                   ~~^~~~~~~~~~~~~~~~
/home/tjm/.cache/pikaur/build/oclgrind-git/src/Oclgrind-master/src/core/common.cpp:841:66: warning: ‘llvm::Type* llvm::Type::getPointerElementType() const’ is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Wdeprecated-declarations]
  841 |       const llvm::Type* elemType = ptrType->getPointerElementType();
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
/usr/include/llvm/IR/Type.h:409:9: note: declared here
  409 |   Type *getPointerElementType() const {
      |         ^~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/oclgrind.dir/build.make:95: CMakeFiles/oclgrind.dir/src/core/common.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:264: CMakeFiles/oclgrind.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

Desktop

  • OS: ArchLinux w/ up-to-date upgrades
  • CLang Version: 16.0.6
  • LLVM Version: 16.0.6

Additional context

Content of CMakeLists.txt.patch:

--- CMakeLists.txt	2023-11-18 10:49:42.383528743 -0800
+++ CMakeLists.txt	2023-11-18 10:49:52.973530810 -0800
@@ -25 +25 @@
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
@@ -143 +143 @@
-    "${CLANG_LIB_DIR}/clang/${CLANG_FULL_VERSION}/include/opencl-c.h")
+    "${CLANG_LIB_DIR}/clang/${LLVM_VERSION_MAJOR}/include/opencl-c.h")
@@ -425 +425 @@
-find_package(PythonInterp)
+find_package(Python)
@@ -426 +426 @@
-if (PYTHONINTERP_FOUND)
+if (PYTHON_FOUND)
@TommyJerryMairo
Copy link
Author

Note: I have to employ C++ standard 17 as the default standard 14 causes a way more severe problem.

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