Hi Tiffany - When compiling with --llvm, the code that generates the link-line is in compiler/util/clangUtil.cpparound line 1488 in makeBinaryLLVM. In particular, I believe your -lfftw3 option is ending up in the libFlag array and thus getting included early on in the compile line; while most of the other options are later. Besides fixing the compiler, one way to work around this behavior is probably to explicitly name the .a file you are trying to link with instead of using the -L/-l flags.
I'm not very smart about linker library order. Can you explain what the Chapel compiler should be doing in these cases, and why the linker cares about the order of the -l options? Thanks, -michael On 02/20/2014 01:32 PM, Mintz, Tiffany M. wrote: > I am compiling chapel with llvm and I am getting linker ‘undefined reference’ > errors. I am linking to a library in a local directory so I provide the > library and library path on the chapel command line. During linking, these > values are placed at the beginning of the generated command line which is > causing the error. Here is the command line I’m using and the generated > command line for the linking, respectively: > > My command line: > > /data1/projects/prog-guided-reliability/chapel-1.8.0/bin/linux64/chpl -I. > -I/home/tmj/fftw-3.3.3/include --print-commands --savec gen_c --llvm > bitmap.h fft.h glob_wrapper.h read_glyph.h ssca3.h sys_util.h write_image.h > main.chpl createBitmap.o fft.o glob_wrapper.o read_glyph.o sys_util.o > write_image.o -o ssca3 -L/home/tmj/fftw-3.3.3/lib -lfftw3 > > Linker command line: > > /data1/projects/prog-guided-reliability/chapel-1.8.0/third-party/llvm/install/linux64-gnu/bin/clang++ > -pthread -L/home/tmj/fftw-3.3.3/lib -lfftw3 gen_c/chpl__module.bc > /data1/projects/prog-guided-reliability/chapel-1.8.0/lib/linux64.gnu.loc-flat.tasks-fifo.pthreads.tmr-generic.mem-default.atomics-intrinsics.gmp.re-none.wide-struct.fs-none/main.o > -o gen_c/ssca3.tmp createBitmap.o fft.o glob_wrapper.o read_glyph.o > sys_util.o write_image.o > -L/data1/projects/prog-guided-reliability/chapel-1.8.0/third-party/gmp/install/linux64-gnu/lib > > -Wl,-rpath=/data1/projects/prog-guided-reliability/chapel-1.8.0/third-party/gmp/install/linux64-gnu/lib > > -L/data1/projects/prog-guided-reliability/chapel-1.8.0/lib/linux64.gnu.loc-flat.tasks-fifo.pthreads.tmr-generic.mem-default.atomics-intrinsics.gmp.re-none.wide-struct.fs-none > -lchpl -lm -lpthread -lgmp > > When I execute the generated command manually with the library (-lfftw3) at > the end of the command line, there is no error. Is there any way for me to > control the position of the linker arguments from the original command line? > > > Thanks, > Tiffany > > > ------------------------------------------------------------------------------ > Managing the Performance of Cloud-Based Applications > Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. > Read the Whitepaper. > http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk > _______________________________________________ > Chapel-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/chapel-users > ------------------------------------------------------------------------------ Managing the Performance of Cloud-Based Applications Take advantage of what the Cloud has to offer - Avoid Common Pitfalls. Read the Whitepaper. http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk _______________________________________________ Chapel-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/chapel-users
