Skip to content

Commit

Permalink
Add minimum for all CMakelists, remove panda.mak, and start work on t…
Browse files Browse the repository at this point in the history
…rying to run setup_container.py on a local Linux instance to get fixed
  • Loading branch information
AndrewQuijano committed Jul 9, 2024
1 parent 7fa9aaf commit d02caf4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 47 deletions.
18 changes: 13 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down Expand Up @@ -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
# RUN cd /tools/build && \
# make && \
# make install V=1
13 changes: 0 additions & 13 deletions setup_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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))

Expand Down
28 changes: 3 additions & 25 deletions tools/fbi/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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
Expand All @@ -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
)
)
4 changes: 0 additions & 4 deletions tools/fbi/src/find_bug_inj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ extern "C" {
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

#include "panda/plog.h"
#include "panda/plog-cc-bridge.h"
#include "panda/plog_print.h"
}

#include <jsoncpp/json/json.h>
Expand Down
2 changes: 2 additions & 0 deletions tools/lavaDB/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Expand Down
2 changes: 2 additions & 0 deletions tools/lavaODB/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.15)

set (GENERATED ${CMAKE_CURRENT_SOURCE_DIR}/../generated)

if (NOT EXISTS ${GENERATED})
Expand Down

0 comments on commit d02caf4

Please sign in to comment.