0

I am trying to configure and make install package nap6.4 for tcl, but it fails in during "make" with the following error:

cc -shared  -o libnap6.4.so cart_proj.o eval_tree.o function.o geometry.o     land_flag.o land_flag_i.o linsys.o nap.o napChoice.o napDyad.o napDyadLib.o  napImgNAO.o napInit.o napLib.o napMonad.o napParse.tab.o napParseLib.o  napPolygon.o napSpatial.o nap_get.o nap_hdf.o nap_netcdf.o nap_ooc.o  triangulate.o  -L/usr/local/lib -lnetcdf -L/usr/local/lib -lmfhdf -ldf -ljpeg -lz  -L/usr/local/lib -lproj -L. -ltclstub8.4 -ltkstub8.4  -lieee -lm -lX11 
 /usr/bin/ld: /usr/local/lib/libmfhdf.a(mfsd.o): relocation R_X86_64_32    against  `.rodata.str1.1' can not be used when making a shared object; recompile   with - fPIC
 /usr/local/lib/libmfhdf.a: error adding symbols: Bad value
 collect2: error: ld returned 1 exit status
 make: *** [libnap6.4.so] Error 1

So I was told to recompile with -fPIC, which I did in the following way from the terminal:

export CFLAGS=-fPIC
./configure --prefix/lib/ActiveTcl --enable-shared
make

but this does not work. I have also tried with --disable-shared, make clean, and

export CFLAGS="-fPIC -DHAVE_NETCDF"/ export CFLAGS="-fPIC" etc..

along with other not-working versions of CFLAGS.

So I am wondering how do I recompile with -fPIC? Is there some special syntax that I'm missing here?

  • It is the MDF library (libmfhdf) which you need to make shared. This FAQ seems relevamt: https://www.hdfgroup.org/HDF-FAQ.html#11share – rici Feb 02 '16 at 13:59
  • Alternatively, you could try configuring nap6.4 with `--disable-shared` *without* trying to use `-fPIC`. `-fPIC` is only necessary for shared builds. – rici Feb 02 '16 at 15:48
  • @rici Adding --disable-fortran to the hdf4 package and adding export CFLAGS="-fPIC" before configuring nap worked from within the container. However, if I try to add this to the Dockerfile the container fails to build. Here is the code: RUN cd /usr/local/nap/unix \n RUN export CFLAGS="-fPIC" \n RUN ./configure --prefix=/lib/ActiveTcl8.6 --enable-shared && make && make install. This fails with "./configure, command not found". – Kristin Solbakken Feb 04 '16 at 11:44
  • Kristin: You can't `RUN cd /some/directory` and then `RUN` something else, because every `RUN` command is independent, executing in a subshell. If you want to `cd` and then execute some command within the directory, you need to put them in the same `RUN` command: `RUN cd /usr/local/nap/unix && ./configure ...`. I don't know that the `export CFLAGS` is necessary, if you specify `--enable-shared`, but I don't suppose it hurts; anyway, I believe Docker has an `ENV` command which might come closer to doing what you want. – rici Feb 04 '16 at 14:37
  • 1
    @rici thanks, It works now, putting all on the same line. I had to add "make clean" before ./configure (for some reason) for the container to build successfully. It also wouldn't build without the CFLAGS, so I'll just keep it there :) – Kristin Solbakken Feb 05 '16 at 07:43

0 Answers0