Skip to content

Commit 4660f21

Browse files
Update README (#470)
* 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]>
1 parent 3774195 commit 4660f21

File tree

3 files changed

+44
-1
lines changed

3 files changed

+44
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ endif()
167167
# Configuration options for semantics
168168
#
169169
option(REMILL_BARRIER_AS_NOP "Remove compiler barriers (inline assembly) in semantics" OFF)
170+
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)
170171

171172
#
172173
# target settings

README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,43 @@ cd ./remill-build
138138
make test_dependencies
139139
make test
140140
```
141+
142+
### Full Source Builds
143+
144+
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:
145+
146+
```sh
147+
mkdir build
148+
cd build
149+
cmake \
150+
-DCMAKE_INSTALL_PREFIX="<path where remill will install>" \
151+
-DVCPKG_ROOT="<path to cxx-common directory>/vcpkg" \
152+
-G Ninja \
153+
..
154+
cmake --build .
155+
cmake --build . --target install
156+
```
157+
158+
The output may produce some CMake warnings about policy CMP0003. These warnings are safe to ignore.
159+
160+
### Common Build Issues
161+
162+
If you see errors similar to the following:
163+
164+
```
165+
fatal error: 'bits/c++config.h' file not found
166+
```
167+
168+
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:
169+
170+
```sh
171+
sudo dpkg --add-architecture i386
172+
sudo apt-get update
173+
sudo apt-get install libc6-dev:i386 install libstdc++-10-dev:i386 g++-multilib
174+
```
175+
176+
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.
177+
178+
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`.
179+
180+
Another alternative is to disable SPARC32 runtime semantics. To do that, use the `-DREMILL_BUILD_SPARC32_RUNTIME=False` option when invoking `cmake`.

lib/Arch/SPARC32/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ add_library(remill_arch_sparc32 STATIC
2929
Extract.cpp
3030
)
3131

32-
add_subdirectory(Runtime)
32+
if(${REMILL_BUILD_SPARC32_RUNTIME})
33+
add_subdirectory(Runtime)
34+
endif()
3335

3436
set_property(TARGET remill_arch_sparc32 PROPERTY POSITION_INDEPENDENT_CODE ON)
3537

0 commit comments

Comments
 (0)