fgvieira / ngsDist

Estimation of pairwise distances under a probabilistic framework
GNU General Public License v3.0
10 stars 7 forks source link

Compiling Error: gsl/gsl_rng.h not found #3

Closed alexkrohn closed 8 years ago

alexkrohn commented 8 years ago

Hi Felipe,

I am getting a common error that I can't seem to get around. When making ngsDist, I get a fatal error that ngsDist cannot find gsl_rng.h. I am installing ngsDist locally on my machine running OSX 10.11 and have installed gsl 1.16 using Homebrew. The gsl_rng.h include file is in /usr/local/Cellar/gsl/1.16/include, but the compiler can't seem to find it. I've also tried using the -I flag with the above gsl include parent directory to "make" but that didn't work either. Given that I don't know C, I'm not sure where to go from here. Any suggestions?

Thanks for your help.

-Alex

Here's the error in its entirety:


g++ -I./shared -g -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -c ./shared/gen_func.cpp
In file included from ./shared/gen_func.cpp:1:
./shared/gen_func.hpp:12:10: fatal error: 'gsl/gsl_rng.h' file not found
#include <gsl/gsl_rng.h>
         ^
1 error generated.
make: *** [gen_func.cpp] Error 1
fgvieira commented 8 years ago

Hi Alex,

from what you say you need to specify the location of your GSL library.

in the Makefile, try changing the line CFLAGS = -I$(SHARED_DIR) to CFLAGS = -I$(SHARED_DIR) -I /usr/local/Cellar/gsl/1.16/include

let me know if it worked, FGV

alexkrohn commented 8 years ago

No such luck. It didn't throw that same error, but threw 23 warnings. The last one, and the summary are pasted below. The make test also failed.

ngsDist.cpp:400:109: warning: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]
        fprintf(stderr, "block: %lu\torig_site: %lu\trand_block:%lu\trand_site: %lu\n", block, block_s, rnd_block, rnd_block_s);
                                                                                ~~~                                ^~~~~~~~~~~
                                                                                %llu
23 warnings generated.
g++ -g -Wall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE *.o -lgsl -lgslcblas -lz -lpthread -o ngsDist
ld: library not found for -lgsl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [all] Error 1

~/Desktop/ngsDist$ make test
ngsDist: test(s) failed!

Thanks for your help with this!

-Alex

fgvieira commented 8 years ago

Hi Alex,

sorry for the late reply but I've been away with limited internet connection. Before anything else, I must add that ngsDist has NOT been tested on MacOSX and I'd recommend (if possible) to use it on Linux.

That said, I tried to reproduce your problem and managed to easily compile ngsDist after installing GSL (following instructions here). I'll try to fix the warnings, but not exactly sure when I'll have time...

cheers,

fgvieira commented 8 years ago

Hi Alex,

did you manage to fix your issue with GSL? If not, you can try setting the CPATH, LIBRARY_PATH and LD_LIBRARY_PATH variables:

export CPATH=/path/to/lib/gsl-2.2/include/
export LIBRARY_PATH=/path/to/lib/gsl-2.2/lib/
export LD_LIBRARY_PATH=/path/to/lib/gsl-2.2/lib/:$LD_LIBRARY_PATH

If it stil won't work, try creating, on your GSL folder, a symlink named lib64 to the folder lib:

cd /path/to/lib/gsl-2.2
ln -s lib lib64

let me know if it worked...

alexkrohn commented 8 years ago

Hi Felipe,

I actually gave up at the GSL step and just installed it successfully on Ubuntu. Sorry for not replying earlier.

Thanks for your help,

Alex

ghost commented 6 years ago

Thank you, Felipe. Your instruction above worked for me by exporting the right path to the file :)