Skip to content

Octave module build fails to link OpenCL with octave 9.1.0 #50

Closed
@opoplawski

Description

@opoplawski

I'm working on updating octave to 9.1.0 in Fedora Rawhide. Rebuilding the octave-mcxlab package (which uses this source) fails with:;

error: /home/orion/BUILDROOT/octave-mcxlab-2024.2-1.fc41.x86_64/usr/share/octave/packages/mcxlab-2024.2/mcxcl.mex: failed to load
Incompatible version or missing dependency?
/home/orion/BUILDROOT/octave-mcxlab-2024.2-1.fc41.x86_64/usr/share/octave/packages/mcxlab-2024.2/mcxcl.mex: undefined symbol: clBuildProgram

This is because mcxcl.mex is no longer being linked with -lOpenCL. Adding -v to mkoctfile shows:

CXXFLAGS=' ' LFLAGS='-g -L/usr/lib64/octave/9.1.0 -lOpenCL ' LDFLAGS='' mkoctfile -v mcx_host.o mcx_utils.o tictoc.o mcxcl.o mcx_shapes.o cjson/cJSON.o --mex mcxlabcl.cpp  -o ../mcxlabcl/mcxcl.mex
g++ -c   -I/usr/include/suitesparse  -I/usr/include/suitesparse -fPIC -I/usr/include/octave-9.1.0/octave/.. -I/usr/include/octave-9.1.0/octave  -pthread -fopenmp     -I.  -DMEX_DEBUG mcxlabcl.cpp -o /tmp/oct-XCR4qO.o
In file included from /usr/include/CL/cl.h:20,
                 from mcx_host.hpp:9,
                 from mcxlabcl.cpp:36:
/usr/include/CL/cl_version.h:22:104: note: ‘#pragma message: cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)’
   22 | #pragma message("cl_version.h: CL_TARGET_OPENCL_VERSION is not defined. Defaulting to 300 (OpenCL 3.0)")
      |                                                                                                        ^
g++ -I/usr/include/octave-9.1.0/octave/.. -I/usr/include/octave-9.1.0/octave  -pthread -fopenmp    -o ../mcxlabcl/mcxcl.mex  mcx_host.o mcx_utils.o tictoc.o mcxcl.o mcx_shapes.o cjson/cJSON.o /tmp/oct-XCR4qO.o   -shared -Wl,-Bsymbolic  -L/usr/lib64 -shared -Wl,-Bsymbolic      -Wl,-z,relro -Wl,--as-needed  -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -Wl,--build-id=sha1   -flto

So as you can see, none of LFLAGS ends up on the link line.

Looking at the mkoctfile man page it accepts all of those arguments as direct arguments to mkoctfile. Doing so fixes the build. I have a PR to do that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions