Skip to content

Commit

Permalink
Update README (#470)
Browse files Browse the repository at this point in the history
* Update README to show how to do full source builds using VCPKG and explain how to solve a frustrating build issue

* Explain how to disable building SPARC32 runtime semantics

Co-authored-by: Eric Kilmer <[email protected]>
  • Loading branch information
artemdinaburg and ekilmer authored Jan 13, 2021
1 parent 3774195 commit 4660f21
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ endif()
# Configuration options for semantics
#
option(REMILL_BARRIER_AS_NOP "Remove compiler barriers (inline assembly) in semantics" OFF)
option(REMILL_BUILD_SPARC32_RUNTIME "Build the Runtime for SPARC32. Turn this off if you have include errors with <bits/c++config.h>, or read the README for a fix" ON)

#
# target settings
Expand Down
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,43 @@ cd ./remill-build
make test_dependencies
make test
```

### Full Source Builds

Sometimes, you want to build everything from source, including the [cxx-common](https://github.com/trailofbits/cxx-common) libraries remill depends on. To build against a custom cxx-common location, you can use the following `cmake` invocation:

```sh
mkdir build
cd build
cmake \
-DCMAKE_INSTALL_PREFIX="<path where remill will install>" \
-DVCPKG_ROOT="<path to cxx-common directory>/vcpkg" \
-G Ninja \
..
cmake --build .
cmake --build . --target install
```

The output may produce some CMake warnings about policy CMP0003. These warnings are safe to ignore.

### Common Build Issues

If you see errors similar to the following:

```
fatal error: 'bits/c++config.h' file not found
```

Then you need to install 32-bit libstdc++ headers and libraries. On a Debian/Ubuntu based distribution, You would want to do something like this:

```sh
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6-dev:i386 install libstdc++-10-dev:i386 g++-multilib
```

This error happens because the SPARC32 runtime semantics (the bitcode library which lives in `<install directory>/share/remill/<version>/semantics/sparc32.bc`) are built as 32-bit code, but 32-bit development libraries are not installed by default.

A similar situation occurs when building remill on arm64 Linux. In that case, you want to follow a similar workflow, except the architecture used in `dpkg` and `apt-get` commands would be `armhf` instead of `i386`.

Another alternative is to disable SPARC32 runtime semantics. To do that, use the `-DREMILL_BUILD_SPARC32_RUNTIME=False` option when invoking `cmake`.
4 changes: 3 additions & 1 deletion lib/Arch/SPARC32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ add_library(remill_arch_sparc32 STATIC
Extract.cpp
)

add_subdirectory(Runtime)
if(${REMILL_BUILD_SPARC32_RUNTIME})
add_subdirectory(Runtime)
endif()

set_property(TARGET remill_arch_sparc32 PROPERTY POSITION_INDEPENDENT_CODE ON)

Expand Down

0 comments on commit 4660f21

Please sign in to comment.