Compiling example under OSX Mavericks

102 views
Skip to first unread message

Francis Bruno

unread,
Jun 23, 2014, 10:36:06 AM6/23/14
to clm...@googlegroups.com
Hi all,
I'm a novice programmer who is taking an OpenCL course over the summer. I have built the clFFT libraries for mavericks and the client example seems to work. I am now trying to compile the example FFT program and get the following error:

Undefined symbols for architecture x86_64:

  "_clfftInitSetupData", referenced from:

      _main in preamble_cl-a591de.o

ld: symbol(s) not found for architecture x86_64

clang: error: linker command failed with exit code 1 (use -v to see invocation)


I have searched through the source and see references to clffInitSetupData, but do not see the source for the function and am wondering what I am doing wrong. 


The line is:


    /* Setup clFFT. */

    clfftSetupData fftSetup;

    err = clfftInitSetupData(&fftSetup);


My command line is:

gcc -o preamble_cl preamble_cl.c -lm -IclFFT/package/include -framework OpenCL -LclFFT/package/lib64/ -lclFFT -lStatTimer



Any help would be greatly appreciated.

Thanks,
Frank

Patrik Schönfeldt

unread,
Jan 22, 2016, 8:04:53 AM1/22/16
to clmath
I know, this question is quite old – however I had the same problem just now. The solution (workaround?) was to use a C++ compiler. For clFFT installed using brew I could compile the example using "g++ -o clfft-test clfft.cpp -framework OpenCL -lclFFT".
Message has been deleted

Dendi Suhubdy

unread,
Mar 24, 2016, 12:34:31 PM3/24/16
to clmath
I tried using 

C02QH2D7G8WM:openclexamples userone$ gcc -Wall clfft1.c -framework OpenCL -lclfft -o foo

 

clfft1
.c:23:14: warning: unused variable 'event' [-Wunused-variable]

    cl_event
event = NULL;

             
^

1 warning generated.

Undefined symbols for architecture x86_64:

 
"_clfftInitSetupData", referenced from:


      _main
in clfft1-0df61d.o

ld
: symbol(s) not found for architecture x86_64

clang
: error: linker command failed with exit code 1 (use -v to see invocation)


But when I changed to C++ and used

C02QH2D7G8WM:openclexamples userone$ g++ -Wall clfft1.cpp -framework OpenCL -lclFFT -o clfft1

 

clfft1
.cpp:23:14: warning: unused variable 'event' [-Wunused-variable]

    cl_event
event = NULL;

             
^

1 warning generated.


It is fine.


Reply all
Reply to author
Forward
0 new messages