Build Error on Mac (clang, linker, test_fire_energy_minimizer)

130 views
Skip to first unread message

Rob Campbell

unread,
Oct 4, 2023, 7:38:43 PM10/4/23
to hoomd-users
I'm getting a linker command error from clang 15 when trying to build version 4.2 from source on Mac. I saw that some clang 15 errors on Mac were fixed in 4.2.1, but both v4.2.0 and v4.2.1 gave me the same error. I had no issues installing on Linux, so I have access to a working version, just hoping to run from my Mac as well. Do you have any suggestions for how I can resolve this?

I encountered this error on a 2020 Macbook Pro (Intel Core i5), and had the same error on both macOS 13 (Venture) and macOS 14 (Sonoma). I am using Apple clang version 15.0.0 (clang-1500.0.40.1) and was building 4.2 using a virtual environment following the instructions on the docs (here). I tried both cloning from git and downloading specific versions from the tar files, but all the 4.2 versions I tried to install gave me the same error.

The error message I receive is at 42% when building test_fire_enery_minimizer.cc

[ 42%] Linking CXX executable test_fire_energy_minimizer
ld: Undefined symbols:
  _libintl_bind_textdomain_codeset, referenced from:
      _PyIntl_bind_textdomain_codeset in libpython3.9.a[135](_localemodule.o)
  _libintl_bindtextdomain, referenced from:
      _PyIntl_bindtextdomain in libpython3.9.a[135](_localemodule.o)
      _PyIntl_bindtextdomain in libpython3.9.a[135](_localemodule.o)
  _libintl_dcgettext, referenced from:
      _PyIntl_dcgettext in libpython3.9.a[135](_localemodule.o)
  _libintl_dgettext, referenced from:
      _PyIntl_dgettext in libpython3.9.a[135](_localemodule.o)
  _libintl_gettext, referenced from:
      _PyIntl_gettext in libpython3.9.a[135](_localemodule.o)
  _libintl_setlocale, referenced from:
      _PyLocale_setlocale in libpython3.9.a[135](_localemodule.o)
      _PyLocale_setlocale in libpython3.9.a[135](_localemodule.o)
      _PyLocale_localeconv in libpython3.9.a[135](_localemodule.o)
      _PyLocale_localeconv in libpython3.9.a[135](_localemodule.o)
      _PyLocale_localeconv in libpython3.9.a[135](_localemodule.o)
      _PyLocale_localeconv in libpython3.9.a[135](_localemodule.o)
  _libintl_textdomain, referenced from:
      _PyIntl_textdomain in libpython3.9.a[135](_localemodule.o)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [hoomd/md/test/test_fire_energy_minimizer] Error 1
make[1]: *** [hoomd/md/test/CMakeFiles/test_fire_energy_minimizer.dir/all] Error 2
make: *** [all] Error 2


Thanks for the help!

Rob

Joshua Anderson

unread,
Oct 5, 2023, 8:49:51 AM10/5/23
to hoomd...@googlegroups.com
Rob,

This error is in building the C++ unit tests (ctest). You can set the CMake option BUILD_TESTING=off and see if the python module is functional with the Python unit tests (pytest).

What Python distribution do you use? HOOMD-blue should link C++ unit tests against the shared libpython3.9.dylib, not the static libpython3.9.a. It is possible that your Python distribution was built without shared libraries.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/a93abd4c-77e4-4055-9259-b3e6098622d9n%40googlegroups.com.

Rob Campbell

unread,
Oct 6, 2023, 9:38:57 AM10/6/23
to hoomd-users
That fixed it! I had installed Python 3.9.7 with pyenv, which apparently does not install shared libraries by default (or at least it didn't when I installed it). 
After reinstalling python with shared libraries enabled, I was able to install HOOMD-blue 4.2 without issue. Thanks for the help!


If anyone else comes across this issue, the pyenv command I used to install shared libraries is:

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.9.7

and you can confirm that it worked by running python and checking if this returns 1 (True):

import sysconfig
sysconfig.get_config_var('Py_ENABLE_SHARED') 

Reply all
Reply to author
Forward
0 new messages