[MITgcm-support] Linking problem (with adjoint, gfortran, OS X) - 'duplicate symbol' error
Patrick Heimbach
heimbach at MIT.EDU
Wed Oct 27 19:04:14 EDT 2010
Hi Chris,
this is likely a result of the change of default behavior of TAF (now
version 2).
Quick fix is in your Makefile to add option '-v1'
in line starting with
AD_TAF_FLAGS =
Better fix is to update all adoptfile to latest versions in
tools/adjoint_options
-Patrick
On Oct 27, 2010, at 7:00 PM, Chris Wilson wrote:
> Hi,
>
> When I try to build an adjoint, at the 'make adall' stage I get the
> following error.
>
> ld: duplicate symbol _adams_bashforth2_ in ad_taf_output.o and
> adams_bashforth2.o
> collect2: ld returned 1 exit status
> make: *** [mitgcmuv_ad] Error 1
>
> I see that both ad_taf_output.o and adams_bashforth2.o contain the
> subroutine 'adams_bashforth2' - alphabetically the first relevant
> one included - but am unsure whether this is a gfortran problem or
> if the adjoint build has gone wrong.
>
> Here is the full compile command from 'make adall' before
> compilation/linking crashes:
>
> gfortran -o mitgcmuv_ad -ffixed-form -Wunused -Wuninitialized -
> fconvert=big-endian -O3 -funroll-loops active_file.o
> active_file_ad.o active_file_control.o active_file_control_slice.o
> active_file_g.o active_file_loc.o active_file_loc_ad.o
> active_file_loc_control.o active_file_loc_control_slice.o
> active_file_loc_g.o addummy_in_stepping.o adopen_adclose.o
> adread_adwrite.o adzero_adj.o autodiff_check.o
> autodiff_inadmode_set.o autodiff_inadmode_set_ad.o
> autodiff_inadmode_set_g.o autodiff_inadmode_unset.o
> autodiff_inadmode_unset_ad.o autodiff_inadmode_unset_g.o
> autodiff_ini_model_io.o autodiff_restore.o autodiff_store.o
> dummy_in_stepping.o exch_3d_ad.o exch_ad.o exch_agrid_3d_ad.o
> exch_uv_ad.o g_dummy_in_stepping.o global_max_ad.o global_sum_ad.o
> global_sum_tile_ad.o ini_autodiff.o myactivefunction.o
> myactivefunction_ad.o zero_adj.o cd_code_ini_vars.o
> cd_code_init_fixed.o cd_code_read_pickup.o cd_code_scheme.o
> cd_code_write_pickup.o cost_accumulate_mean.o cost_atlantic_heat.o co!
> st_check.o cost_dependent_init.o cost_depth.o cost_final.o
> cost_final_restore.o cost_final_store.o cost_init_varia.o
> cost_readparms.o cost_state_final.o cost_test.o cost_tile.o
> cost_tracer.o cost_vector.o adctrl_bound.o ctrl_bound.o
> ctrl_check.o ctrl_depth_ini.o ctrl_get_gen.o ctrl_get_gen_rec.o
> ctrl_getobcse.o ctrl_getobcsn.o ctrl_getobcss.o ctrl_getobcsw.o
> ctrl_getrec.o ctrl_hfacc_ini.o ctrl_init.o ctrl_init_ctrlvar.o
> ctrl_init_obcs_variables.o ctrl_init_variables.o ctrl_init_wet.o
> ctrl_map_forcing.o ctrl_map_ini.o ctrl_map_ini_ecco.o
> ctrl_map_ini_gen.o ctrl_mask_set_xz.o ctrl_mask_set_yz.o
> ctrl_obcsbal.o ctrl_obcsvol.o ctrl_pack.o ctrl_readparms.o
> ctrl_set_fname.o ctrl_set_globfld_xy.o ctrl_set_globfld_xyz.o
> ctrl_set_globfld_xz.o ctrl_set_globfld_yz.o ctrl_set_pack_xy.o
> ctrl_set_pack_xyz.o ctrl_set_pack_xz.o ctrl_set_pack_yz.o
> ctrl_set_unpack_xy.o ctrl_set_unpack_xyz.o ctrl_set_unpack_xz.o
> ctrl_set_unpack_yz.o ctrl_smooth.o ctrl_summary.o ctrl_unpack.o
> ctrl_volflux.o opt!
> im_readparms.o chksum_tiled.o debug_call.o debug_cs_corner_uv.o
> debug_
> enter.o debug_fld_stats_rl.o debug_fld_stats_rs.o debug_leave.o
> debug_msg.o debug_stats_rl.o debug_stats_rs.o fill_in_corners_rl.o
> write_fullarray_rl.o gad_advection.o gad_biharm_x.o gad_biharm_y.o
> gad_c2_adv_r.o gad_c2_adv_x.o gad_c2_adv_y.o gad_c2_impl_r.o
> gad_c4_adv_r.o gad_c4_adv_x.o gad_c4_adv_y.o gad_calc_rhs.o
> gad_check.o gad_del2.o gad_diagnostics_init.o
> gad_diagnostics_state.o gad_diff_r.o gad_diff_x.o gad_diff_y.o
> gad_dst2u1_adv_r.o gad_dst2u1_adv_x.o gad_dst2u1_adv_y.o
> gad_dst2u1_impl_r.o gad_dst3_adv_r.o gad_dst3_adv_x.o
> gad_dst3_adv_y.o gad_dst3fl_adv_r.o gad_dst3fl_adv_x.o
> gad_dst3fl_adv_y.o gad_dst3fl_impl_r.o gad_exch_som.o
> gad_fluxlimit_adv_r.o gad_fluxlimit_adv_x.o gad_fluxlimit_adv_y.o
> gad_fluxlimit_impl_r.o gad_grad_x.o gad_grad_y.o gad_implicit_r.o
> gad_init_fixed.o gad_init_varia.o gad_os7mp_adv_r.o
> gad_os7mp_adv_x.o gad_os7mp_adv_y.o gad_read_pickup.o
> gad_som_adv_r.o gad_som_adv_x.o gad_som_adv_y.o gad_som_advect.o
> gad_som_exchanges.o gad_som_fill_cs_co!
> rner.o gad_som_lim_r.o gad_som_prep_cs_corner.o gad_u3_adv_r.o
> gad_u3_adv_x.o gad_u3_adv_y.o gad_u3c4_impl_r.o gad_write_pickup.o
> salt_fill.o gmredi_calc_diff.o gmredi_calc_psi_b.o
> gmredi_calc_tensor.o gmredi_calc_uvflow.o gmredi_calc_wflow.o
> gmredi_check.o gmredi_diagnostics_fill.o gmredi_diagnostics_init.o
> gmredi_init.o gmredi_init_fixed.o gmredi_mnc_init.o gmredi_output.o
> gmredi_readparms.o gmredi_rtransport.o gmredi_slope_limit.o
> gmredi_slope_psi.o gmredi_xtransport.o gmredi_ytransport.o
> grdchk_check.o grdchk_get_obcs_mask.o grdchk_get_position.o
> grdchk_getadxx.o grdchk_getxx.o grdchk_init.o grdchk_loc.o
> grdchk_main.o grdchk_print.o grdchk_readparms.o grdchk_setxx.o
> grdchk_summary.o mdsio_buffertorl.o mdsio_buffertors.o
> mdsio_facef_read.o mdsio_gl.o mdsio_gl_slice.o mdsio_pass_r4torl.o
> mdsio_pass_r4tors.o mdsio_pass_r8torl.o mdsio_pass_r8tors.o
> mdsio_rd_rec_rl.o mdsio_rd_rec_rs.o mdsio_read_field.o
> mdsio_read_meta.o mdsio_read_section.o mdsio_readvector.o
> mdsio_rw_field!
> .o mdsio_rw_slice.o mdsio_seg4torl.o mdsio_seg4tors.o
> mdsio_seg8torl.o
> mdsio_seg8tors.o mdsio_segxtorx_2d.o mdsio_wr_metafiles.o
> mdsio_wr_rec_rl.o mdsio_wr_rec_rs.o mdsio_write_field.o
> mdsio_write_meta.o mdsio_write_section.o mdsio_writelocal.o
> mdsio_writemeta.o mdsio_writevec_loc.o mdsio_writevector.o
> mom_calc_rtrans.o mom_fluxform.o mom_u_adv_uu.o mom_u_adv_vu.o
> mom_u_adv_wu.o mom_u_coriolis.o mom_u_del2u.o
> mom_u_metric_cylinder.o mom_u_metric_sphere.o mom_u_xviscflux.o
> mom_u_yviscflux.o mom_uv_boundary.o mom_v_adv_uv.o mom_v_adv_vv.o
> mom_v_adv_wv.o mom_v_coriolis.o mom_v_del2v.o
> mom_v_metric_cylinder.o mom_v_metric_sphere.o mom_v_xviscflux.o
> mom_v_yviscflux.o mom_vecinv.o mom_vi_coriolis.o mom_vi_del2uv.o
> mom_vi_hdissip.o mom_vi_u_coriolis.o mom_vi_u_coriolis_c4.o
> mom_vi_u_grad_ke.o mom_vi_u_vertshear.o mom_vi_v_coriolis.o
> mom_vi_v_coriolis_c4.o mom_vi_v_grad_ke.o mom_vi_v_vertshear.o
> get_write_global_fld.o read_fld_xy_rl.o read_fld_xy_rs.o
> read_fld_xyz_rl.o read_fld_xyz_rs.o read_mflds.o read_rec.o
> set_write_global_fld.o write_fld_3d_rl.o !
> write_fld_3d_rs.o write_fld_xy_rl.o write_fld_xy_rs.o
> write_fld_xyz_rl.o write_fld_xyz_rs.o write_glvec_rl.o
> write_glvec_rs.o write_local_rl.o write_local_rs.o write_rec.o
> sbo_calc.o sbo_check.o sbo_output.o sbo_readparms.o sbo_rho.o
> sbo_writevector.o timeave_cumul_1k.o timeave_cumul_1k1t.o
> timeave_cumul_1t.o timeave_cumul_1vfc.o timeave_cumul_2v.o
> timeave_cumul_2vfc.o timeave_cumul_dif_1t.o timeave_cumul_fc.o
> timeave_cumulate.o timeave_init_fixed.o timeave_norma_1k.o
> timeave_norma_2v.o timeave_normaliz.o timeave_reset.o
> timeave_reset_1k.o timeave_statv_write.o timeave_statvars.o
> timeave_surf_flux.o mom_calc_absvort3.o mom_calc_hdiv.o
> mom_calc_hfacz.o mom_calc_ke.o mom_calc_relvort3.o
> mom_calc_strain.o mom_calc_tension.o mom_calc_visc.o
> mom_diagnostics_init.o mom_hdissip.o mom_init_fixed.o
> mom_quasihydrostatic.o mom_u_bottomdrag.o mom_u_coriolis_nh.o
> mom_u_implicit_r.o mom_u_metric_nh.o mom_u_rviscflux.o
> mom_u_sidedrag.o mom_v_bottomdrag.o mom_v_coriolis_nh.o
> mom_v_implicit!
> _r.o mom_v_metric_nh.o mom_v_rviscflux.o mom_v_sidedrag.o
> mom_w_coriol
> is_nh.o mom_w_metric_nh.o mom_w_sidedrag.o all_proc_die.o bar2.o
> bar_check.o barrier.o check_threads.o comm_stats.o dfile.o
> diff_phase_multiple.o different_multiple.o eeboot.o
> eeboot_minimal.o eedata_example.o eedie.o eeintro_msg.o
> eeset_parms.o eewrite_eeenv.o exch_3d_r4.o exch_3d_r8.o
> exch_3d_rl.o exch_3d_rs.o exch_bg_r4_cube.o exch_bg_r8_cube.o
> exch_bg_rl_cube.o exch_bg_rs_cube.o exch_cycle_ebl.o exch_init.o
> exch_jam.o exch_r4.o exch_r4_cube.o exch_r4_recv_get_x.o
> exch_r4_recv_get_y.o exch_r4_send_put_x.o exch_r4_send_put_y.o
> exch_r8.o exch_r8_cube.o exch_r8_recv_get_x.o exch_r8_recv_get_y.o
> exch_r8_send_put_x.o exch_r8_send_put_y.o exch_rl.o exch_rl_cube.o
> exch_rl_recv_get_x.o exch_rl_recv_get_y.o exch_rl_send_put_x.o
> exch_rl_send_put_y.o exch_rs.o exch_rs_cube.o exch_rs_recv_get_x.o
> exch_rs_recv_get_y.o exch_rs_send_put_x.o exch_rs_send_put_y.o
> exch_s3d_r4.o exch_s3d_r8.o exch_s3d_rl.o exch_s3d_rs.o
> exch_sm_3d_r4.o exch_sm_3d_r8.o exch_sm_3d_rl.o exch_sm_3d_rs.o
> exch_uv!
> _3d_r4.o exch_uv_3d_r8.o exch_uv_3d_rl.o exch_uv_3d_rs.o
> exch_uv_agrid_3d_r4.o exch_uv_agrid_3d_r8.o exch_uv_agrid_3d_rl.o
> exch_uv_agrid_3d_rs.o exch_uv_bgrid_3d_r4.o exch_uv_bgrid_3d_r8.o
> exch_uv_bgrid_3d_rl.o exch_uv_bgrid_3d_rs.o exch_uv_dgrid_3d_r4.o
> exch_uv_dgrid_3d_r8.o exch_uv_dgrid_3d_rl.o exch_uv_dgrid_3d_rs.o
> exch_uv_r4_cube.o exch_uv_r8_cube.o exch_uv_rl_cube.o
> exch_uv_rs_cube.o exch_uv_xy_r4.o exch_uv_xy_r8.o exch_uv_xy_rl.o
> exch_uv_xy_rs.o exch_uv_xyz_r4.o exch_uv_xyz_r8.o exch_uv_xyz_rl.o
> exch_uv_xyz_rs.o exch_xy_r4.o exch_xy_r8.o exch_xy_rl.o
> exch_xy_rs.o exch_xyz_r4.o exch_xyz_r8.o exch_xyz_rl.o
> exch_xyz_rs.o exch_z_3d_r4.o exch_z_3d_r8.o exch_z_3d_rl.o
> exch_z_3d_rs.o exch_z_r4_cube.o exch_z_r8_cube.o exch_z_rl_cube.o
> exch_z_rs_cube.o fill_cs_corner_ag_rl.o fill_cs_corner_tr_rl.o
> fill_cs_corner_uv_rs.o fool_the_compiler.o gather_2d_r4.o
> gather_2d_r8.o gather_vector.o gather_xz.o gather_yz.o global_max.o
> global_sum.o global_sum_singlecpu.o global_sum_tile.o g!
> lobal_vec_sum.o gsum.o gsum_jam.o ini_communication_patterns.o
> ini_jam
> .o ini_procs.o ini_threading_environment.o lef_zero.o main.o
> master_cpu_io.o master_cpu_thread.o mds_byteswapi4.o
> mds_byteswapr4.o mds_byteswapr8.o mds_check4file.o mds_reclen.o
> mdsfindunit.o memsync.o nml_filter.o nml_set_terminator.o
> open_copy_data_file.o print.o scatter_2d_r4.o scatter_2d_r8.o
> scatter_vector.o scatter_xz.o scatter_yz.o stop_if_error.o timers.o
> utils.o write_utils.o adams_bashforth2.o adams_bashforth3.o
> askparam.o calc_3d_diffusivity.o calc_buoyancy.o
> calc_common_factors.o calc_diffusivity.o calc_div_ghat.o
> calc_grad_phi_hyd.o calc_grad_phi_surf.o calc_gs.o calc_gt.o
> calc_gw.o calc_ivdc.o calc_oce_mxlayer.o calc_phi_hyd.o
> calc_r_star.o calc_surf_dr.o calc_viscosity.o calc_wsurf_tr.o
> cg2d.o cg2d_nsa.o cg3d.o check_pickup.o config_check.o
> config_summary.o convective_adjustment.o
> convective_adjustment_ini.o convective_weights.o
> convectively_mixtracer.o correction_step.o cycle_tracer.o
> diags_oceanic_surf_flux.o diags_phi_hyd.o diags_phi_rlow.o
> diags_rho.o do_a!
> tmospheric_phys.o do_fields_blocking_exchanges.o
> do_gterm_blocking_exchanges.o do_oceanic_phys.o
> do_stagger_fields_exchanges.o do_statevars_diags.o
> do_statevars_tave.o do_the_model_io.o do_write_pickup.o dynamics.o
> external_fields_load.o external_forcing.o external_forcing_surf.o
> find_alpha.o find_rho.o forward_step.o freesurf_rescale_g.o
> freeze.o freeze_surface.o grad_sigma.o impldiff.o
> ini_cartesian_grid.o ini_cg2d.o ini_cg3d.o ini_cori.o
> ini_curvilinear_grid.o ini_cylinder_grid.o ini_depths.o
> ini_dynvars.o ini_eos.o ini_fields.o ini_forcing.o ini_grid.o
> ini_hfac.o ini_linear_phisurf.o ini_masks_etc.o ini_mixing.o
> ini_mnc_vars.o ini_model_io.o ini_nh_vars.o ini_p_ground.o
> ini_parms.o ini_pnh.o ini_pressure.o ini_psurf.o ini_r_star.o
> ini_salt.o ini_spherical_polar_grid.o ini_surf_dr.o ini_theta.o
> ini_vel.o ini_vertical_grid.o initialise_fixed.o initialise_varia.o
> integr_continuity.o integrate_for_w.o load_fields_driver.o
> load_grid_spacing.o load_ref_files.o modeldata_examp!
> le.o momentum_correction_step.o packages_boot.o packages_check.o
> packa
> ges_error_msg.o packages_init_fixed.o packages_init_variables.o
> packages_readparms.o packages_write_pickup.o plot_field.o
> port_rand.o pressure_for_eos.o read_pickup.o remove_mean.o
> rotate_spherical_polar_grid.o seawater.o set_defaults.o
> set_grid_factors.o set_parms.o set_ref_state.o
> set_write_global_pickup.o solve_for_pressure.o
> solve_pentadiagonal.o solve_tridiagonal.o state_summary.o swfrac.o
> taueddy_external_forcing.o taueddy_init_varia.o the_main_loop.o
> the_model_main.o thermodynamics.o timestep.o timestep_tracer.o
> timestep_wvel.o tracers_correction_step.o tracers_iigw_correction.o
> update_cg2d.o update_etah.o update_masks_etc.o update_r_star.o
> update_surf_dr.o write_grid.o write_pickup.o write_state.o
> gsl_ieee_env.o ptwrapper.o setrlstk.o sigreg.o tim.o timer_stats.o
> ad_taf_output.o -L/usr/local/netCDF/gfortran/netCDF3.6.3/lib/ -lnetcdf
>
> ld: duplicate symbol _adams_bashforth2_ in ad_taf_output.o and
> adams_bashforth2.o
> collect2: ld returned 1 exit status
> make: *** [mitgcmuv_ad] Error 1
>
> -------
> More info:
>
> gfortran -v
> Using built-in specs.
> Target: x86_64-apple-darwin10
> Configured with: ../gcc-4.5-20090910/configure --enable-
> languages=fortran --host=x86_64-apple-darwin10 --build=x86_64-apple-
> darwin10
> Thread model: posix
>
> uname -mrsv
> Darwin 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT
> 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386
>
>
>
> Thanks!
>
> Chris
>
>
>
> _______________________________________________
> MITgcm-support mailing list
> MITgcm-support at mitgcm.org
> http://mitgcm.org/mailman/listinfo/mitgcm-support
---
Patrick Heimbach | heimbach at mit.edu | http://www.mit.edu/~heimbach
MIT | EAPS 54-1518 | 77 Massachusetts Ave | Cambridge MA 02139 USA
FON +1-617-253-5259 | FAX +1-617-253-4464 | SKYPE patrick.heimbach
More information about the MITgcm-support
mailing list