[R-pkg-devel] CL/cl.hpp file not found
Thanks! It seems that the headers can be easily shipped without much effort inside the inst/include/CL/, working at least for both Debian and Windows for now. (Updates available on https://github.com/Quirinms/GeneralizedUmatrixGPU/tree/main) However, there comes another problem afterwards with a dynamic library/shared object (Win/Debian). After finding the headers, following message appeared: D:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: cannot find -lOpenCL: No such file or directory similar in Debian: Error: package or namespace load failed for ?GeneralizedUmatrixGPU? in library.dynam(lib, package, package.lib): shared object ?GeneralizedUmatrixGPU.so? not found For?Windows there is more output using -lOpenCL --verbose: g++ -std=gnu++17 -shared -s -static-libgcc -o GeneralizedUmatrixGPU.dll tmp.def RcppExports.o trainSESOM.o -Ld:/RCompile/CRANpkg/extralibs/OpenCL/lib/x64/ -lOpenCL --verbose -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -lR Using built-in specs. COLLECT_GCC=D:\rtools45\x86_64-w64-mingw32.static.posix\bin\g++.exe COLLECT_LTO_WRAPPER=D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../libexec/gcc/x86_64-w64-mingw32.static.posix/14.2.0/lto-wrapper.exe Target: x86_64-w64-mingw32.static.posix Configured with: /root/mxe/tmp-gcc-host-x86_64-w64-mingw32.static.posix/gcc-14.2.0/configure --host=x86_64-w64-mingw32.static.posix --target=x86_64-w64-mingw32.static.posix --build=x86_64-pc-linux-gnu --prefix=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-native-system-header-dir=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix/include --enable-languages=c,c++,objc,fortran --enable-version-specific-runtime-libs --with-gcc --with-gnu-ld --with-gnu-as --disable-nls --without-libiconv-prefix --disable-shared --disable-multilib --without-x --disable-win32-registry --enable-threads=posix --enable-libgomp --with-gmp=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-isl=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-mpc=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --with-mpfr=/usr/lib/mxe/usr/x86_64-w64-mingw32.static.posix --enable-libstdcxx-time target_configargs=XCFLAGS=-Wno-format ac_cv_header_sys_mman_h=no Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.2.0 (GCC) COMPILER_PATH=D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../libexec/gcc/x86_64-w64-mingw32.static.posix/14.2.0/;D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../libexec/gcc/ LIBRARY_PATH=D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/;D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/;D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/../../../../lib/;D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/../../../ COLLECT_GCC_OPTIONS='-std=gnu++17' '-shared' '-s' '-static-libgcc' '-o' 'GeneralizedUmatrixGPU.dll' '-Ld:/RCompile/CRANpkg/extralibs/OpenCL/lib/x64/' '-v' '-Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64' '-Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib' '-LD:/RCompile/recent/R/bin/x64' '-mtune=generic' '-march=x86-64' '-dumpdir' 'GeneralizedUmatrixGPU.dll.' D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../libexec/gcc/x86_64-w64-mingw32.static.posix/14.2.0/collect2.exe -plugin D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../libexec/gcc/x86_64-w64-mingw32.static.posix/14.2.0/liblto_plugin.dll -plugin-opt=D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../libexec/gcc/x86_64-w64-mingw32.static.posix/14.2.0/lto-wrapper.exe -plugin-opt=-fresolution=D:\temp\2025_08_29_11_20_18_14976\cc2Dbamn.res -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lpthread -plugin-opt=-pass-through=-ladvapi32 -plugin-opt=-pass-through=-lshell32 -plugin-opt=-pass-through=-luser32 -plugin-opt=-pass-through=-lkernel32 -plugin-opt=-pass-through=-lmingw32 -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lmingwex -plugin-opt=-pass-through=-lmsvcrt -plugin-opt=-pass-through=-lkernel32 -m i386pep --shared -Bdynamic -e DllMainCRTStartup --enable-auto-image-base -o GeneralizedUmatrixGPU.dll -s D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/../../../../lib/dllcrt2.o D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/crtbegin.o -Ld:/RCompile/CRANpkg/extralibs/OpenCL/lib/x64/ -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib/x64 -Ld:/rtools45/x86_64-w64-mingw32.static.posix/lib -LD:/RCompile/recent/R/bin/x64 -LD:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0 -LD:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc -LD:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/../../../../lib -LD:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/../../.. tmp.def RcppExports.o trainSESOM.o -lOpenCL -lR -lstdc++ -lmingw32 -lgcc -lmingwex -lmsvcrt -lkernel32 -lpthread -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmingwex -lmsvcrt -lkernel32 D:/rtools45/x86_64-w64-mingw32.static.posix/bin/../lib/gcc/x86_64-w64-mingw32.static.posix/14.2.0/crtend.o D:\rtools45\x86_64-w64-mingw32.static.posix\bin/ld.exe: cannot find -lOpenCL: No such file or directory collect2.exe: error: ld returned 1 exit status no DLL was created ERROR: compilation failed for package 'GeneralizedUmatrixGPU' Am 28.08.2025 um 15:31 schrieb Dirk Eddelbuettel:
On 28 August 2025 at 13:25, quirin stier wrote: | D:/RCompile/CRANincoming/R-devel/lib/RcppArmadillo/include/current/armadillo_bits/config.hpp:373:72: note: '#pragma message: NOTE: option ARMA_CRIPPLED_LAPACK is not supported' That is a side effect from CRAN and me trying to figure out how to accomodate breaking changes in the new Armadillo upstream. Ignore this for now, this is a likely side-effect of a tested version being on the CRAN machine when this ran. The released RcppArmadillo will not trigger ut, | * installing *source* package ?GeneralizedUmatrixGPU? ... | ** this is package ?GeneralizedUmatrixGPU? version ?0.0.1? | ** using staged installation | ** libs | using C++ compiler: ?Debian clang version 19.1.7 (3+b2)? | clang++-19 -std=gnu++17 -I"/home/hornik/tmp/R/include" -DNDEBUG -I'/home/hornik/lib/R/Library/4.6/x86_64-linux-gnu/Rcpp/include' -I'/home/hornik/lib/R/Library/4.6/x86_64-linux-gnu/RcppArmadillo/include' -I'/home/hornik/lib/R/Library/4.6/x86_64-linux-gnu/RcppParallel/include' -I/usr/local/include -DUSE_TYPE_CHECKING_STRICT -D_FORTIFY_SOURCE=3 -fpic -g -O3 -Wall -pedantic -Wno-missing-template-arg-list-after-template-kw -Wdeprecated-literal-operator -c RcppExports.cpp -o RcppExports.o | clang++-19 -std=gnu++17 -I"/home/hornik/tmp/R/include" -DNDEBUG -I'/home/hornik/lib/R/Library/4.6/x86_64-linux-gnu/Rcpp/include' -I'/home/hornik/lib/R/Library/4.6/x86_64-linux-gnu/RcppArmadillo/include' -I'/home/hornik/lib/R/Library/4.6/x86_64-linux-gnu/RcppParallel/include' -I/usr/local/include -DUSE_TYPE_CHECKING_STRICT -D_FORTIFY_SOURCE=3 -fpic -g -O3 -Wall -pedantic -Wno-missing-template-arg-list-after-template-kw -Wdeprecated-literal-operator -c trainSESOM.cpp -o trainSESOM.o | In file included from trainSESOM.cpp:2: | ./ocl.h:9:10: fatal error: 'CL/cl.hpp' file not found | 9 | #include <CL/cl.hpp> | | ^~~~~~~~~~~ | 1 error generated. | make: *** [/home/hornik/tmp/R/etc/Makeconf:209: trainSESOM.o] Error 1 | ERROR: compilation failed for package ?GeneralizedUmatrixGPU? | * removing *?/srv/hornik/tmp/CRAN_pretest/GeneralizedUmatrixGPU.Rcheck/GeneralizedUmatrixGPU? Do you ensure the CL headers are installed? On Debian these come for example from package opencl-clhpp-headers [1] (but you have no general control over what is installed). At least package gpuR ships it for R, and you check how few other packages test for this via a search at github.org/cran (a mirror) [2]. It looks to me like you need to take better care of the 'configure does not find cl.hpp' case (and you need to add logic to your package to have that test). Dirk [1]https://packages.debian.org/search?searchon=contents&keywords=CL%2Fcl.hpp&mode=path&suite=unstable&arch=any [2]https://github.com/search?q=org%3Acran%20CL%2Fcl.hpp&type=code