Im using Cudas cuFFT library and therefore I have added the library path to $LD_LIBRARY_PATH. When compiling, Im using the -lcufft flag, after including the header with #include<cufft.h>. But I still receive the following errors:
/usr/bin/ld: tmpxft_000029f1_00000000-6_render.cudafe1.cpp:(.text+0x51b): undefined reference to `cufftExecR2C'
/usr/bin/ld: tmpxft_000029f1_00000000-6_render.cudafe1.cpp:(.text+0x528): undefined reference to `cufftDestroy'
/usr/bin/ld: tmpxft_000029f1_00000000-6_render.cudafe1.cpp:(.text+0x16d8): undefined reference to `cufftPlan2d'
/usr/bin/ld: tmpxft_000029f1_00000000-6_render.cudafe1.cpp:(.text+0x16f3): undefined reference to `cufftExecC2R'
/usr/bin/ld: tmpxft_000029f1_00000000-6_render.cudafe1.cpp:(.text+0x16fd): undefined reference to `cufftDestroy'
collect2: error: ld returned 1 exit status
This is a CMake project and I link via: set(CMAKE_CUDA_FLAGS_RELEASE " -I/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/math_libs/include -L/opt/nvidia/hpc_sdk/Linux_x86_64/22.11/math_libs/lib64 -lcufft")
Am I missing something crucial?
I have a c++ program, which uses the FFTW3 library, which I would like to translate to Fortran. I am using Ubuntu 22.04.1.
I installed the FFTW3 library as detailed in Installation on UNIX
The c++ main program is named ksbenchmark.cpp and, using g++, I compile it and link it (to the math and fftw3 libraries) with
g++ -o my_executable.out ksbenchmark.cpp -lm -lfftw3
which works great.
I have translate the c++ code in Fortran, the source file being named ksbenchmrk.f90.
If I issue
gfortran ksbenchmark.f90 -lfftw3 -lm
I get error messages
/usr/bin/ld: /tmp/cca2xMGa.o: in function `ksintegrate_':
ksbenchmark.f90:(.text+0x59): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x94): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksbenchmark.f90:(.text+0xcf): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x4de): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x5db): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x626): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0x780): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksbenchmark.f90:(.text+0xa1c): undefined reference to `dfftw_execute_'
collect2: error: ld returned 1 exit status
I have spent the afternoon reading about it, and it seems I may have to use -I and -L flags such as
gfortran test.f90 -L/new/path/to/lib -I/new/path/to/include -lfftw3 -lm
as illustrated in the post Problems linking FFTW with gfortran (symbol(s) not found for architecture x86_64).
The first question is, what paths to use?
I can find files referring to fftw3 in /usr/local/lib as well as in /usr/local/include, but the attempt
gfortran ksbenchmark.f90 -L/usr/local/lib -I/usr/local/include -lfftw3 -lm
returns the same error as before
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x1b): undefined reference to `main'
/usr/bin/ld: /tmp/ccW2DYGP.o: in function `ksintegrate_':
ksintegrate.f90:(.text+0x62): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksintegrate.f90:(.text+0x9d): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksintegrate.f90:(.text+0xd8): undefined reference to `dfftw_plan_dft_1d_'
/usr/bin/ld: ksintegrate.f90:(.text+0x4df): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0x5f7): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0x643): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0x79d): undefined reference to `dfftw_execute_'
/usr/bin/ld: ksintegrate.f90:(.text+0xa5b): undefined reference to `dfftw_execute_'
collect2: error: ld returned 1 exit status
I am unable to understand which paths to the library are to be used.
How to find where the library is saved?
Why does not g++ need any paths to the library?
I apologise for how trivial the question might seem, I am a total newbie can ensure I put a significant effort in trying to sort this out. Any hint would be most appreciated, thanks
EDIT
Following Vladimir F Героям слава's advice, I tried using the nm command to verify the library contains what is expected to.
In /usr/local/lib
I found libfftw3.a and libfftw3.la files.
Issuing nm libfftw3.a I get quite a long list.
I tried looking for one of the commands I get an error about, dfftw_plan_dft_1d
nm -S libfftw3.a | grep dfftw_plan_dft_1d
and indeed it returns hits
00000000000003a0 0000000000000026 T _Z18dfftw_plan_dft_1d_PP11fftw_plan_sPiPA2_dS4_S2_S2_
0000000000002df0 0000000000000026 T _Z19dfftw_plan_dft_1d__PP11fftw_plan_sPiPA2_dS4_S2_S2_
Im having trouble changing my project from Sfml to SDL2+opengl3 rendering. The error im getting with my current CMake setup is ImGui not linking to a subfolder of mine in which i create a SHARED library: UserInterface.
Now i have tried declaring UserInterface a dependency of ImGui library:
(target_link_libraries(UserInterface imgui))
and without it.
I get a few different errors depending on how i set up CMake, but all of them must be wrong:
Without the line i get a bunch of undefined references:
/usr/bin/ld: UserInterface/libUserInterface.so: undefined reference to `ImGui_ImplOpenGL3_Init(char const*)'
/usr/bin/ld: UserInterface/libUserInterface.so: undefined reference to `ImGui::ShowDemoWindow(bool*)'
With that line i get:
/usr/bin/ld: ../libimgui.a(imgui_demo.cpp.o): relocation R_X86_64_PC32 against symbol `GImGuiDemoMarkerCallback' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
If i then change my UserInterface, and imgui to STATIC libraries i get this error:
/usr/bin/ld: libimgui.a(imgui_impl_opengl3.cpp.o): undefined reference to symbol 'dlclose##GLIBC_2.2.5'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libdl.so: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Just to clarify, all these are linking errors when linking CXX executable digitus,
which is my application.
project:
build
CMakeLists.txt
src (folder)
CMakeLists.txt
main.cpp
(all required imgui files)
UserInterface (folder)
CMakeLists.txt
[...]
Action (folder)
[...]
My topmost CMakeLists.txt:
cmake_minimum_required(VERSION 3.20)
set (CMAKE_CXX_STANDARD 17)
project(digitus)
set(CMAKE_MODULE_PATH "/usr/local/lib/cmake") # tell cmake where to find find.cmake and config.cmake files
find_package(OpenGL REQUIRED)
find_package(SDL2 REQUIRED)
find_package(GLEW REQUIRED)
find_package(glm REQUIRED)
#include_directories(${SDL2_INCLUDE_DIR}) # add sdl2's include dir
add_subdirectory(src)
This is my CMakeLists.txt inside the src folder:
SET(SOURCES
main.cpp
ApplicationManager.cpp
ApplicationManager.h
[...]
)
SET( IMGUISOURCE
imconfig.h
imgui_demo.cpp
imgui_draw.cpp
imgui_impl_opengl3_loader.h
imgui_impl_opengl3.cpp
imgui_impl_opengl3.h
imgui_impl_sdl.cpp
imgui_impl_sdl.h
imgui_internal.h
imgui_tables.cpp
imgui_widgets.cpp
imgui.cpp
imgui.h
)
add_executable(digitus ${SOURCES})
target_link_libraries(digitus glm::glm )
target_link_libraries(digitus ${CMAKE_DL_LIBS})
add_library(imgui ${IMGUISOURCE})
target_link_libraries(digitus imgui)
add_subdirectory(Action)
add_subdirectory(UserInterface)
#target_link_libraries(UserInterface imgui)
target_link_libraries(digitus UserInterface)
target_link_libraries(digitus Action)
target_link_libraries(digitus SDL2)
target_link_libraries(digitus GLEW::glew)
target_link_libraries(digitus OpenGL::GL )
The CMakeLists.txt inside UserInterface:
Set(USERINTERFACESOURCE
UserInterface.h
UserInterface.cpp
CircuitWindow.h
CircuitWindow.cpp
)
add_library(UserInterface STATIC ${USERINTERFACESOURCE})
I have a main.cpp file that includes a header file from the same directory where I have used the boost library, magickimage c++ library, and eigen library. Here is my CMakeLists.txt file where I have linked the .lib and .a files to my target and set the includer paths.
cmake_minimum_required(VERSION 3.20.2)
project(blackjackAI)
add_executable(blackjackAI main.cpp)
target_link_libraries(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/c++Dep/boost_1_77_0/stage/lib/libboost_filesystem-gcc10-mt-x64-1_77.a)
target_link_libraries(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/c++Dep/ImageMagick-7.1.0-Q16-HDRI/lib/CORE_RL_Magick++_.lib)
target_link_libraries(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/c++Dep/ImageMagick-7.1.0-Q16-HDRI/lib/CORE_RL_MagickCore_.lib)
target_link_libraries(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/c++Dep/ImageMagick-7.1.0-Q16-HDRI/lib/CORE_RL_MagickWand_.lib)
target_include_directories(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/c++Dep/ImageMagick-7.1.0-Q16-HDRI/include)
target_include_directories(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/c++Dep/eigen-3.4.0)
target_include_directories(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/c++Dep/boost_1_77_0)
target_include_directories(blackjackAI PRIVATE C:/Users/Ejer/Desktop/c++/blackjackAI)
For some reason when I compile my CMakeLists.txt file with the "MinGW Makefiles" generator and then use the makefile I get the following linker error:
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles\blackjackAI.dir/objects.a(main.cpp.obj):C:\Users\Ejer
\Desktop\c++\blackjackAI\main.cpp:(.text$_ZN6CnnNetC1ESs[_ZN6CnnNetC1ESs]+0x3dd): undefined reference to `Magick::Image::Image()'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles\blackjackAI.dir/objects.a(main.cpp.obj):C:\Users\Ejer
\Desktop\c++\blackjackAI\main.cpp:(.text$_ZN6CnnNetC1ESs[_ZN6CnnNetC1ESs]+0x413): undefined reference to `Magick::Image::read(std::str
ing const&)'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles\blackjackAI.dir/objects.a(main.cpp.obj):C:\Users\Ejer
\Desktop\c++\blackjackAI\main.cpp:(.text$_ZN6CnnNetC1ESs[_ZN6CnnNetC1ESs]+0x436): undefined reference to `Magick::Image::type(MagickCo
re::ImageType)'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles\blackjackAI.dir/objects.a(main.cpp.obj):C:\Users\Ejer
\Desktop\c++\blackjackAI\main.cpp:(.text$_ZN6CnnNetC1ESs[_ZN6CnnNetC1ESs]+0x45b): undefined reference to `Magick::Image::~Image()'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles\blackjackAI.dir/objects.a(main.cpp.obj):C:\Users\Ejer
\Desktop\c++\blackjackAI\main.cpp:(.text$_ZN6CnnNetC1ESs[_ZN6CnnNetC1ESs]+0x539): undefined reference to `Magick::Image::~Image()'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles\blackjackAI.dir/objects.a(main.cpp.obj):C:\Users\Ejer
\Desktop\c++\blackjackAI\main.cpp:(.text$_ZN9__gnu_cxx13new_allocatorIN6Magick5ImageEE9constructIS2_JRKS2_EEEvPT_DpOT0_[_ZN9__gnu_cxx1
3new_allocatorIN6Magick5ImageEE9constructIS2_JRKS2_EEEvPT_DpOT0_]+0x46): undefined reference to `Magick::Image::Image(Magick::Image co
nst&)'
/usr/lib/gcc/x86_64-pc-cygwin/10/../../../../x86_64-pc-cygwin/bin/ld: CMakeFiles\blackjackAI.dir/objects.a(main.cpp.obj):C:\Users\Ejer
\Desktop\c++\blackjackAI\main.cpp:(.text$_ZSt10_ConstructIN6Magick5ImageEJRKS1_EEvPT_DpOT0_[_ZSt10_ConstructIN6Magick5ImageEJRKS1_EEvP
T_DpOT0_]+0x42): undefined reference to `Magick::Image::Image(Magick::Image const&)'
collect2: error: ld returned 1 exit status
CMakeFiles\blackjackAI.dir\build.make:102: recipe for target 'blackjackAI.exe' failed
mingw32-make[2]: *** [blackjackAI.exe] Error 1
CMakeFiles\Makefile2:81: recipe for target 'CMakeFiles/blackjackAI.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/blackjackAI.dir/all] Error 2
Makefile:89: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
It says that I have undefined references to the use of the Image class in my header file, even though I have linked my includer path and .lib files in CMakeLists.txt file and my main.cpp file to the imagemagick library. What is causing the problem?
I try to build clFFT library (for doing FFT with OpenCL) and examples contained into clFFT git.
First, into /opt/, I did :
git clone https://github.com/clMathLibraries/clFFT.git
After, always into /opt/ directory, I did : $ mkdir build && cd build/
from here, I called cmake like this :
cmake -DOpenCL_INCLUDE_DIR=/opt/AMDAPPSDK-3.0/include -DOpenCL_LIBRARY=/opt/AMDAPPSDK-3.0/lib/x86_64 ../clFFT/src/
Indeed, into /opt/ directory, I have installed AMDAPPSDK-3.0from the AMD-APP-SDKInstaller-v3.0.130.136-GA-linux64.tar.bz2archive.
Everything seems to be valid for the compilation of clFFT but it fails :
4.1) First, at the end of cmakecommand above, I get :
cmake -DOpenCL_INCLUDE_DIR=/opt/AMDAPPSDK-3.0/include -DOpenCL_LIBRARY=/opt/AMDAPPSDK-3.0/lib/x86_64 ../clFFT/src/
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- UNICODE feature disabled on linux
-- 64bit build - FIND_LIBRARY_USE_LIB64_PATHS TRUE
-- Could NOT find Boost
CMake Warning at CMakeLists.txt:146 (message):
Try setting Boost_DEBUG and Boost_DETAILED_FAILURE_MSG for more information
-- Looking for CL_VERSION_2_2
-- Looking for CL_VERSION_2_2 - not found
-- Looking for CL_VERSION_2_1
-- Looking for CL_VERSION_2_1 - not found
-- Looking for CL_VERSION_2_0
-- Looking for CL_VERSION_2_0 - found
-- Found OpenCL: /opt/AMDAPPSDK-3.0/lib/x86_64 (found version "2.0")
-- Found FFTW: /usr/lib/x86_64-linux-gnu/libfftw3f.so;/usr/lib/x86_64-linux-gnu/libfftw3.so
-- Detected GNU fortran compiler.
-- CMAKE_CXX_COMPILER flags: -m64 -pthread
-- CMAKE_CXX_COMPILER debug flags: -g
-- CMAKE_CXX_COMPILER release flags: -O3 -DNDEBUG
-- CMAKE_CXX_COMPILER relwithdebinfo flags: -O2 -g -DNDEBUG
-- CMAKE_EXE_LINKER link flags:
FFT clients will NOT be built
GoogleTest unit tests will NOT be built
FFT callback client will NOT be built
-- Configuring done
WARNING: Target "clFFT" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "clFFT" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "StatTimer" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "StatTimer" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "example_examples_fft2d" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "example_examples_fft3d" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "example_examples_fft1d" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /opt/build
more precisely, I am talking about :
-- Configuring done
WARNING: Target "clFFT" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "clFFT" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "StatTimer" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "StatTimer" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "example_examples_fft2d" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "example_examples_fft3d" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
WARNING: Target "example_examples_fft1d" requests linking to directory "/opt/AMDAPPSDK-3.0/lib/x86_64". Targets may link only to libraries. CMake is dropping the item.
-- Generating done
-- Build files have been written to: /opt/build
4.2) After launching makeinto /opt/build/ directory, I get the following warnings :
$ make
Scanning dependencies of target clFFT
[ 3%] Building CXX object library/CMakeFiles/clFFT.dir/transform.cpp.o
In file included from /opt/clFFT/src/library/repo.h:26,
from /opt/clFFT/src/library/transform.cpp:23:
/opt/clFFT/src/library/../statTimer/statisticalTimer.GPU.h:132:42: warning: ignoring attributes on template argument âcl_uintâ {aka âunsigned intâ} [-Wignored-attributes]
typedef std::pair< std::string, cl_uint > idPair;
^
[ 7%] Building CXX object library/CMakeFiles/clFFT.dir/accessors.cpp.o
In file included from /opt/clFFT/src/library/repo.h:26,
from /opt/clFFT/src/library/accessors.cpp:23:
/opt/clFFT/src/library/../statTimer/statisticalTimer.GPU.h:132:42: warning: ignoring attributes on template argument âcl_uintâ {aka âunsigned intâ} [-Wignored-attributes]
typedef std::pair< std::string, cl_uint > idPair;
^
[ 11%] Building CXX object library/CMakeFiles/clFFT.dir/plan.cpp.o
In file included from /opt/clFFT/src/library/repo.h:26,
from /opt/clFFT/src/library/plan.cpp:25:
/opt/clFFT/src/library/../statTimer/statisticalTimer.GPU.h:132:42: warning: ignoring attributes on template argument âcl_uintâ {aka âunsigned intâ} [-Wignored-attributes]
typedef std::pair< std::string, cl_uint > idPair;
^
[ 15%] Building CXX object library/CMakeFiles/clFFT.dir/repo.cpp.o
In file included from /opt/clFFT/src/library/repo.h:26,
from /opt/clFFT/src/library/repo.cpp:22:
...
and finally, I get the following ending errors :
[ 80%] Building C object examples/CMakeFiles/example_examples_fft2d.dir/fft2d.c.o
/opt/clFFT/src/examples/fft2d.c: In function âmainâ:
/opt/clFFT/src/examples/fft2d.c:63:5: warning: âclCreateCommandQueueâ is deprecated [-Wdeprecated-declarations]
queue = clCreateCommandQueue( ctx, device, 0, &err );
^~~~~
In file included from /opt/clFFT/src/include/clFFT.h:33,
from /opt/clFFT/src/examples/fft2d.c:21:
/opt/AMDAPPSDK-3.0/include/CL/cl.h:1359:1: note: declared here
clCreateCommandQueue(cl_context /* context */,
^~~~~~~~~~~~~~~~~~~~
[ 84%] Linking C executable examples/fft2d
/usr/bin/ld: CMakeFiles/example_examples_fft2d.dir/fft2d.c.o: in function `main':
fft2d.c:(.text.startup+0x76): undefined reference to `clGetPlatformIDs'
/usr/bin/ld: fft2d.c:(.text.startup+0x9d): undefined reference to `clGetPlatformInfo'
/usr/bin/ld: fft2d.c:(.text.startup+0xd1): undefined reference to `clGetDeviceIDs'
/usr/bin/ld: fft2d.c:(.text.startup+0xf6): undefined reference to `clGetDeviceInfo'
/usr/bin/ld: fft2d.c:(.text.startup+0x13c): undefined reference to `clCreateContext'
/usr/bin/ld: fft2d.c:(.text.startup+0x152): undefined reference to `clCreateCommandQueue'
/usr/bin/ld: fft2d.c:(.text.startup+0x215): undefined reference to `clCreateBuffer'
/usr/bin/ld: fft2d.c:(.text.startup+0x241): undefined reference to `clEnqueueWriteBuffer'
/usr/bin/ld: fft2d.c:(.text.startup+0x307): undefined reference to `clFinish'
/usr/bin/ld: fft2d.c:(.text.startup+0x334): undefined reference to `clEnqueueReadBuffer'
/usr/bin/ld: fft2d.c:(.text.startup+0x3a7): undefined reference to `clReleaseMemObject'
/usr/bin/ld: fft2d.c:(.text.startup+0x3cc): undefined reference to `clReleaseCommandQueue'
/usr/bin/ld: fft2d.c:(.text.startup+0x3d5): undefined reference to `clReleaseContext'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clBuildProgram'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clEnqueueNDRangeKernel'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clSetKernelArg'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clGetCommandQueueInfo'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clReleaseEvent'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clGetProgramBuildInfo'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clGetContextInfo'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clCreateProgramWithBinary'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clRetainContext'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clReleaseProgram'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clGetProgramInfo'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clCreateKernel'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clCreateProgramWithSource'
/usr/bin/ld: ../library/libclFFT.so.2.14.0: undefined reference to `clReleaseKernel'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/CMakeFiles/example_examples_fft2d.dir/build.make:85: examples/examples/fft2d] Error 1
make[1]: *** [CMakeFiles/Makefile2:223: examples/CMakeFiles/example_examples_fft2d.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
I don't understand where these errors could come from, it seems that the library libclFFT.so.2.14.0 I have built doesn't contain the references to OpenCL basic functions (like clGetPlatformIDs or clCreateCommandQueue...).
Moreover, I don't know why the path of undefined reference is to the upper level, i.e /usr/bin/ld: ../library/libclFFT.so.2.14.0, because the library is built into /opt/build/library directory.
I would like to be able to compile fine the libclFFT.so that takes into account the OpenCL headers indicated by the path OpenCL_INCLUDE_DIR and library by OpenCL_LIBRARY.
I have to solve this issue of path taken by cmake, i.e : ../library/libclFFT.so.2.14.0and include into the building of this library all the OpenCL functions from AMDAPPSDK.
The cmake setup on your machine should have an OpenCL finder, which is called by the command find_package(OpenCL) when the cmake executes the CMakeLists.txt file from the clFFT distribution (this command can be used also in your own CMakeLists.txt files). This finder is simply a file, named FindOpenCL.cmake, which must be a part of the cmake configuration. Make sure you have this file:
find /usr -name FindOpenCL.cmake
If you have this finder you won't need to set variables OpenCL_INCLUDE_DIR and OpenCL_LIBRARY in the cmake call - the finder will find all the needed OpenCL paths. If you have this finder but it doesn't work correctly - then it'll be a question for its developers. If you don't have this finder then it'll be a problem in the cmake installation and/or setup. This finder is described here.
According to our conversation in comments, you tried to use the AMD APP SDK v3.0 package on MacOS - this couldn't work because AMD supported only Windows and Linux operating systems. It's understandable because Apple has long history of its own OpenCL support - please see here.