Closed shuwang1 closed 5 years ago
See the FAQ: http://fftw.org/faq/section3.html#linkfails
You need to link in the order -lfftw3_threads -lfftw3
, not the other way around.
You must link the threads library before the fftw library, e.g.:
-lfftw3_threads -lfftw3
The linker keeps a set of undefined symbols and it scans libraries in order attempting to resolve them. Thus, if A depends on B, you must use -lA before -lB.
Shu Wang notifications@github.com writes:
Hello All,
I have difficulty in linking my application using FFTW. Any idea of how I should do next? thx!
g++ -o gnss-sdrcli sdrmain.o sdrcmn.o sdracq.o sdrcode.o sdrinit.o sdrnav.o sdrnav_gps.o sdrnav_glo.o sdrnav_gal.o sdrnav_bds.o sdrnav_sbs.o sdrout.o sdrplot.o sdrrcv.o sdrspec.o sdrtrk.o sdrlex.o sdrsync.o rtkcmn.o rtcm.o rtcm2.o rtcm3.o rtcm3e.o rinex.o fec.o viterbi27_port.o decode_rs_ccsds.o decode_rs_8.o rtlsdr.o convenience.o -Wall -O3 -march=native -I../../src -I../../lib/rtklib -I../../lib/fec -I../../lib/json -I../../src/rcv/rtlsdr -DFFTMTX -DRTLSDR -g -lm -lrt -lfftw3 -lfftw3_threads -lfftw3f -lfftw3f_threads -lfftw3l -lfftw3l_threads -lpthread -lusb-1.0 -lfec -L /usr/local/lib/ -lrtlsdr
/usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-api.o): In function
fftwf_init_threads': api.c:(.text+0x38): undefined reference to
fftwf_mksolver_ct_hook' api.c:(.text+0x46): undefined reference tofftwf_mksolver_hc2hc_hook' api.c:(.text+0x4b): undefined reference to
fftwf_the_planner' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-api.o): In functionfftwf_cleanup_threads': api.c:(.text+0x75): undefined reference to
fftwf_cleanup' api.c:(.text+0x8b): undefined reference tofftwf_mksolver_ct_hook' api.c:(.text+0x96): undefined reference to
fftwf_mksolver_hc2hc_hook' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-api.o): In functionfftwf_plan_with_nthreads': api.c:(.text+0xc3): undefined reference to
fftwf_the_planner' api.c:(.text+0xd3): undefined reference tofftwf_imax' api.c:(.text+0xf1): undefined reference to
fftwf_cleanup' api.c:(.text+0x112): undefined reference tofftwf_mksolver_ct_hook' api.c:(.text+0x120): undefined reference to
fftwf_mksolver_hc2hc_hook' api.c:(.text+0x125): undefined reference tofftwf_the_planner' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-conf.o): In function
fftwf_threads_conf_standard': conf.c:(.text+0xb): undefined reference tofftwf_solvtab_exec' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-threads.o): In function
worker': threads.c:(.text+0x74): undefined reference tofftwf_assertion_failed' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-threads.o): In function
fftwf_ithreads_init': threads.c:(.text+0x194): undefined reference tofftwf_assertion_failed' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-threads.o): In function
fftwf_spawn_loop': threads.c:(.text+0x414): undefined reference tofftwf_assertion_failed' threads.c:(.text+0x434): undefined reference to
fftwf_assertion_failed' threads.c:(.text+0x454): undefined reference tofftwf_assertion_failed' threads.c:(.text+0x476): undefined reference to
fftwf_malloc_plain' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-threads.o): In functionfftwf_threads_cleanup': threads.c:(.text+0x5c0): undefined reference to
fftwf_ifree' threads.c:(.text+0x624): undefined reference tofftwf_assertion_failed' threads.c:(.text+0x644): undefined reference to
fftwf_assertion_failed' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-threads.o): In functionfftwf_threads_register_planner_hooks': threads.c:(.text+0x69c): undefined reference to
fftwf_set_planner_hooks' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-threads.o): In functionlock_planner_mutex': threads.c:(.text+0xe5): undefined reference to
fftwf_assertion_failed' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-dft-vrank-geq1.o): In functiondestroy': dft-vrank-geq1.c:(.text+0x120): undefined reference to
fftwf_plan_destroy_internal' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-dft-vrank-geq1.o): In functionawake': dft-vrank-geq1.c:(.text+0x1fc): undefined reference to
fftwf_plan_awake' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-dft-vrank-geq1.o): In functionmkplan': dft-vrank-geq1.c:(.text+0x2b4): undefined reference to
fftwf_pickdim' dft-vrank-geq1.c:(.text+0x34d): undefined reference tofftwf_malloc_plain' dft-vrank-geq1.c:(.text+0x390): undefined reference to
fftwf_tensor_copy' dft-vrank-geq1.c:(.text+0x42c): undefined reference tofftwf_mkproblem_dft' dft-vrank-geq1.c:(.text+0x438): undefined reference to
fftwf_mkplan_d' dft-vrank-geq1.c:(.text+0x468): undefined reference tofftwf_plan_destroy_internal' dft-vrank-geq1.c:(.text+0x47b): undefined reference to
fftwf_ifree' dft-vrank-geq1.c:(.text+0x483): undefined reference tofftwf_tensor_destroy' dft-vrank-geq1.c:(.text+0x494): undefined reference to
fftwf_tensor_destroy' dft-vrank-geq1.c:(.text+0x4ac): undefined reference tofftwf_mkplan_dft' dft-vrank-geq1.c:(.text+0x4e6): undefined reference to
fftwf_ops_zero' dft-vrank-geq1.c:(.text+0x510): undefined reference tofftwf_ops_add2' dft-vrank-geq1.c:(.text+0x545): undefined reference to
fftwf_tensor_copy' dft-vrank-geq1.c:(.text+0x54d): undefined reference tofftwf_tensor_destroy' dft-vrank-geq1.c:(.text+0x565): undefined reference to
fftwf_mkplan_dft' dft-vrank-geq1.c:(.text+0x59c): undefined reference tofftwf_ops_zero' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-dft-vrank-geq1.o): In function
fftwf_dft_thr_vrank_geq1_register': dft-vrank-geq1.c:(.text+0x5ed): undefined reference tofftwf_mksolver' dft-vrank-geq1.c:(.text+0x60b): undefined reference to
fftwf_solver_register' dft-vrank-geq1.c:(.text+0x61c): undefined reference tofftwf_mksolver' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-dft-vrank-geq1.o): In function
destroy': dft-vrank-geq1.c:(.text+0x135): undefined reference tofftwf_ifree' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-dft-vrank-geq1.o): In function
fftwf_dft_thr_vrank_geq1_register': dft-vrank-geq1.c:(.text+0x640): undefined reference tofftwf_solver_register' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-dft-vrank-geq1.o):(.data.rel.ro+0x0): undefined reference to
fftwf_dft_solve' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-ct.o): In functionmkplan': ct.c:(.text+0x138): undefined reference to
fftwf_ct_applicable' ct.c:(.text+0x15a): undefined reference tofftwf_choose_radix' ct.c:(.text+0x187): undefined reference to
fftwf_tensor_tornk1' ct.c:(.text+0x1d5): undefined reference tofftwf_malloc_plain' ct.c:(.text+0x2a4): undefined reference to
fftwf_ifree' ct.c:(.text+0x2ab): undefined reference tofftwf_plan_destroy_internal' ct.c:(.text+0x398): undefined reference to
fftwf_plan_destroy_internal' ct.c:(.text+0x4db): undefined reference tofftwf_mktensor_2d' ct.c:(.text+0x4fb): undefined reference to
fftwf_mktensor_1d' ct.c:(.text+0x514): undefined reference tofftwf_mkproblem_dft_d' ct.c:(.text+0x51f): undefined reference to
fftwf_mkplan_d' ct.c:(.text+0x543): undefined reference tofftwf_mkplan_dft' ct.c:(.text+0x56c): undefined reference to
fftwf_ops_zero' ct.c:(.text+0x58f): undefined reference tofftwf_ops_add2' ct.c:(.text+0x5ab): undefined reference to
fftwf_ops_add2' ct.c:(.text+0x62a): undefined reference tofftwf_mktensor_2d' ct.c:(.text+0x64a): undefined reference to
fftwf_mktensor_1d' ct.c:(.text+0x666): undefined reference tofftwf_mkproblem_dft_d' ct.c:(.text+0x671): undefined reference to
fftwf_mkplan_d' ct.c:(.text+0x695): undefined reference tofftwf_mkplan_dft' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-ct.o): In function
destroy': ct.c:(.text+0x70c): undefined reference tofftwf_plan_destroy_internal' ct.c:(.text+0x730): undefined reference to
fftwf_plan_destroy_internal' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-ct.o): In functionawake': ct.c:(.text+0x85f): undefined reference to
fftwf_plan_awake' ct.c:(.text+0x87c): undefined reference tofftwf_plan_awake' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-ct.o): In function
fftwf_mksolver_ct_threads': ct.c:(.text+0x8ae): undefined reference tofftwf_mksolver' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-ct.o): In function
destroy': ct.c:(.text+0x745): undefined reference tofftwf_ifree' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-ct.o):(.data.rel.ro+0x0): undefined reference to
fftwf_dft_solve' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-rdft-vrank-geq1.o): In functiondestroy': rdft-vrank-geq1.c:(.text+0x110): undefined reference to
fftwf_plan_destroy_internal' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-rdft-vrank-geq1.o): In functionawake': rdft-vrank-geq1.c:(.text+0x1cc): undefined reference to
fftwf_plan_awake' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-rdft-vrank-geq1.o): In functionmkplan': rdft-vrank-geq1.c:(.text+0x297): undefined reference to
fftwf_pickdim' rdft-vrank-geq1.c:(.text+0x336): undefined reference tofftwf_malloc_plain' rdft-vrank-geq1.c:(.text+0x376): undefined reference to
fftwf_tensor_copy' rdft-vrank-geq1.c:(.text+0x416): undefined reference tofftwf_mkproblem_rdft' rdft-vrank-geq1.c:(.text+0x423): undefined reference to
fftwf_mkplan_d' rdft-vrank-geq1.c:(.text+0x458): undefined reference tofftwf_plan_destroy_internal' rdft-vrank-geq1.c:(.text+0x46c): undefined reference to
fftwf_ifree' rdft-vrank-geq1.c:(.text+0x474): undefined reference tofftwf_tensor_destroy' rdft-vrank-geq1.c:(.text+0x494): undefined reference to
fftwf_tensor_destroy' rdft-vrank-geq1.c:(.text+0x4ac): undefined reference tofftwf_mkplan_rdft' rdft-vrank-geq1.c:(.text+0x4e6): undefined reference to
fftwf_ops_zero' rdft-vrank-geq1.c:(.text+0x510): undefined reference tofftwf_ops_add2' rdft-vrank-geq1.c:(.text+0x545): undefined reference to
fftwf_tensor_copy' rdft-vrank-geq1.c:(.text+0x54d): undefined reference tofftwf_tensor_destroy' rdft-vrank-geq1.c:(.text+0x565): undefined reference to
fftwf_mkplan_rdft' rdft-vrank-geq1.c:(.text+0x59c): undefined reference tofftwf_ops_zero' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-rdft-vrank-geq1.o): In function
fftwf_rdft_thr_vrank_geq1_register': rdft-vrank-geq1.c:(.text+0x5ed): undefined reference tofftwf_mksolver' rdft-vrank-geq1.c:(.text+0x60b): undefined reference to
fftwf_solver_register' rdft-vrank-geq1.c:(.text+0x61c): undefined reference tofftwf_mksolver' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-rdft-vrank-geq1.o): In function
destroy': rdft-vrank-geq1.c:(.text+0x125): undefined reference tofftwf_ifree' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-rdft-vrank-geq1.o): In function
fftwf_rdft_thr_vrank_geq1_register': rdft-vrank-geq1.c:(.text+0x640): undefined reference tofftwf_solver_register' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-rdft-vrank-geq1.o):(.data.rel.ro+0x0): undefined reference to
fftwf_rdft_solve' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-hc2hc.o): In functionmkplan': hc2hc.c:(.text+0x135): undefined reference to
fftwf_hc2hc_applicable' hc2hc.c:(.text+0x157): undefined reference tofftwf_choose_radix' hc2hc.c:(.text+0x195): undefined reference to
fftwf_tensor_tornk1' hc2hc.c:(.text+0x1e5): undefined reference tofftwf_malloc_plain' hc2hc.c:(.text+0x2e8): undefined reference to
fftwf_plan_destroy_internal' hc2hc.c:(.text+0x2f5): undefined reference tofftwf_ifree' hc2hc.c:(.text+0x2fc): undefined reference to
fftwf_plan_destroy_internal' hc2hc.c:(.text+0x455): undefined reference tofftwf_mktensor_2d' hc2hc.c:(.text+0x475): undefined reference to
fftwf_mktensor_1d' hc2hc.c:(.text+0x48a): undefined reference tofftwf_mkproblem_rdft_d' hc2hc.c:(.text+0x495): undefined reference to
fftwf_mkplan_d' hc2hc.c:(.text+0x4b9): undefined reference tofftwf_mkplan_rdft' hc2hc.c:(.text+0x4e2): undefined reference to
fftwf_ops_zero' hc2hc.c:(.text+0x50f): undefined reference tofftwf_ops_add2' hc2hc.c:(.text+0x52b): undefined reference to
fftwf_ops_add2' hc2hc.c:(.text+0x585): undefined reference tofftwf_mktensor_2d' hc2hc.c:(.text+0x5a5): undefined reference to
fftwf_mktensor_1d' hc2hc.c:(.text+0x5ba): undefined reference tofftwf_mkproblem_rdft_d' hc2hc.c:(.text+0x5c5): undefined reference to
fftwf_mkplan_d' hc2hc.c:(.text+0x5e5): undefined reference tofftwf_mkplan_rdft' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-hc2hc.o): In function
destroy': hc2hc.c:(.text+0x61c): undefined reference tofftwf_plan_destroy_internal' hc2hc.c:(.text+0x640): undefined reference to
fftwf_plan_destroy_internal' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-hc2hc.o): In functionawake': hc2hc.c:(.text+0x74f): undefined reference to
fftwf_plan_awake' hc2hc.c:(.text+0x76c): undefined reference tofftwf_plan_awake' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-hc2hc.o): In function
fftwf_mksolver_hc2hc_threads': hc2hc.c:(.text+0x794): undefined reference tofftwf_mksolver' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-hc2hc.o): In function
destroy': hc2hc.c:(.text+0x655): undefined reference tofftwf_ifree' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-hc2hc.o):(.data.rel.ro+0x0): undefined reference to
fftwf_rdft_solve' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-vrank-geq1-rdft2.o): In functiondestroy': vrank-geq1-rdft2.c:(.text+0x120): undefined reference to
fftwf_plan_destroy_internal' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-vrank-geq1-rdft2.o): In functionawake': vrank-geq1-rdft2.c:(.text+0x1fc): undefined reference to
fftwf_plan_awake' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-vrank-geq1-rdft2.o): In functionmkplan': vrank-geq1-rdft2.c:(.text+0x28f): undefined reference to
fftwf_pickdim' vrank-geq1-rdft2.c:(.text+0x328): undefined reference tofftwf_rdft2_strides' vrank-geq1-rdft2.c:(.text+0x350): undefined reference to
fftwf_malloc_plain' vrank-geq1-rdft2.c:(.text+0x38f): undefined reference tofftwf_tensor_copy' vrank-geq1-rdft2.c:(.text+0x41d): undefined reference to
fftwf_mkproblem_rdft2' vrank-geq1-rdft2.c:(.text+0x42a): undefined reference tofftwf_mkplan_d' vrank-geq1-rdft2.c:(.text+0x459): undefined reference to
fftwf_plan_destroy_internal' vrank-geq1-rdft2.c:(.text+0x46a): undefined reference tofftwf_ifree' vrank-geq1-rdft2.c:(.text+0x472): undefined reference to
fftwf_tensor_destroy' vrank-geq1-rdft2.c:(.text+0x484): undefined reference tofftwf_rdft2_inplace_strides' vrank-geq1-rdft2.c:(.text+0x4c4): undefined reference to
fftwf_tensor_destroy' vrank-geq1-rdft2.c:(.text+0x4dc): undefined reference tofftwf_mkplan_rdft2' vrank-geq1-rdft2.c:(.text+0x511): undefined reference to
fftwf_ops_zero' vrank-geq1-rdft2.c:(.text+0x53f): undefined reference tofftwf_ops_add2' vrank-geq1-rdft2.c:(.text+0x575): undefined reference to
fftwf_tensor_copy' vrank-geq1-rdft2.c:(.text+0x57d): undefined reference tofftwf_tensor_destroy' vrank-geq1-rdft2.c:(.text+0x595): undefined reference to
fftwf_mkplan_rdft2' vrank-geq1-rdft2.c:(.text+0x5c7): undefined reference tofftwf_ops_zero' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-vrank-geq1-rdft2.o): In function
fftwf_rdft2_thr_vrank_geq1_register': vrank-geq1-rdft2.c:(.text+0x61d): undefined reference tofftwf_mksolver' vrank-geq1-rdft2.c:(.text+0x63b): undefined reference to
fftwf_solver_register' vrank-geq1-rdft2.c:(.text+0x64c): undefined reference tofftwf_mksolver' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-vrank-geq1-rdft2.o): In function
destroy': vrank-geq1-rdft2.c:(.text+0x135): undefined reference tofftwf_ifree' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-vrank-geq1-rdft2.o): In function
fftwf_rdft2_thr_vrank_geq1_register': vrank-geq1-rdft2.c:(.text+0x670): undefined reference tofftwf_solver_register' /usr/local/lib//libfftw3f_threads.a(libfftw3f_threads_la-vrank-geq1-rdft2.o):(.data.rel.ro+0x0): undefined reference to
fftwf_rdft2_solve'— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
@stevengj @matteo-frigo Thank you so much for the prompt help!
Hello All,
I have difficulty in linking my application using FFTW. Any idea of how I should do next? thx!