xcodemacosgccclangwt

Problems when compiling older version of Wt on Mac OS


We have an old project that we usually build on Linux in a virtual machine. Working on this project is a chore since it currently only builds and runs in the virtual machine. We aren’t ready yet to invest the resources necessary to rewrite the project with up to date libraries. However, we would like to build it using the old libraries on a newer computer.

We are currently trying to get this working on a MacBook pro 2019 running Catalina 10.15.7

The project requires Wt 3.3.7 Our current issue lies with trying to compile Wt using make.

Here are some of the resources we used when attempting this.
https://redmine.webtoolkit.eu/projects/wt/wiki/Installing_Wt_on_Mac_OS_X_Yosemite
https://www.webtoolkit.eu/wt/doc/reference/html/InstallationUnix.html
https://github.com/emweb/wt/tree/17c37f2fa9b57b1e2a6e2f412162d3df0192d785

When running make in the build directory of the wt-3.3.7 project, we get the following error:
Linking CXX shared library libwt.dylib ld: warning: could not create compact unwind for __ZN5boost10filesystem6detail5spaceERKNS0_4pathEPNS_6system10error_codeE.cold.111: stack size is large but stack subq instruction not found

ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/libwt.3.3.7.dylib] Error 1
make[1]: *** [src/CMakeFiles/wt.dir/all] Error 2
make: *** [all] Error 2

The issue seems to come when trying to make the libwt.3.3.7.dylib file. The issue also seems related to the boost library we are using. (Boost 1.54.0)
We specify the boost directory in the makefiles, maybe this isn't done properly.
Searching online seemed to indicate it might be trying to compile using C when it should be using C++. Not sure if this is actually the issue or not.

We tried
The “update_dyld_shared_cache” command

Also tried
Changing the CMAKE_LINKER value to usr/local/bin/g++-8
Changing the CMAKE_CXX_COMPILER value to usr/local/bin/g++-8
Changing the CMAKE_C_COMPILER value to usr/local/bin/gcc-8
Adding “-std=c++11 -stdlib=libc++” to CMAKE_CXX_FLAGS as per Linking c++ libraries (for Wt) in Xcode
All of these found in CMakeCache.txt

Here is a link to our zipped build directory containing all makefiles etc.
https://www.mediafire.com/file/s8d47b7sr0tn06h/build.zip/file
Also might be worth mentioning our clang version.
Apple clang version 11.0.3 (clang-1103.0.32.62)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Any help is appreciated, we aren’t sure how to resolve this issue.


Solution

  • For anyone wondering, I got it to compile. It seems like the problem came from using clang++.

    1. Use the right version of Boost and MySQL. For me that was Boost 1.54 and MariaDB.
      Boost 1.54 took some work to compile, make sure the libraries are actually present in the downloaded repository, I had to download them manually one by one.
      This was done in the ccmake interface.

    2. Change CMAKE_CXX_COMPILER to use the GCC c++-11 compiler.
      For me it was located here /usr/local/Cellar/gcc/11.3.0/bin/c++-11
      I installed GCC using Homebrew.
      This was done in the ccmake interface.

    3. Add the following flags to CMAKE_CXX_FLAGS "-std=c++11 -arch x86_64"
      This was done in the ccmake interface.

    4. Not sure if required, I added the boost path to the WtFindBoost-cmake.txt file.

    SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "/usr/local/Cellar/boost/1.54.0")  
    SET(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "/usr/local/Cellar/boost/1.54.0/lib")  
    SET(BOOST_INCLUDEDIR /usr/local/Cellar/boost/1.54.0/include)  
    SET(BOOST_LIBRARYDIR /usr/local/Cellar/boost/1.54.0/lib)  
    SET(BOOST_ROOT /usr/local/Cellar/boost/1.54.0)  
    SET(BOOST_DIR /usr/local/Cellar/boost/1.54.0)  
    

    I also force the exact Boost version.

    FIND_PACKAGE(Boost 1.54.0
      EXACT
      COMPONENTS
        ${Boost_COMPONENTS}
      REQUIRED
    )
    
    1. Not sure if required, I disabled ENABLE_LIBWTTEST and BUILD_TESTS.
      This was done in the ccmake interface.

    2. Change a return value in
      include/boost/date_time/local_time/custom_time_zone.hpp

    Change

    virtual bool has_dst() const
    {
      return (dst_calc_rules_); //if calc_rule is set the tz has dst
    }
    

    to

    virtual bool has_dst() const
    {
      return bool(dst_calc_rules_); //if calc_rule is set the tz has dst
    }