G01
G01

Reputation: 451

Undefined Reference to "gsl_rng_unform", "gsl_rng_mt19937", "gsl_rng_alloc", "gsl_rng_set"

I am trying to compile a pyx code to obtain a pyd/dll file for python on my Windows 64 machine. I am doing it step by step in the command window to figure out where it is going wrong.

I successfully converted the pyx into a c file called samplers.c. Then into a .o file. I am at the last step I believe in compiling a shared object (pyd), but for some reason the compiler cannot read what is inside the gsl_rng.h file. It is clearly included as one of the directories in the gsl library, but for some reason cannot find them and throws the undefined reference error. I've even included -lgsl -lgslcblas -lm as a lot of forum posts suggest, but still no dice.

c:\Users\MyName\Anaconda\conda-bld\work>C:\TDM-GCC-64\bin\gcc.exe -DMS_WIN64 -shared -s samplers.o build\temp.win-amd64-2.7\Release\samplers.def -LC:\Users\MyName\Anaconda\gsl\lib -LC:\Users\MyName\Anaconda\libs -LC:\Users\MyName\Anaconda\PCbuild\amd64-lgsl -lgslcblas -lm -lpython27 -lmsvcr90 -o c:\Users\MyName\Anaconda\conda-bld\work\samplers.pyd
samplers.o:samplers.c:(.text+0x1f73): undefined reference to `gsl_rng_uniform'
samplers.o:samplers.c:(.text+0x20a91): undefined reference to `gsl_rng_mt19937'
samplers.o:samplers.c:(.text+0x20a96): undefined reference to `gsl_rng_alloc'
samplers.o:samplers.c:(.text+0x20c75): undefined reference to `gsl_rng_set'    
c:/tdm-gcc-64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw /bin/ld.exe: samplers.o: bad reloc address 0x0 in section `.data' 
collect2.exe: error: ld returned 1 exit status

Upvotes: 1

Views: 1540

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 799150

... -LC:\Users\MyName\Anaconda\PCbuild\amd64-lgsl ...

Individual arguments to a command must be separated by a space, in this case the -L and -l arguments.

Upvotes: 4

Related Questions