NOAA-EMC / NCEPLIBS-external

Third-party libraries required by NCEPLIBS
Other
8 stars 16 forks source link

Issues on Cray (static linking) #21

Closed climbfuji closed 4 years ago

climbfuji commented 4 years ago

On Cray systems, the default is to link static libraries. This causes two problems, (1) when building JasPER, and (2) when building wgrib2. Problem (1) can presumably be avoided with -DBUILD_JASPER=OFF (since the default OS version will do, need to check - for the actual error when linking see comment below), but (2) cannot.

The problem is that the final linker step for the wgrib2 executable wants to link against a static version of libintlc, which does not exist. This is the command that fails:

cd "wgrib2" && export LDFLAGS="-L/lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/src/NCEPLIBS-external/build/wgrib2/grib2/lib -lifcore -lc -limf -lintlc -lgeo -ljasper -lpng -lz -lm" && export CPPFLAGS="-I/lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/src/NCEPLIBS-external/build/wgrib2/grib2/include -O2 -DIFORT -cxxlib -I/lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/src/NCEPLIBS-external/build/wgrib2/grib2/jasper-1.900.1/src/libjasper/include -I/usr/include " && make
make[4]: Entering directory '/lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/src/NCEPLIBS-external/build/wgrib2/grib2/wgrib2'
/opt/cray/pe/craype/2.5.5/bin/cc -o wgrib2 -I/lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/src/NCEPLIBS-external/build/wgrib2/grib2/include -O2 -DIFORT -cxxlib -I/lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/src/NCEPLIBS-external/build/wgrib2/grib2/jasper-1.900.1/src/libjasper/include -I/usr/include   sec3_grids.o Scan.o Grid_def.o cname.o Time_processing.o Gctpc.o intpower.o enc_jpeg2000_clone.o Config.o rdieee_file.o ieee2flt.o Grads.o Csv.o rd_inventory.o Fix_ncep_4.o Grib_out_irr2.o unpk_run_length.o mk_kgds.o new_grid_lambertc.o Sec_len.o Sec3.o AAIG.o ncep_grids.o Prob.o Help.o Unix_time.o rotll.o Misc.o Code_Values.o Cress_lola.o save_string.o codetable_4_230.o Waves.o Last.o Ftime1.o Grib.o ieee_pk.o Box_ave.o ExtName.o Fix_CFSv2_fcst.o wrtieee.o Fix_ncep_2.o wxtext.o Mysql.o Latlon.o Data.o Earth.o itoshort_a.o Spectral_bands.o init.o stagger.o VerfTime.o fnlist.o Undefine.o unpk_complex.o Status.o Set_byte.o Sec1.o Sec6.o Submsg_uv.o bitstream.o Ndate.o units.o flt2ieee_nan.o jpeg_pk.o Level.o Mysql_speed.o Tigge.o subtime.o Csv_long.o openmp_util.o Set_ftime2.o Ftime.o space_view2ij.o Precision.o Set_metadata.o Sec0.o Sec5.o missing.o Alarm.o End.o manage_inv_out.o For.o Irr_grids.o Mod_grib.o wgrib2_api.o swap_buffer.o UDF.o Reduced_gaussian_grid.o Mysql_dump.o File.o Ftn_api.o CodeTable.o Set_sec_size.o Ndates.o Grib_out_irr.o SpatialProcessing.o test_sec.o Import.o parse_msg.o Set_ftime1.o Fix_ncep.o Ave_var.o proj4_transform.o Macro.o Aerosol.o Ens_processing.o If_rec.o Merge.o Netcdf.o Cyclic.o gctpc_ll2xy.o Ensemble.o Set_date.o proj4_initialize.o crc32.o Set_percentile.o Dump.o Ave_test.o Checksum.o Gridout.o prod_def_temp_size.o Lola.o Ncpu.o NCEP_norm.o unpk_0.o parse_loop.o Model_version_date.o Summary.o fatal_error.o lat2ij.o Set_ts_dates.o Netcdf_sup.o JMA.o Set_pdt.o Tosubmsg.o Inv.o Limit.o Set_ensm_derived_fcst.o Set_prob.o Wind_dir.o complex_pk.o Mem_buffer.o copy.o unpk.o Range.o RPN.o AAIGlong.o wgrib2.o int8.o Hybrid.o Grid_id.o Match_fs.o Wind_speed.o Fcst_ave.o GDT.o addtime.o Fix_ncep_3.o Import_netcdf.o Flush.o Wrt_grib.o grid_ident.o space_view.o simple_pk.o ieee2flt_nan.o Import_grib.o Bbox.o mk_gdt.o rd_seq_grib.o Fi.o ffopen.o setup_user_gribtable.o New_grid.o Proj4.o Alias.o gribtab.o Match.o EOF.o dec_png_clone.o NCEP_uv.o geo.o Sec4.o flt2ieee.o Set_ens_num.o Warn_old_g2lib.o aec_pk.o Set_val.o Small_grib.o Ftime2.o Inv_no.o update_sec4.o FlagTable.o Scaling_0001.o -L/lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/src/NCEPLIBS-external/build/wgrib2/grib2/lib -lifcore -lc -limf -lintlc -lgeo -ljasper -lpng -lz -lm
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lintlc

Repeating this step manually and adding -Wl,-Bdynamic before -lifcore solves the problem.

I don't have a solution yet for the build system, though. Probably need to patch wgrib2?

climbfuji commented 4 years ago

For reference, this is the error for Jasper (which hopefully doesn't need to be fixed):

CMake Error at src/appl/cmake_install.cmake:50 (file):
  file RPATH_CHANGE could not write new RPATH:

    /lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/lib64

  to the file:

    /lustre/f2/pdata/esrl/gsd/ufs/modules/NCEPlibs-ufs-v1.0.0.beta01/intel-18.0.3.222/cray-mpich-7.4.0/bin/jasper

  No valid ELF RPATH or RUNPATH entry exists in the file;
Call Stack (most recent call first):
  cmake_install.cmake:51 (include)
climbfuji commented 4 years ago

Update: if I only build the wgrib2 library on gaea, but not the executable, then the build works. But having wgrib2 to inspect the model input and output is useful.

climbfuji commented 4 years ago

This will be addressed by PRs https://github.com/NOAA-EMC/NCEPLIBS/pull/44 and https://github.com/NOAA-EMC/NCEPLIBS-external/pull/22 (and the submodule pointer updates associated with these PRs)

climbfuji commented 4 years ago

These PRs were merged.