From d02caf493f3bd23fbb082fe648a2a9bc6bfc2aae Mon Sep 17 00:00:00 2001 From: AndrewQuijano Date: Mon, 8 Jul 2024 21:53:08 -0400 Subject: [PATCH] Add minimum for all CMakelists, remove panda.mak, and start work on trying to run setup_container.py on a local Linux instance to get fixed --- Dockerfile | 18 +++++++++++++----- setup_container.py | 13 ------------- tools/fbi/src/CMakeLists.txt | 28 +++------------------------- tools/fbi/src/find_bug_inj.cpp | 4 ---- tools/lavaDB/src/CMakeLists.txt | 2 ++ tools/lavaODB/src/CMakeLists.txt | 2 ++ 6 files changed, 20 insertions(+), 47 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8f37aa30..1a9edd52 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,11 @@ RUN apt-get update && apt-get install -qq -y \ socat \ wget +# Step 1: Install panda debian package, you need a version that has Dwarf2 Plugin +RUN wget https://github.com/panda-re/panda/releases/download/v1.8.23/pandare_20.04.deb +RUN command apt install -qq -y ./pandare_20.04.deb +RUN pip install pandare + # Libodb RUN cd /tmp && \ wget http://codesynthesis.com/download/odb/2.4/odb_2.4.0-1_amd64.deb && \ @@ -50,10 +55,13 @@ RUN cd /tools/btrace && \ # Build lavaTool. Depends on headers in lavaODB and tools/lavaDB #COPY tools/lavaODB/ tools/lavaDB/ tools/lavaTool/ /tools/ COPY tools/ /tools +COPY setup_container.py / ENV LLVM_DIR=/usr/lib/llvm-11 -RUN cd /tools && \ - cmake -Bbuild -H. -DLLVM_DIR=$LLVM_DIR/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=/tools/install +RUN python3 setup_container.py + +# RUN cd /tools && \ +# cmake -Bbuild -H. -DLLVM_DIR=$LLVM_DIR/lib/cmake/llvm -DClang_DIR=$LLVM_DIR/lib/cmake/clang -DCMAKE_INSTALL_PREFIX=/tools/install -RUN cd /tools/build && \ - make && \ - make install V=1 \ No newline at end of file +# RUN cd /tools/build && \ +# make && \ +# make install V=1 \ No newline at end of file diff --git a/setup_container.py b/setup_container.py index bc99165b..2c7d268c 100644 --- a/setup_container.py +++ b/setup_container.py @@ -12,14 +12,7 @@ LAVA_DIR = os.path.dirname(os.path.abspath(sys.argv[0])) os.chdir(LAVA_DIR) -PANDA_DIR = os.path.abspath(os.path.join(LAVA_DIR, "panda/src")) -PANDA_BUILD_DIR = os.path.join(PANDA_DIR, '../build') -PANDA_MAK = """ -# This is an autogenerated file from lava/setup.py. -PANDA_SRC_PATH := {PANDA_DIR} -PANDA_BUILD_DIR := {PANDA_DIR}/../build -""" LLVM_MAK = """ # This is an autogenerated file from lava/setup.py. LLVM_SRC_PATH := {LLVM_SRC_PATH} @@ -88,15 +81,9 @@ def run(cmd): # then setup.py will parse it and configure the environmet to those specs os.chdir(LAVA_DIR) - if not os.path.isfile(os.path.join(LAVA_DIR, "fbi", "panda.mak")): - progress("Creating $LAVA_DIR/tools/fbi/panda.mak") - with open(os.path.join(LAVA_DIR, "tools/fbi/panda.mak"), "w") as f: - f.write(PANDA_MAK.format(PANDA_DIR=PANDA_DIR)) - if not os.path.isfile(os.path.join(LAVA_DIR, "lava.mak")): progress("Creating $LAVA_DIR/lava.mak") with open("lava.mak", 'w') as f: - f.write(PANDA_MAK.format(PANDA_DIR=PANDA_DIR)) f.write(LLVM_MAK.format(LLVM_BUILD_PATH=LLVM_DOCKER_DIR, LLVM_SRC_PATH=LLVM_DOCKER_DIR)) diff --git a/tools/fbi/src/CMakeLists.txt b/tools/fbi/src/CMakeLists.txt index 04e041e3..a1a93d47 100644 --- a/tools/fbi/src/CMakeLists.txt +++ b/tools/fbi/src/CMakeLists.txt @@ -1,24 +1,6 @@ +cmake_minimum_required(VERSION 3.15) project (FBI LANGUAGES CXX) -# Panda src, headers and build locations -set (PANDA_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../panda/src) -set (PANDA_BUILD_DIR ${PANDA_SRC_PATH}/../build) -set (PANDA_HEADERS ${PANDA_SRC_PATH}/panda/include) - -# fbilib target -add_library (fbilib - ${PANDA_SRC_PATH}/panda/src/plog.c - ${PANDA_SRC_PATH}/panda/src/plog-cc.cpp -) -target_include_directories(fbilib BEFORE - PUBLIC - ${PANDA_SRC_PATH}/panda/include - ${PANDA_BUILD_DIR}/i386-softmmu - /usr/lib/odb/x86_64-linux-gnu/include -) -target_compile_options(fbilib PRIVATE -D_GLIBCXX_USE_CXX11_ABI=0 -DPLOG_READER) -set_property(TARGET fbilib PROPERTY CXX_STANDARD 14) - # fbi target add_executable(fbi find_bug_inj.cpp) set_property(TARGET fbi PROPERTY CXX_STANDARD 14) @@ -37,14 +19,12 @@ target_include_directories(fbi BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../lavaODB/generated ${CMAKE_CURRENT_SOURCE_DIR}/../../lavaODB/include ${CMAKE_CURRENT_SOURCE_DIR}/../../include - ${PANDA_SRC_PATH}/panda/include - ${PANDA_BUILD_DIR}/i386-softmmu /usr/lib/odb/x86_64-linux-gnu/include + /usr/local/include ) add_dependencies(fbi lava-odb_x64) set_target_properties(fbi PROPERTIES LINK_FLAGS "-L/usr/local/lib") target_link_libraries(fbi - fbilib lavaDB_x64 lava-odb_x64 protobuf-c @@ -54,12 +34,10 @@ target_link_libraries(fbi jsoncpp pq protobuf - ${PANDA_BUILD_DIR}/i386-softmmu/plog.pb.o - ${PANDA_BUILD_DIR}/i386-softmmu/plog.pb-c.o ) install (TARGETS fbi RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib/static OPTIONAL - ) + ) \ No newline at end of file diff --git a/tools/fbi/src/find_bug_inj.cpp b/tools/fbi/src/find_bug_inj.cpp index fac33379..2cf289fe 100644 --- a/tools/fbi/src/find_bug_inj.cpp +++ b/tools/fbi/src/find_bug_inj.cpp @@ -18,10 +18,6 @@ extern "C" { #include #include #include - -#include "panda/plog.h" -#include "panda/plog-cc-bridge.h" -#include "panda/plog_print.h" } #include diff --git a/tools/lavaDB/src/CMakeLists.txt b/tools/lavaDB/src/CMakeLists.txt index 998ebcae..4d516854 100644 --- a/tools/lavaDB/src/CMakeLists.txt +++ b/tools/lavaDB/src/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION 3.15) + #add_library (lavaDB_x32 STATIC lavaDB.cpp) #set_property(TARGET lavaDB_x32 PROPERTY CXX_STANDARD 11) #set_target_properties(lavaDB_x32 PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32") diff --git a/tools/lavaODB/src/CMakeLists.txt b/tools/lavaODB/src/CMakeLists.txt index f09e3388..19f1f3c2 100644 --- a/tools/lavaODB/src/CMakeLists.txt +++ b/tools/lavaODB/src/CMakeLists.txt @@ -1,3 +1,5 @@ +cmake_minimum_required(VERSION 3.15) + set (GENERATED ${CMAKE_CURRENT_SOURCE_DIR}/../generated) if (NOT EXISTS ${GENERATED})