-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Making codebase macOS compatible #637
base: master
Are you sure you want to change the base?
Conversation
❗ Issue: The functionality described by This is used by the searchparser, so that if the parent process stops, the process running Lucene will also stop with it. Compilation failure:
|
✔️ Fixed! The solution was that ❗ Issue: fail to link
|
2c6518e
to
a4cb9c0
Compare
✔️ Fixed! by defining the ❗ Issue: The multi-threaded management of the Mongoose-based web server uses signal management to catch SIGINT and SIGTERM signals, to stop serving on all threads. While it uses the POSIX-compliant system Compilation failure:
While PR #388 removes the dependency for the |
✔️ Fixed! automagically by updating to LLVM v15 (from v11). Most likely the LLVM v11 in HomeBrew was corrupt, as the reason for uprading to v15 in the first place was that v11 produced inexplainable errors. ❗ Issue: When linking the Compilation failure:
|
68115bf
to
62088b5
Compare
✔️ Fixed! The error was related to Thrift not being linked correctly to the OpenSSL library installed through HomeBrew. The build guide have been updated accordingly. ❗ Issue: cannot dynamically link Runtime failure:
Other parser plugins can be loaded properly. |
08bb846
to
369ccf1
Compare
adf285b
to
f29f518
Compare
210b4bd
to
2e02409
Compare
❗ Issue: Pragmas defined with the |
❗ Issue: Relative paths in the |
✔️ Fixed! skip compilation commands with the ❗ Issue: CodeCompass cannot parse Objective-C++ code with
CodeCompass skips the |
6f8e1d4
to
6dcd717
Compare
…k of Cohesion metric.
Build Guide on macOS
Tested on:
In contrast to the official guide of the project, we will use not GNU, but Clang to build CodeCompass and - most of - its dependencies. It is crucial to build them with the same compiler, otherwise if you are lucky, then you will get link-time unresolved symbol errors. If you are unlucky, then you will get runtime crashes and only in certain situations.
Since we would like to install as many dependencies from HomeBrew, as possible, and they were compiled with Clang (e.g. the Boost Library), we also use Clang.
Apple macOs comes with Clang (installation of XCode could be required), at the time of writing this guide, with v15. It is important to note, that the standard
gcc
andg++
binaries are linked to Clang instead as well.Install HomeBrew:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install available dependencies from HomeBrew:
Note: the
gnu-sed
andcoreutils
packages are required by GNU Bash scripts in CodeCompss.gnu-sed
is required for expected GNU sed usage inwebgui-new/thrift-codegen.sh
, for building the new web GUI.coreutils
is required for downloading and installing the latest Build2 byscripts/install_latest_build2.sh
(e.g. commandsnproc
andsha256sum
).Download and install OpenJDK. At the time of writing this guide, JDK v21 is the current stable version. Download it from https://jdk.java.net/21/, and extract it to
/Library/Java/JavaVirtualMachines
:Alternatively you could install OpenJDK from HomeBrew (
brew install java
). Pay attention to the instructions displayed after install, as this package is keg-only, which means it was not symlinked into/opt/homebrew/
(because it would shadow the macOSjava
wrapper), therefore you must create a symlink in/Library/Java/JavaVirtualMachines
or add the installation directory to your PATH.Build and install Thrift as described in the guide. Extra steps to do before:
Make sure beforehand that
bison
installed through HomeBrew is available on your PATH:This package is keg-only, which means it was not symlinked into
/opt/homebrew/
, because macOS already provides this software, but an older version (v2.3), not suitable for compiling Thrift.Homebrew installed several C++ related dependencies into the
/opt/homebrew/
folder with the gcc package. We need to make these available for Thrift to successfully build its C++ library. (Before running the configuration script.)Thrift compiles with some warning, when built with Clang, which by default will be treated as errors. Therefore we need to set the
-Wno-error
flag before calling the configuration script.When executing the
./configure
script, pass the--with-openssl=/opt/homebrew/opt/openssl
flag as well, so OpenSSL installed through HomeBrew could be found by Thrift.Build and install ODB as described in the guide, but while ODB runtime libraries (
libodb
) have to be built with Clang (to avoid linking issues), the ODB Compiler itself can only be built with GNU.Therefore we will build ODB in 2 steps into the
<libodb_build_dir>
and the<odb_build_dir>
folders. A shared<odb_install_dir>
installation destination can still be used though.Build the ODB runtime libraries. Note, that the
g++
compiler is the default Clang compiler of macOS - if not, it should be modified accordingly.Build the ODB Compiler. Here the
g++-13
GNU compiler is used, as at the time of writing this guide, GCC v13 is the default version installed by HomeBrew, but it could differ later.Furthermore, you need to add the
/opt/homebrew/
folder to the include and link path as shown below, so dependencies installed through HomeBrew (like GMP) will be found. In case you receive a strange compilation errorAssertion failed: (resultIndex < sectData.atoms.size())
, try adding-ld_classic
to the link flags, due to an XCode ld linker incompatibility issue with GNU.Build CodeCompass.
Ongoing issues
prctl.h
in Linux does not exist on macOS.libutil
againstlibodb-sqlite
.sighandler_t
is not included in the macOS.cpp_reparse
service, some types from the C++ standard library are not found.searchparser
plugin in runtime._Pragma
operator are double preprocessed, leading to parsing errors.compile_commands.json
for thefile
field are not handled properly..cpp
extension.