GDC fails to link with GSL and fortran code

Andrew Brown via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 16 09:44:45 PDT 2015


Hi,

I'm trying to compile code which calls C and fortan routines from 
D on the linux cluster at work. I've managed to get it to work 
with all 3 compilers on my laptop, but LDC and GDC fail on the 
cluster (though DMD works perfectly). I'm using the precompiled 
compiler binaries on these systems, the cluster doesn't have the 
prerequistites for building them myself and I don't have admin 
rights.

For GDC the commands I run are:

gcc -c C_code.c Fortran_code.f
gdc D_code.d C_code.o Fortran_code.f -lblas -lgsl -lgslcblas -lm 
-lgfortran -o out

The error messages are:

/software/lib64/libgsl.so: undefined reference to 
`memcpy at GLIBC_2.14'
/software/lib64/libgfortran.so.3: undefined reference to 
`clock_gettime at GLIBC_2.17'
/software/lib64/libgfortran.so.3: undefined reference to 
`secure_getenv at GLIBC_2.17'
collect2: error: ld returned 1 exit status

I can remove the gsl messages by statically linking to libgsl.a, 
but this doesn't solve the gfortran issues.

If anyone knows a way round these issues, I'd be very grateful. 
I'd also eventually like to find a way to easily share linux 
biniaries with people, so they can use this code without these 
kinds of headaches. If anyone has any advice for making this 
portable, that would also help me out a lot.

Thanks very much

Andrew


More information about the Digitalmars-d-learn mailing list