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

Failed to install libopencl-clang.so.14 with CMAKE_INSTALL_LIBDIR error #547

Closed
th0ma7 opened this issue Jul 9, 2024 · 7 comments
Closed

Comments

@th0ma7
Copy link

th0ma7 commented Jul 9, 2024

I'm maintaining the ffmpeg package for the SynoCommunity and trying to enable --opencl for intel based CPU on Synology NAS. I am now able to build intel-opencl-clang using LLVM 14.0.5 with proper 140 depencies (thnx to #539 and #545). My on-going PR is SynoCommunity/spksrc#6166

Although after completing the build process (i.e. and getting to this point):

[3388/3389] Linking CXX shared library lib/libopencl-clang.so.14
[3389/3389] Creating library symlink lib/libopencl-clang.so

I then proceed with the installation and it warns of it inhability to do so with the following msg:

[0/1] Install the project...
-- Install configuration: "Release"
-- Installing: /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/cmake/llvm/LLVMConfigExtensions.cmake
-- Installing: /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLTO.so.14
-- Installing: /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/lib/libLTO.so
-- Installing: /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/include/llvm-c/lto.h
-- Installing: /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/install/usr/local/intel-graphics-compiler/bin/llvm-ar
CMake Warning (dev) at /usr/share/cmake-3.18/Modules/GNUInstallDirs.cmake:225 (message):
  Unable to determine default CMAKE_INSTALL_LIBDIR directory because no
  target architecture is known.  Please enable at least one language before
  including GNUInstallDirs.
Call Stack (most recent call first):
  /home/spksrc/ffmpeg-opencl-140/spksrc/cross/intel-graphics-compiler/work-x64-7.1/llvm/cmake/modules/LLVMInstallSymlink.cmake:5 (include)
  tools/llvm-ar/cmake_install.cmake:56 (include)
  tools/cmake_install.cmake:49 (include)
  cmake_install.cmake:63 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.

However process continues and complete the installation of the remaining llvm, spirv and clang where all libraries and binaries are installed appropriately. So I tried enforcing CMAKE_INSTALL_LIBDIR with no change, error still occurs, failing to install the resulting libopencl-clang.so.14.

Also note that I do also pass -Wno-dev to the build process but from the message it wasn't taken into account neither.

Full build log available here build-x64-7.1.log

@wenju-he
Copy link
Contributor

The warning showing above is probably related to llvm-ar because it is in call stack: tools/llvm-ar/cmake_install.cmake:56 (include) and this is probably why the install continues.

How can we reproduce the install error of libopencl-clang? Could you please provide the build step?

@th0ma7
Copy link
Author

th0ma7 commented Jul 10, 2024

@wenju-he the easiest would be to follow-up the HOWTO setup a build environment. Details are available on our project front page https://github.com/SynoCommunity/spksrc to get yourself our docker container.

Once setup you need to clone my spksrc tree from https://github.com/th0ma7/spksrc and access my working branch (ffmpeg-opencl-140).

Once setup, from the root of the spksrc repository:

  1. switch to my active branch git checkout ffmpeg-opencl-140
  2. then call make setup
  3. then switch under the cross/intel-opencl-clang-140 directory
  4. and invoke the build process using make arch-x64-7.1.

This will:

  1. download the toolchain file from synology
  2. then download and build all the dependencies
spksrc/cross/intel-opencl-clang-140$ make dependency-tree
+ opencl-clang 140
\ + clang 14.0.5
\ + libffi 3.4.6
\ + libxml2 2.9.14
\ \ + zlib 1.3.1
\ + llvm 14.0.5
\ + ncursesw 6.4
\ + SPIRV-Headers 1.3.283.0
\ + SPIRV-LLVM-Translator
\ + SPIRV-Tools 2024.1
\ \ + SPIRV-Headers 1.3.283.0
\ + zlib 1.3.1
  1. then build intel-opencl-clang

Everything is cross-compiled against the synology build toolchain (it supports many arch from arm, ppc to x64). Working directory will be under work-x64-7.1. There you'll find all the source tree as well as a install directory where it simulate the installation path of use once installed on the Synology NAS.

$ tree -L 2 work-x64-7.1/install/usr/local/opencl-clang/
work-x64-7.1/install/usr/local/opencl-clang/
├── bin
│   ├── analyze-build
│   ├── captoinfo -> tic
│   ├── clang -> clang-14
│   ├── clang++ -> clang
│   ├── clang-14
│   ├── clang-check
│   ├── clang-cl -> clang
│   ├── clang-cpp -> clang
│   ├── clang-extdef-mapping
│   ├── clang-format
│   ├── clang-linker-wrapper
│   ├── clang-nvlink-wrapper
│   ├── clang-offload-bundler
│   ├── clang-offload-wrapper
│   ├── clang-refactor
│   ├── clang-rename
│   ├── clang-repl
│   ├── clang-scan-deps
│   ├── clear
│   ├── diagtool
│   ├── git-clang-format
│   ├── hmaptool
│   ├── infocmp
│   ├── infotocap -> tic
│   ├── intercept-build
│   ├── llvm-ar
│   ├── llvm-cov
│   ├── llvm-cxxfilt
│   ├── llvm-dwp
│   ├── llvm-lib -> llvm-ar
│   ├── llvm-ml
│   ├── llvm-nm
│   ├── llvm-objcopy
│   ├── llvm-objdump
│   ├── llvm-pdbutil
│   ├── llvm-profdata
│   ├── llvm-ranlib -> llvm-ar
│   ├── llvm-rc
│   ├── llvm-readobj
│   ├── llvm-size
│   ├── llvm-strings
│   ├── llvm-strip -> llvm-objcopy
│   ├── llvm-symbolizer
│   ├── ncursesw6-config
│   ├── reset -> tset
│   ├── scan-build
│   ├── scan-build-py
│   ├── scan-view
│   ├── spirv-as
│   ├── spirv-cfg
│   ├── spirv-dis
│   ├── spirv-lesspipe.sh
│   ├── spirv-link
│   ├── spirv-lint
│   ├── spirv-objdump
│   ├── spirv-opt
│   ├── spirv-reduce
│   ├── spirv-val
│   ├── tabs
│   ├── tic
│   ├── toe
│   ├── tput
│   ├── tset
│   ├── xml2-config
│   ├── xmlcatalog
│   └── xmllint
├── include
│   ├── cclang
│   ├── clang-c
│   ├── cursesapp.h
│   ├── cursesf.h
│   ├── curses.h
│   ├── cursesm.h
│   ├── cursesp.h
│   ├── cursesw.h
│   ├── cursslk.h
│   ├── eti.h
│   ├── etip.h
│   ├── ffi.h
│   ├── ffitarget.h
│   ├── form.h
│   ├── libxml2
│   ├── llvm-c
│   ├── LLVMSPIRVLib
│   ├── menu.h
│   ├── nc_tparm.h
│   ├── ncurses_dll.h
│   ├── ncurses.h -> curses.h
│   ├── panel.h
│   ├── spirv-tools
│   ├── termcap.h
│   ├── term_entry.h
│   ├── term.h
│   ├── tic.h
│   ├── unctrl.h
│   ├── zconf.h
│   └── zlib.h
├── lib
│   ├── clang
│   ├── cmake
│   ├── libclang.so -> libclang.so.13
│   ├── libclang.so.13 -> libclang.so.14.0.5
│   ├── libclang.so.14.0.5
│   ├── libear
│   ├── libffi.la
│   ├── libffi.so -> libffi.so.8.1.4
│   ├── libffi.so.8 -> libffi.so.8.1.4
│   ├── libffi.so.8.1.4
│   ├── libformw.so -> libformw.so.6
│   ├── libformw.so.6 -> libformw.so.6.4
│   ├── libformw.so.6.4
│   ├── libLTO.so -> libLTO.so.14
│   ├── libLTO.so.14
│   ├── libmenuw.so -> libmenuw.so.6
│   ├── libmenuw.so.6 -> libmenuw.so.6.4
│   ├── libmenuw.so.6.4
│   ├── libncurses++w.a
│   ├── libncursesw.so -> libncursesw.so.6
│   ├── libncursesw.so.6 -> libncursesw.so.6.4
│   ├── libncursesw.so.6.4
│   ├── libpanelw.so -> libpanelw.so.6
│   ├── libpanelw.so.6 -> libpanelw.so.6.4
│   ├── libpanelw.so.6.4
│   ├── libRemarks.so -> libRemarks.so.14
│   ├── libRemarks.so.14
│   ├── libscanbuild
│   ├── libSPIRV-Tools-diff.so
│   ├── libSPIRV-Tools-link.so
│   ├── libSPIRV-Tools-lint.so
│   ├── libSPIRV-Tools-opt.so
│   ├── libSPIRV-Tools-reduce.so
│   ├── libSPIRV-Tools-shared.so
│   ├── libSPIRV-Tools.so
│   ├── libxml2.la
│   ├── libxml2.so -> libxml2.so.2.9.14
│   ├── libxml2.so.2 -> libxml2.so.2.9.14
│   ├── libxml2.so.2.9.14
│   ├── libz.a
│   ├── libz.so -> libz.so.1
│   ├── libz.so.1 -> libz.so.1.3.1
│   ├── libz.so.1.3.1
│   ├── pkgconfig
│   ├── terminfo -> ../share/terminfo
│   └── xml2Conf.sh
├── libexec
│   ├── analyze-c++
│   ├── analyze-cc
│   ├── c++-analyzer
│   ├── ccc-analyzer
│   ├── intercept-c++
│   └── intercept-cc
├── share
│   ├── aclocal
│   ├── clang
│   ├── doc
│   ├── gtk-doc
│   ├── info
│   ├── man
│   ├── opt-viewer
│   ├── scan-build
│   ├── scan-view
│   ├── tabset
│   └── terminfo
└── var

29 directories, 136 files

@wenju-he
Copy link
Contributor

thank you @th0ma7 for the detailed steps. I reproduced the fail locally:

-- Installing: /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install/usr/local/opencl-clang/lib/pkgconfig/LLVMSPIRVLib.pc
-- Installing: /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install/usr/local/opencl-clang/include/cclang/common_clang.h
-- Installing: /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install/usr/local/opencl-clang/include/cclang/opencl-c.h
-- Installing: /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install/usr/local/opencl-clang/include/cclang/opencl-c-base.h
-- Installing: /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install/usr/local/opencl-clang/include/cclang/module.modulemap
find /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install//usr/local/opencl-clang// \! -type d -printf '%P\n' | sed 's?^target/??g' | sort | \
  diff /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/opencl-clang.plist.tmp -  | grep '>' | sed 's?> ??g' > /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/opencl-clang.plist
===>  Correcting pkg-config file lib/pkgconfig/LLVMSPIRVLib.pc
make[2]: Leaving directory '/spksrc/cross/intel-opencl-clang-140'
make[1]: Leaving directory '/spksrc/cross/intel-opencl-clang-140'
root@:/spksrc/cross/intel-opencl-clang-140#

@wenju-he
Copy link
Contributor

The install script is executed successfully, it is just that libopencl-clang.so isn't installed.

@wenju-he
Copy link
Contributor

Please note many other components, e.g. libLLVMSPIRVLib.a, are also not installed. Folder work-x64-7.1/install/usr/local/opencl-clang/lib only contains a subset of libraries in the build folder work-x64-7.1/opencl-clang.build/lib

@wenju-he
Copy link
Contributor

wenju-he commented Jul 11, 2024

@th0ma7 the root cause is probably that -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON is used in step Configuring for opencl-clang. The documentation of LLVM_INSTALL_TOOLCHAIN_ONLY is at https://github.com/llvm/llvm-project/blob/7eae9bb856135136cddc4208a2b1546e9db44c9c/llvm/docs/BuildingADistribution.rst#L252

**LLVM_INSTALL_TOOLCHAIN_ONLY**:BOOL
  This option defaults to ``Off``: when set to ``On`` it removes many of the
  LLVM development and testing tools as well as component libraries from the
  default ``install`` target. Including the development tools is not recommended
  for distributions as many of the LLVM tools are only intended for development
  and testing use.

Use of the option will stop installing of component libraries, where libopencl-clang.so belongs.

I tried to removed the option from step Configuring for opencl-clang, then build and install. libopencl-clang.so is correctly installed:

-- Installing: /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install/usr/local/opencl-clang/lib/libopencl-clang.so.14
-- Installing: /spksrc/cross/intel-opencl-clang-140/work-x64-7.1/install/usr/local/opencl-clang/lib/libopencl-clang.so

@th0ma7
Copy link
Author

th0ma7 commented Jul 11, 2024

Thnx for your time, this is really much appreciated!

@th0ma7 th0ma7 closed this as completed Jul 11, 2024
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

2 participants