Skip to content

[R-pkg-devel] CL/cl.hpp file not found

4 messages · Dirk Eddelbuettel, quirin stier, Ivan Krylov

#
Hi everyone,

sry for the double mail - I included the old error output from a 
previous version, only the location of the?#include "CL/cl.hpp"? changed 
to ocl.h in /src.

CRAN Submission of package 
(https://github.com/Quirinms/GeneralizedUmatrixGPU/tree/main)?leads to 
an error.

Windows system:

* installing *source* package 'GeneralizedUmatrixGPU' ...
** this is package 'GeneralizedUmatrixGPU' version '0.0.1'
** using staged installation

  === configurig OpenCL for x64 ==

  OCL=d:/RCompile/CRANpkg/extralibs/OpenCL

SDK appears to include only one architecture, assuming it is 64-bit
OCL64LIB not set, assuming d:/RCompile/CRANpkg/extralibs/OpenCL/lib/OpenCL.lib
OCL32LIB not set, assuming d:/RCompile/CRANpkg/extralibs/OpenCL/lib/x86/OpenCL.lib
OCLINC not set, assuming -Id:/RCompile/CRANpkg/extralibs/OpenCL/include

  --- Compiling 64-bit ---
OCL=d:/RCompile/CRANpkg/extralibs/OpenCL
PKG_CPPFLAGS=-Id:/RCompile/CRANpkg/extralibs/OpenCL/include
PKG_LIBS=d:/RCompile/CRANpkg/extralibs/OpenCL/lib/OpenCL.lib

Similar in Debian system:

** libs
using C++ compiler: 'g++.exe (GCC) 14.2.0'
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG '-I-Id:/RCompile/CRANpkg/extralibs/OpenCL/include' -I'D:/RCompile/CRANpkg/lib/4.6/Rcpp/include' -I'D:/RCompile/CRANincoming/R-devel/lib/RcppArmadillo/include' -I'D:/RCompile/CRANincoming/R-devel/lib/RcppParallel/include'   -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include"      -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign    -c RcppExports.cpp -o RcppExports.o
In file included from D:/RCompile/CRANincoming/R-devel/lib/RcppArmadillo/include/current/armadillo:26,
                  from D:/RCompile/CRANincoming/R-devel/lib/RcppArmadillo/include/RcppArmadillo/interface/RcppArmadilloForward.h:51,
                  from D:/RCompile/CRANincoming/R-devel/lib/RcppArmadillo/include/RcppArmadillo.h:29,
                  from RcppExports.cpp:4:
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'
   373 |   #pragma message ("NOTE: option ARMA_CRIPPLED_LAPACK is not supported")
       |                                                                        ^
g++ -std=gnu++17  -I"D:/RCompile/recent/R/include" -DNDEBUG '-I-Id:/RCompile/CRANpkg/extralibs/OpenCL/include' -I'D:/RCompile/CRANpkg/lib/4.6/Rcpp/include' -I'D:/RCompile/CRANincoming/R-devel/lib/RcppArmadillo/include' -I'D:/RCompile/CRANincoming/R-devel/lib/RcppParallel/include'   -I"d:/rtools45/x86_64-w64-mingw32.static.posix/include"      -pedantic -O2 -Wall  -mfpmath=sse -msse2 -mstackrealign    -c trainSESOM.cpp -o trainSESOM.o
In file included from trainSESOM.cpp:2:
ocl.h:7:10: fatal error: CL/cl.h: No such file or directory
     7 | #include <CL/cl.h>
       |          ^~~~~~~~~
compilation terminated.
make: *** [D:/RCompile/recent/R/etc/x64/Makeconf:296: trainSESOM.o] Error 1
ERROR: compilation failed for package 'GeneralizedUmatrixGPU'
* removing 'd:/RCompile/CRANincoming/R-devel/lib/GeneralizedUmatrixGPU'


* 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?

Best,

Quirin
#
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
#
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 Fri, 29 Aug 2025 14:11:18 +0200
quirin stier <Quirin_Stier at gmx.de> wrote:

            
There's an extra line copied from OpenCL's src/Makevars file:
The OpenCL package only needs this on Windows so that the system OpenCL.dll
doesn't conflict with with the package OpenCL.dll; the change in
src/Makevars was done to simplify loading the shared library from the
package NAMESPACE [*]. Your package doesn't need to rename the shared
library.
That could be due to the OpenCL SDK shipping the import library in
lib/x86_64 instead of lib/x64 where your package's 'configure.win'
expects it, or for some other reason. When you discussed the installation of OpenCL SDK on Win-Builder with Dr. Uwe Ligges, was a specific version of it mentioned?