Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ elseif(NOT DEFINED ${ARCHITECTURE})
endif()
endif()

add_subdirectory(third_party)

project("tinyinst")

add_subdirectory(third_party)

include_directories(${CMAKE_CURRENT_BINARY_DIR}/third_party/obj/wkit/include)

if(${ARCHITECTURE} MATCHES arm64)
Expand Down
12 changes: 12 additions & 0 deletions Linux/arm64.toochain.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
set(CMAKE_C_COMPILER aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER aarch64-linux-gnu-g++)

set(ARCHITECTURE arm64)
add_definitions(-DARM64)

# search for programs in the build host directories.
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# Only look for libraries, headers and packages in the sysroot, don't look on the build machine.
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
1 change: 1 addition & 0 deletions Linux/debugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct LoadedModule {
bool operator< (LoadedModule const& lhs, LoadedModule const& rhs);

#ifdef ARM64
#include <asm/ptrace.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed given that we already include sys/ptrace.h from debugger.h. And if it's needed for cross-compiling, will it cause issues when building for Android using the Android NDK?

typedef user_pt_regs arch_reg_struct;
#else
typedef user_regs_struct arch_reg_struct;
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,14 @@ cmake -DCMAKE_TOOLCHAIN_FILE=</path/to/android/ndk>build/cmake/android.toolchain
cmake --build . --config Release
```

#### Cross-compiling for Linux
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Cross-compiling for aarch64 Linux"?

```
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../Linux/arm64.toochain.cmake ..
cmake --build . --config Release
```

Note #1: 64-bit build will also run against 32-bit targets on Windows and Linux operating systems

Note #2: Encountering problems creating a 32-bit build on 64-bit Windows due to the environment not being properly set up and libraries missing? Open the generated .sln file in Visual Studio and build from there instead of running cmake --build. Also note that 64-bit build is going to work on 32-bit targets, so creating a 32-bit build might not be necessary.
Expand Down