AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Macports rsync9/24/2023 MacPorts is not designed for you to do that. Where you erred was in attempting to second-guess MacPorts' choice of compiler by overriding piler on the command line. A C++ program and all of the libraries it uses must use the same C++ library. clang++ uses the libc++ standard library while g++ uses the libstdc++ standard library they're not compatible with one another. You correctly deduced that the problem was that netcdf-cxx4 was compiled by MacPorts with clang++ whereas you were trying to compile your program with g++. What can I do to solve this? Thanks for any inputs! configure -prefix=/opt/local ac_cv_prog_AWK=/usr/bin/awk ac_cv_path_GREP=/usr/bin/grep ac_cv_path_SED=/usr/bin/sed -disable-csharp -disable-java -disable-native-java -disable-openmp -without-emacs -with-included-gettext -with-included-glib -with-included-libcroco -with-included-libunistring -with-included-libxml -without-cvs -without-git -without-xzĮrror: Failed to configure gettext, consult /opt/local/var/macports/build/_opt_local_var_macports_sources_macports_release_tarballs_ports_devel_gettext/gettext/work/gettext-0.19.8.1/config.logĮrror: Failed to configure gettext: configure failure: command execution failedĮrror: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_macports_release_tarballs_ports_devel_gettext/gettext/main.log for details.Įrror: Unable to execute port: upgrade netcdf failed configure failed for gettext-runtimeĬommand failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_macports_release_tarballs_ports_devel_gettext/gettext/work/gettext-0.19.8.1" &. noĬonfigure: error: in `/opt/local/var/macports/build/_opt_local_var_macports_sources_macports_release_tarballs_ports_devel_gettext/gettext/work/gettext-0.19.8.1/gettext-runtime':Ĭonfigure: error: C compiler cannot create executablesĬonfigure: error. However, to solve the above issue, I tried installing netcdf-cxx4 with the command: sudo port -s -v install netcdf-cxx4 piler=macports-gcc-10 configure.cxx_stdlib=macports-libstdc++īut this ends with the error message: checking whether the C compiler works. If I abort, I can use the NetCDF4 library (and everything seems to work). If I type Y, netcdf-cxx4 is reinstalled (but again with clang - which does not help me). The following ports will be rebuilt: netcdf-cxx4 : You can always run 'port rev-upgrade' again to fix errors. > Found 1 broken port, determining rebuild order The installation ends with: netcdf-cxx4 is using libstdc++ (this installation is configured to use libc++) I therefore tried to install netcdf-cxx4 with the following command: sudo port -s -v install netcdf-cxx4 piler=macports-gcc-10 Update: I partially solved the problem: I realised that MacPorts uses clang to compile the port. I'm quite clueless how to solve this problem. Ld: symbol(s) not found for architecture x86_64Ĭollect2: error: ld returned 1 exit status "_ZNK6netCDF7NcGroup6addVarERKNSt7_cxx1112basic_stringIcSt11char_traitsIcESaIcEEERKNS_6NcTypeERKSt6vectorINS_5NcDimESaISD_EE", referenced from: "_ZNK6netCDF7NcGroup6addDimERKNSt7_cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm", referenced from: "_ZN6netCDF6NcFileC1ERKNSt7_cxx1112basic_stringIcSt11char_traitsIcESaIcEEENS0_8FileModeE", referenced from: However, this results in the following error: Undefined symbols for architecture x86_64: I'm rather unfamiliar with setting linking options and I tried to compile/link the program with the following command: g++ SimpleXyWr.cpp -o SimpleXyWr.out -I/opt/local/include -L/opt/local/lib -lnetcdf -lnetcdf_c++4 I've installed netcdf-cxx4 via Macports and downloaded a C++ NetCDF4 example from here:
0 Comments
Read More
Leave a Reply. |