Menu

#255 Link error: Undefined symbols referenced from _cli_help

v1.0_(example)
closed
nobody
None
5
2021-10-08
2021-10-07
Evan Miller
No

I am seeing a link error when building gretl-2021d on macOS 11.6 as _FSPathMakeRef and _LSOpenFSRef cannot be found:

~~~
libtool: link: /usr/bin/clang -dynamiclib -o .libs/libgretl-1.0.40.dylib .libs/adf_kpss.o .libs/addons_utils.o .libs/bhhh_max.o .libs/bootstrap.o .libs/boxplots.o .libs/calendar.o .libs/compare.o .libs/compat.o .libs/csvdata.o .libs/dataio.o .libs/dataset.o .libs/dbread.o .libs/dbwrite.o .libs/describe.o .libs/discrete.o .libs/estimate.o .libs/flow_control.o .libs/forecast.o .libs/geneval.o .libs/genfuncs.o .libs/genlex.o .libs/genmain.o .libs/gensyntax.o .libs/gmm.o .libs/graphing.o .libs/gretl_array.o .libs/gretl_bfgs.o .libs/gretl_btree.o .libs/gretl_bundle.o .libs/gretl_commands.o .libs/gretl_data_io.o .libs/gretl_errors.o .libs/gretl_foreign.o .libs/gretl_func.o .libs/gretl_help.o .libs/gretl_intl.o .libs/gretl_join.o .libs/gretl_list.o .libs/gretl_matrix.o .libs/gretl_cmatrix.o .libs/gretl_midas.o .libs/gretl_model.o .libs/gretl_mt.o .libs/gretl_normal.o .libs/gretl_panel.o .libs/gretl_paths.o .libs/gretl_plot.o .libs/gretl_prn.o .libs/gretl_restrict.o .libs/gretl_string_table.o .libs/gretl_typemap.o .libs/gretl_untar.o .libs/gretl_utils.o .libs/gretl_xml.o .libs/gretl_zip.o .libs/interact.o .libs/kalman.o .libs/libglue.o .libs/libset.o .libs/matrix_extra.o .libs/missing.o .libs/modelprint.o .libs/monte_carlo.o .libs/nls.o .libs/nonparam.o .libs/objstack.o .libs/options.o .libs/plotspec.o .libs/plugins.o .libs/printout.o .libs/printscan.o .libs/pvalues.o .libs/qr_estimate.o .libs/random.o .libs/strutils.o .libs/subsample.o .libs/system.o .libs/texprint.o .libs/transforms.o .libs/tsls.o .libs/usermat.o .libs/uservar.o .libs/var.o .libs/varprint.o .libs/vartest.o .libs/irfboot.o .libs/gretl_www.o .libs/bdtr.o .libs/btdtr.o .libs/chbevl.o .libs/chdtr.o .libs/const.o .libs/expx2.o .libs/fdtr.o .libs/gamma.o .libs/gdtr.o .libs/igam.o .libs/igami.o .libs/incbet.o .libs/incbi.o .libs/mtherr.o .libs/nbdtr.o .libs/ndtr.o .libs/ndtri.o .libs/pdtr.o .libs/polevl.o .libs/polrt.o .libs/stdtr.o .libs/unity.o .libs/airy.o .libs/hyp2f1.o .libs/hyperg.o .libs/i0.o .libs/i1.o .libs/iv.o .libs/j0.o .libs/j1.o .libs/jn.o .libs/jv.o .libs/k0.o .libs/k1.o .libs/kn.o .libs/psi.o .libs/struve.o .libs/yn.o .libs/kv.o .libs/enorm.o .libs/fdjac2.o .libs/lmder.o .libs/lmdif.o .libs/lmpar.o .libs/qrfac.o .libs/qrsolv.o .libs/lbfgsb.o .libs/check32.o .libs/eqdeg.o .libs/genmtrand.o .libs/mt19937.o .libs/prescr.o .libs/seive.o -L/opt/local/lib -lm -ldl -lz -lfftw3 -lcurl -lgsf-1 -lgobject-2.0 -lglib-2.0 -lintl -lxml2 -msse2 -Wl,-headerpad_max_install_names -Wl,-syslibroot -Wl,/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk -arch x86_64 -Wl,-framework -Wl,Accelerate -install_name /opt/local/lib/libgretl-1.0.40.dylib -compatibility_version 41 -current_version 41.0 -Wl,-single_module
ld: warning: dylib (/opt/local/lib/libgsf-1.dylib) was built for newer macOS version (11.2) than being linked (11.0)
Undefined symbols for architecture x86_64:
"_FSPathMakeRef", referenced from:
_cli_help in gretl_help.o
"_LSOpenFSRef", referenced from:
_cli_help in gretl_help.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
~~~

Examining gretl_help.c, it looks like HAVE_CARBON is being defined somewhere but that CoreServices is not being linked. configure.ac indicates that either Carbon or CoreServices should be linked on Mac, but you can see in the link command above that neither is (only Accelerate).

Complete build log with error highlighted is here:

https://github.com/macports/macports-ports/pull/12464/checks?check_run_id=3825449839#step:8:1489

Discussion

  • Allin Cottrell

    Allin Cottrell - 2021-10-07

    Thanks for the report. You should be able to work around this issue by adding the flag
    --disable-carbon
    when configuring the gretl build. We use that when building our arm_64 version of gretl for macOS 11. However we'll have to see if we can get this right automatically.

     
    • Evan Miller

      Evan Miller - 2021-10-07

      --disable-carbon results in similar errors:

        Undefined symbols for architecture x86_64:
          "_CFRelease", referenced from:
              _cli_help in gretl_help.o
          "_CFURLCreateFromFileSystemRepresentation", referenced from:
              _cli_help in gretl_help.o
          "_LSOpenCFURLRef", referenced from:
              _cli_help in gretl_help.o
      

      It appears that the MACLIB variable defined in configure.ac is never actually included in LIBS for the shared library.

       
      • Allin Cottrell

        Allin Cottrell - 2021-10-07

        Hmm, true enough. Somehow our aarch64-apple-darwin20.2-clang didn't complain about that. But anyway, this should now be fixed in git. The --disable-carbon flag is no longer needed or wanted. We switch from Carbon to CoreServices for darwin > 18.

         
        • Evan Miller

          Evan Miller - 2021-10-08

          Works for me. You're probably safe switching to CoreServices as early as Darwin 10. (If all goes well here, MacPorts will eventually provide coverage for Darwin 11+. I am currently testing on a Darwin 8 / PowerPC machine.)

           
          • Allin Cottrell

            Allin Cottrell - 2021-10-08

            In the GUI we need either LSGetApplicationForItem (Carbon) or LSCopyDefaultApplicationURLForURL (CoreServices) and the latter is not available in macOS < 10.10 (darwin 14), so I'm afraid we can't get rid of Carbon altogether for darwin 10.

             
  • Sven S.

    Sven S. - 2021-10-08
    • status: open --> closed
     
  • Sven S.

    Sven S. - 2021-10-08

    Thanks for another constructive exchange. Closing this.

     

Log in to post a comment.