<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi,<div>I tried to build the PyNio from source on CentOS 6.</div><div>A copy of Python 3.6.8 has built and installed to /opt/python-3.6.8, with /opt/python-3.6.8/bin added to the $PATH.</div><div><br></div><div>Some basic dependencies are installed from yum:</div><div>> libjpeg-devel libpng-devel jasper-devel zlib-devel bzip2-devel udunits2-devel bison</div><div><br></div><div>Other needed dependencies are built and installed to /opt/ncl-libs; the /opt/ncl-libs/bin is added to the $PATH, and /opt/ncl-libs/lib added to $LD_LIBRARY_PATH before building:</div><div><br></div><div>SZIP-2.1.1:<br></div><div>> ./configure --prefix=/opt/ncl-libs --enable-static=no<br></div><div><br></div><div>HDF5-1.8.21:</div><div>> ./configure --prefix=/opt/ncl-libs --with-szlib=/opt/ncl-libs --enable-static=no<br></div><div><br></div><div>HDF-4.2.12:</div><div>> ./configure --prefix=/opt/ncl-libs --with-szlib=/opt/ncl-libs --includedir=/opt/ncl-libs/include/hdf --enable-static=no --enable-shared=yes --disable-fortran<br></div><div><br></div><div>NetCDF 4.6.1:</div><div>> ./configure --prefix=/opt/ncl-libs CPPFLAGS=-I/opt/ncl-libs/include LDFLAGS=-L/opt/ncl-libs/lib --enable-static=no<br></div><div><br></div><div>libiconv-1.15:</div><div>> ./configure --prefix=/opt/ncl-libs --enable-static=no</div><div><br></div><div>libg2c-1.6.0:</div><div>> makefile: add -fPIC in CFLAGS, replace LIB=libgrib2c.a; make install</div><div><br></div><div>Proj4-4.9.3:</div><div>> ./configure --prefix=/opt/ncl-libs<br></div><div><br></div><div>GDAL-2.2.4:</div><div>> ./configure --prefix=
/opt/ncl-libs --with-hdf5=
/opt/ncl-libs --enable-static=no CPPFLAGS="-I
/opt/ncl-libs/include -I
/opt/ncl-libs/include/hdf" LDFLAGS=-L$/opt/ncl-libs/lib --without-grib</div><div>(The GDAL seems to have a internal copy of libg2c in its source, so I disabled this one. Doesn't seems to have negative effect on building PyNIO.)</div><div><br></div><div>HEFEOS-2.19v1.00:</div><div>> ./configure --prefix=/opt/ncl-libs CC=/opt/ncl-libs/bin/h4cc --with-szlib=/opt/ncl-libs CFLAGS=-fPIC<br></div><div><br></div><div>HDFEOS5-1.15:<br></div><div>> ./configure --prefix=/opt/ncl-libs CC=/opt/ncl-libs/bin/h5cc --with-szlib=/opt/ncl-libs CFLAGS=-fPIC</div><div><br></div><div>With the dependencies built and installed, I tried to build the PyNIO.</div><div>The source was git cloned a few days ago.</div><div>The build_py3.sh was edited:</div><div>> export CONDA_PREFIX=/opt/ncl-libs</div><div>> export HAS_SZIP=1</div><div>> add -I$CONDA_PREFIX/include/hdf in CPPFLAGS and CFLAGS</div><div>> change python setup.py build to python3 setup.py build</div><div>> change pip install . to pip3 install .</div><div>Then:</div><div>> sh build_py3.sh</div><div><br></div><div>The build goes well, except for failing at the final linking:</div><div><div>> g++ -pthread -shared -L/opt/ncl-libs/lib -D_BSD_SOURCE -D_XOPEN_SOURCE -I/opt/ncl-libs/include -I/opt/ncl-libs/include/hdf -I/opt/ncl-libs/include -I/opt/ncl-libs/include/hdf build/temp.linux-x86_64-3.6/niomodule.o -Llibsrc -L/opt/ncl-libs/lib -Lbuild/temp.linux-x86_64-3.6 -lnio -ljpeg -lpng -lz -lnetcdf -lmfhdf -ldf -lhdf5_hl -lhdf5 -lcurl -lhdfeos -lGctp -lgrib2c -ljasper -ljpeg -lpng -lhdf5_hl -lhdf5 -lhe5_hdfeos -lGctp -lgdal -lproj -liconv -ljasper -ljpeg -lpng -lz -lsz -lgfortran -o build/lib.linux-x86_64-3.6/PyNIO/_<a href="http://nio.cpython-36m-x86_64-linux-gnu.so">nio.cpython-36m-x86_64-linux-gnu.so</a></div><div>> g++: : No such file or directory</div></div><div><br></div><div>I'm not sure what file(s) was missing.</div><div>If I export the variables in build_py3.sh first and then run "python3 setup.py build", the same error appears. <br></div><div>If I unset those variables, copy the g++ command that failed, paste it in terninal and run directly, the final _<a href="http://nio.cpython-36m-x86_64-linux-gnu.so">nio.cpython-36m-x86_64-linux-gnu.so</a> can be created.</div><div><br></div><div>Re-run the build_py3.sh will have the package installed in Python.</div><div>How ever, when I tried to import the module, the following error appears:</div><div><div>>>> import Nio<br></div><div>Traceback (most recent call last):</div><div> File "<stdin>", line 1, in <module></div><div> File "/opt/bld/pynio/Nio.py", line 83, in <module></div><div> from _nio import *</div><div>ImportError: /opt/python3/lib/python3.6/site-packages/PyNIO/_<a href="http://nio.cpython-36m-x86_64-linux-gnu.so">nio.cpython-36m-x86_64-linux-gnu.so</a>: undefined symbol: sd_ncinquire</div></div><div><br></div><div>I've checked the linking of the installed /opt/python3/lib/python3.6/site-packages/PyNIO/_<a href="http://nio.cpython-36m-x86_64-linux-gnu.so">nio.cpython-36m-x86_64-linux-gnu.so</a> with ldd, and it seems that all libraries are accounted for.</div><div><br></div><div>I think I'm close, but I have no idea how to deal with the undefined symbol problem.</div><div>Any ideas?</div><div><br></div><div>Mike</div><div><a href="mailto:mike.scchen@gmail.com">mike.scchen@gmail.com</a></div></div></div></div></div></div></div></div></div></div></div></div></div></div>