NOAA-GFDL/SHiELD_build

distributed libraries not general

Closed this issue · 3 comments

As far as I know, the nceplibs libraries must be compiled using the exact same compiler used to build the full executable. I'm not sure that it is possible to distribute these with the build package.

/usr/bin/ld: skipping incompatible /SHiELD_SRC/SHiELD_build/Build/nceplibs/gnu//libbacio_4.a when searching for -lbacio_4
/usr/bin/ld: cannot find -lbacio_4
/usr/bin/ld: skipping incompatible /SHiELD_SRC/SHiELD_build/Build/nceplibs/gnu//libsp_v2.0.2_d.a when searching for -lsp_v2.0.2_d
/usr/bin/ld: cannot find -lsp_v2.0.2_d
/usr/bin/ld: skipping incompatible /SHiELD_SRC/SHiELD_build/Build/nceplibs/gnu//libw3emc_d.a when searching for -lw3emc_d
/usr/bin/ld: cannot find -lw3emc_d
/usr/bin/ld: skipping incompatible /SHiELD_SRC/SHiELD_build/Build/nceplibs/gnu//libw3nco_d.a when searching for -lw3nco_d
/usr/bin/ld: cannot find -lw3nco_d

To fix this, I build nceplibs myself and then replace the library names:

#-----------------------------------------------------------------------------------
# Build NCEPLIBS
#-----------------------------------------------------------------------------------

# Only make those NCEP LIBS used by SHiELD:
RUN cd ${NCEPLIBS_BUILD_DIR} && \
    make -j${MAKEJOBS} bacio && \
    make -j${MAKEJOBS} sp && \
    make -j${MAKEJOBS} w3emc && \
    make -j${MAKEJOBS} w3nco

# Move libs and include files to a single location
RUN mkdir -p ${NCEPLIBS_DIR}/include && mkdir -p ${NCEPLIBS_DIR}/lib \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/bacio/src/bacio-build/src/lib* ${NCEPLIBS_DIR}/lib \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/bacio/src/bacio-build/src/include_4/* ${NCEPLIBS_DIR}/include \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/sp/src/sp-build/src/lib* ${NCEPLIBS_DIR}/lib \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/sp/src/sp-build/src/include_4/* ${NCEPLIBS_DIR}/include \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/w3emc/src/w3emc-build/src/lib* ${NCEPLIBS_DIR}/lib \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/w3emc/src/w3emc-build/src/include_4/* ${NCEPLIBS_DIR}/include \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/w3nco/src/w3nco-build/src/lib* ${NCEPLIBS_DIR}/lib \
    && ln -fs ${NCEPLIBS_BUILD_DIR}/w3nco/src/w3nco-build/src/include_4/* ${NCEPLIBS_DIR}/include

then:

&& sed "s/-lbacio_4  -lsp_v2.0.2_d  -lw3emc_d  -lw3nco_d/-lbacio_4  -lsp_d  -lw3emc_d  -lw3nco_d/" < mk_scripts/mk_make > OUT \
  && mv OUT mk_scripts/mk_make

@StevePny - this is something we knew was a limitation for the first release and should have made it more clear. In a future release of the build system, we will have links to the needed library source to be built in a manner similar to libFMS. If you'd like to contribute the system you've put in place, please put in a PR.

@bensonr I have a dockerfile that automates most of this environment/model build. Would you like me to include it in a new directory? e.g. Dockerfiles/Dockerfile.ubuntu-arm64

@StevePny We now have a system in place that builds these nceplibs. This was completed in PR #15.