charmplusplus / charm

The Charm++ parallel programming system. Visit https://charmplusplus.org/ for more information.
Apache License 2.0
199 stars 50 forks source link

Build failure for charm4py build on mac/darwin #3795

Closed ritvikrao closed 1 month ago

ritvikrao commented 3 months ago

When attempting to build the charm4py-compatible version of charm++ on mac, the build fails. The failure message is the following:

clang: error: no such file or directory: ' '
Fatal Error by charmc in directory /Users/ritvik/charm4py/charm_src/charm/netlrts-darwin-x86_64
   Command clang++ -framework Foundation -framework IOKit -multiply_defined suppress -stdlib=libc++ -D_DARWIN_C_SOURCE -mmacosx-version-min=10.7 -ftls-model=initial-exec -rdynamic -fpic -shared CMakeFiles/charm.dir/empty.cpp.o  -Wl,-all_load -Wl,-search_paths_first -Wl,-headerpad_max_install_names lib/libck.a lib/libconverse.a lib/libmemory-default.a lib/libthreads-default.a lib/libldb-rand.a -Llib/   -lz -lm -lstdc++ -o lib/libcharm.dylib returned error code 1
charmc exiting...
make[2]: *** [lib/libcharm.dylib] Error 1
make[1]: *** [CMakeFiles/charm.dir/all] Error 2

The error happens during "Linking CXX shared library lib/libcharm.dylib".

To reproduce:

  1. Use any Mac machine (x86 or apple silicon)
  2. Run the following:
    $ git clone https://github.com/UIUC-PPL/charm4py.git && cd charm4py
    $ mkdir charm_src && cd charm_src
    $ git clone https://github.com/UIUC-PPL/charm.git && cd charm
    $ ./build charm4py netlrts-darwin-<relevant architecture> -j8 --with-production

The error will appear at ~86% of the build or so. I suspect this issue is related to the way the libcharm library file is built based on cmakelists.txt:969:

if(${TARGET} STREQUAL "charm4py")
  # Create libcharm.so for Charm4py
  # add_compile_options(-build-shared)
  file(WRITE empty.cpp "// This file left intentionally blank. It is used for the charm4py build.")
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
  add_library(charm SHARED empty.cpp)
  set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib_so)
  target_link_libraries(charm ck converse memory-default threads-default ldb-rand "-Llib/ -standalone -whole-archive -c++stl -shared")

  add_dependencies(charm hwloc)
endif()
ericjbohm commented 3 months ago

See if this workaround using buildold fixes the issue https://github.com/UIUC-PPL/charm/pull/3797

I couldn't find where this mistake is made in the cmake build, but it is the same thinko.

ritvikrao commented 1 month ago

closing because #3797 was merged