Skip to content
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

Feature: re-compile libdynarmic.so for Linux x86_64 platform #548

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
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
25 changes: 25 additions & 0 deletions backend/dynarmic/src/main/native/dynarmic/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM openjdk:8

RUN apt-get update

RUN apt-get install -y cmake g++ gcc clang

RUN apt-get install -y libboost-all-dev

RUN apt-get clean

RUN mkdir -p /git

# You should mount a volumn
# docker build -t cmake .
# docker run -it -v ~/github/:/git cmake /bin/sh

# Or copy the source code to the container
# COPY ../unidbg /git
# COPY ../dynarmic /git

# Then you can copy so file to outside of container
# docker cp <containerId>:/git/unidbg/backend/dynarmic/src/main/resources/natives/linux_64 ~/Downloads/

WORKDIR /git/unidbg/backend/dynarmic/src/main/native/
ENTRYPOINT [ "/git/unidbg/backend/dynarmic/src/main/native/linux_build.sh" ]
27 changes: 21 additions & 6 deletions backend/dynarmic/src/main/native/dynarmic/linux_build.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
JAVA_INC="$JAVA_HOME"/include
JAVA_PLATFORM_INC="$(dirname "$(find "$JAVA_INC" -name jni_md.h)")"

c++ -m64 -o libdynarmic.so -shared -fPIC -std=c++17 -O2 \
-I ~/git/dynarmic/include -I ~/git/dynarmic/externals/fmt/include dynarmic.cpp arm_dynarmic_cp15.cpp \
-I "$JAVA_INC" -I "$JAVA_PLATFORM_INC" \
~/git/dynarmic/build/src/libdynarmic.a \
~/git/dynarmic/build/externals/fmt/libfmt.a && \
mv libdynarmic.so ../../resources/natives/linux_64/
# Docker path
DYNARMIC_HOME=/git/dynarmic
UNIDBG_HOME=/git/unidbg

# compile dynarmic
cd $DYNARMIC_HOME && mkdir -p build
cd build
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON ..
make

cd $UNIDBG_HOME/backend/dynarmic/src/main/native

c++ -m64 -o libdynarmic.so -shared -fPIC -std=c++17 -O2 \
-I $DYNARMIC_HOME/src -I $DYNARMIC_HOME/externals/fmt/include dynarmic.cpp arm_dynarmic_cp15.cpp \
-I "$JAVA_INC" -I "$JAVA_PLATFORM_INC" -DDYNARMIC_MASTER \
$DYNARMIC_HOME/build/src/dynarmic/libdynarmic.a \
$DYNARMIC_HOME/build/externals/zydis/libZydis.a \
$DYNARMIC_HOME/build/externals/mcl/src/libmcl.a \
$DYNARMIC_HOME/build/externals/fmt/libfmt.a && \

mv libdynarmic.so ../../resources/natives/linux_64/
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ DYNARMIC_HOME=~/Downloads/dynarmic
$DYNARMIC_HOME/build/src/dynarmic/libdynarmic.a \
$DYNARMIC_HOME/build/externals/zydis/libZydis.a \
$DYNARMIC_HOME/build/externals/fmt/libfmt.a && \
mv libdynarmic.dylib ../../resources/natives/osx_64/
mv libdynarmic.dylib ../../resources/natives/osx_64/
Binary file not shown.