Project

General

Profile

Problems when compiling older version of Wt on Mac OS

Added by F V almost 2 years ago

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 https://stackoverflow.com/questions/17415564/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.


Replies (9)

RE: Problems when compiling older version of Wt on Mac OS - Added by Mark Travis almost 2 years ago

At least you are on the relatively stable version of Catalina! You can go to Big Sur with a 2019. Any reason you don't want to do that? Monterey has been flawless for me after the .3 update. (Actually, after the .1 update)

Make sure you are using the latest version of Xcode that Catalina supports. Make sure you have installed the command line tools. I have a "late-2012" Mac mini that won't run anything later than Catalina. I've successfully compiled and run my Wt 4.x project using Xcode 12.4 using the instructions in the links you provided.

Make sure you are not running afoul of the system security. I seem to recall having to set SIP down a level from the recovery mode.

Just a suggestion... see if you can get the 4.x version of Wt installed with Boost 1.7x and the rest of the updated libraries.

I've also run in to some CMake issues. It seems the CMake community just changes stuff and expects everyone to keep up. What worked a few point releases ago might not work anymore due to structural changes (it seems for the better.)

RE: Problems when compiling older version of Wt on Mac OS - Added by F V almost 2 years ago

Hi Mark,

I'll check if I have the latest XCode version.

We need to stay with Catalina since some IDE's we currently use for Embedded Development don't work on Big Sur.

"Make sure you are not running afoul of the system security." I am not sure what you mean by this?

Wt 4.X compiles without issues, thing is, our project does not work with Wt 4.X.
The issue really lies with trying to compile the 3.3.7 version of Wt.
Like I mentioned, we aren't ready just yet to invest the resources required to update this old project.
We were hoping we could just run the older libraries directly on a recent MacBook.

Might have to reconsider updating the project and using Wt 4.X though.

Thanks!

RE: Problems when compiling older version of Wt on Mac OS - Added by Mark Travis almost 2 years ago

Ah, got it. I took the plunge to 4.x a while back. It wasn't as brutal as I thought it was going to be, but then again, I didn't have a huge project at the time. I had a secured log-in, three or four pages, and mostly math libraries.

System security is SIP. It locks down some of the file structures where I think you have to run in sudo all the time and even then it was causing weird things to happen because some resources just can't run sudo. That may have been fixed and it might not be your problem.

Did you do a search (upper right corner) of "boost 1.5"? Seems I remember something about going to 1.5.7 to fix a bug, but I didn't find it immediately. There was a thread that mentioned going to 1.5.8 fixed a linking problem for a Qt project.

One other thing, CMakeLists.txt is what you need to change, if you change anything at all. CMakeCache.txt is what CMake generates from the aforementioned file. Don't change that.

Follow the Linux install path. create /build directory, "cmake ../" from the build directory, "ccmake ../" (edit the ccmake listing if you need) "c" then "g" from inside ccmake. Then make.

(I didn't see the files from the root directory of the git branch that you linked to. Including the absence of CMakeLists.txt. )

RE: Problems when compiling older version of Wt on Mac OS - Added by F V almost 2 years ago

I'll check if I can disable any SIP on the usr directory directly.

We are currently running boost 1.54 since that is what was installed on our virtual Linux machine. Possibly a different version, I'll give that a try.
At first I had some issues when compiling this boost version but I eventually got it working.

Right, I've been editing CMakeCache since I had a hard time understanding the CMakeLists, I can't seem to make any parallels between the two files.
If I understand correctly, CMakeLists will dictate what is in CMakeCache? So anything I changed in CMakeCache (CMAKE_CXX_FLAGS, CMAKE_CXX_COMPILER for example) I should instead change in CMakeLists?

Could you show me how to do this?
This is the only mention of CMAKE_CXX_COMPILER in CMakeLists

EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
ARGS --version
OUTPUT_VARIABLE GCC_COMPILER_VERSION
)

IF(GCC_COMPILER_VERSION MATCHES ".4\.4\.4\-14ubuntu5.")
MESSAGE(" ")
MESSAGE(" !!!!! WARNING Your compiler is BUGGY. !!!!! ")
MESSAGE(" ")
MESSAGE(" If possible, upgrade your compiler to e.g. g++ 4.5:")
MESSAGE(" ")
MESSAGE(" $ sudo apt-get install g++-4.5")
MESSAGE(" ")
MESSAGE(" And build using that compiler cmake -DCMAKE_CXX_COMPILER=g++-4.5")
MESSAGE(" ")
MESSAGE(" We will now disable all assertions as a work around, by")
MESSAGE(" building using -DNDEBUG. You will need to define this")
MESSAGE(" also for programs built using Wt")
MESSAGE(" ")
ADD_DEFINITIONS(-DNDEBUG)
ENDIF(GCC_COMPILER_VERSION MATCHES ".4\.4\.4\-14ubuntu5.")

How could I change this so it gives me
CMAKE_CXX_COMPILER:STRING=/usr/local/Cellar/gcc/11.3.0/bin/c++-11
in CMakeCache?
Is this done using the ccmake command?

I zipped the files present in our root directory (including CMakeLists). This might help a bit.

Thanks!

root.zip (153 KB) root.zip

RE: Problems when compiling older version of Wt on Mac OS - Added by Mark Travis almost 2 years ago

Don't worry about changing cmakelists.txt. Yes, cmakecache.txt gets overwritten by cmakelists.txt after it goes through the ccmake process.

You can make changes in your ccmake screens.

when you type ccmake ../ from the build directory, you should see what I've attached as a screenshot called ccmake0.jpg
at the bottom you can see a short menu hints. Press "t" to enter the advanced mode. There you will be able to override any of the settings.

So, for instance, on the line that says CMAKE_CXX_FLAGS, just highlight that line, hit enter, and type whatever flags you want.

When you are done, hit "c" to configure, "g" to generate, quit, then run make.

RE: Problems when compiling older version of Wt on Mac OS - Added by F V almost 2 years ago

Great, thanks for the explanation.

Haven't worked much with makefiles manually, usually its handled by the IDE's we use.

I'll set the paths and flags I set in the CMakeCache directly through the ccmake interface.

One thing I did was force the GCC compiler. This is giving me different results. It's now saying that my MySQL version isn't compatible.
After checking what version we use on the Linux machine, I saw that its using the MariaDB version of MySQL.

I installed MariaDB using HomeBrew and tried compiling Wt.

Seems like this fixed my issues!

So for anyone wondering and having the same issues as I was.

  1. Use the right version of Boost and MySQL.
    For me that was Boost 1.54 and MariaDB

  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

  3. Add the following flags to CMAKE_CXX_FLAGS "-std=c++11 -arch x86_64"

  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
    )

  5. Not sure if required, I disabled ENABLE_LIBWTTEST and BUILD_TESTS.

RE: Problems when compiling older version of Wt on Mac OS - Added by Mark Travis almost 2 years ago

Excellent!

I feel your pain on CMake... here is my recent adventure: https://redmine.emweb.be/boards/2/topics/17913

RE: Problems when compiling older version of Wt on Mac OS - Added by F V almost 2 years ago

Forgot to mention.
Also 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
}

RE: Problems when compiling older version of Wt on Mac OS - Added by F V almost 2 years ago

Just checked your post, all that work for three capital C's. That's rough.
Glad I'm done with this for now!

    (1-9/9)