Skip to content

Commit 5100d58

Browse files
cmake: Use system-installed libzip instead of building from source
Replace the CPM-fetched libzip with find_package via pkg-config, requiring libzip to be pre-installed on the host. This speeds up configuration and avoids building libzip from source in-tree. Changes: - Use pkg_check_modules(LIBZIP) instead of CPM fetch, avoiding broken CMake config files shipped by Ubuntu's libzip-dev (which reference tool binaries from the missing libzip-tools package) - Add libzip to install_dependencies.sh for all supported platforms (Ubuntu, MSYS2, macOS) - Set BUILD_SHARED_LIBS=ON explicitly, since CPM-fetched libzip was previously setting this as a side effect via its option() call; without it, SystemC defaults to static on Windows, causing multiple-definition errors when plugin DLLs link against both libqbox.dll and libsystemc.a - Remove unused #include <zipint.h> (internal libzip header not available in the system package) Signed-off-by: Jerome Haxhiaj <jhaxhiaj@qti.qualcomm.com>
1 parent 164301e commit 5100d58

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ set(CMAKE_FIND_USE_PACKAGE_REGISTRY FALSE)
4949
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
5050
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
5151
set(THREADS_PREFER_PTHREAD_FLAG ON)
52+
set(BUILD_SHARED_LIBS ON CACHE BOOL "Build shared libraries" FORCE)
5253

5354
# Dependencies URLs
5455
set(LIBQEMU_GIT "https://github.com/qualcomm/qemu.git" CACHE STRING "libqemu git url")
@@ -224,11 +225,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibELF DEFAULT_MSG
224225

225226
mark_as_advanced(LIBELF_INCLUDE_DIR LIBELF_LIBRARIES)
226227

228+
# System / local packages (must be installed on the host)
227229
find_package(Threads REQUIRED)
230+
find_package(PkgConfig REQUIRED)
231+
pkg_check_modules(LIBZIP REQUIRED IMPORTED_TARGET libzip)
228232

233+
# CPM packages (fetched from source)
229234
gs_addexpackage("gh:google/googletest#v1.15.2")
230235
gs_addexpackage("gh:lua/lua#v5.4.2")
231-
gs_addexpackage("gh:nih-at/libzip#v1.11.3")
232236
gs_addexpackage("gh:TheLartians/PackageProject.cmake@1.4.1")
233237

234238
find_package(Git QUIET)
@@ -407,7 +411,7 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
407411
Threads::Threads
408412
rpc
409413
${CROW_DEP}
410-
zip
414+
PkgConfig::LIBZIP
411415
${PYBIND11_EMBED}
412416
${CMAKE_DL_LIBS}
413417
)
@@ -418,7 +422,7 @@ set(QBOX_INCLUDE_DIR "${QEMU_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/systemc-co
418422
gs_export(${PROJECT_NAME} ${QBOX_INCLUDE_DIR})
419423

420424
if (NOT DEFINED GS_ONLY)
421-
install(TARGETS rpc zip)
425+
install(TARGETS rpc)
422426
endif()
423427

424428
list(APPEND TARGET_LIBS ${PROJECT_NAME})

scripts/install_dependencies.sh

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ if { [ -e /etc/os-release ] && OS_RELEASE="/etc/os-release"; } || \
1919
if [ "${VERSION_ID}" = "24.04" ]; then
2020
apt install cmake g++ gcc git libasio-dev libelf-dev libepoxy-dev \
2121
libglib2.0-dev libjpeg-dev libpixman-1-dev libsdl2-dev \
22-
libslirp-dev libasio-dev libvirglrenderer-dev meson \
23-
ninja-build ocl-icd-opencl-dev python3 python3-dev \
22+
libslirp-dev libasio-dev libvirglrenderer-dev libzip-dev \
23+
meson ninja-build ocl-icd-opencl-dev python3 python3-dev \
2424
python3-venv
2525
elif [ "${VERSION_ID}" = "22.04" ]; then
2626
apt install cmake g++ gcc git libasio-dev libelf-dev libepoxy-dev \
2727
libglib2.0-dev libjpeg-dev libpixman-1-dev libsdl2-dev \
28-
libslirp-dev libasio-dev libvirglrenderer-dev meson \
29-
ninja-build ocl-icd-opencl-dev python3 python3-dev \
28+
libslirp-dev libasio-dev libvirglrenderer-dev libzip-dev \
29+
meson ninja-build ocl-icd-opencl-dev python3 python3-dev \
3030
python3-tomli python3-venv
3131
elif [ "${VERSION_ID}" = "20.04" ]; then
3232
apt install cmake g++ gcc git libasio-dev libelf-dev libepoxy-dev \
3333
libglib2.0-dev libjpeg-dev libpixman-1-dev libsdl2-dev \
34-
libslirp-dev libasio-dev libvirglrenderer-dev meson \
35-
ninja-build ocl-icd-opencl-dev python3 python3-dev \
34+
libslirp-dev libasio-dev libvirglrenderer-dev libzip-dev \
35+
meson ninja-build ocl-icd-opencl-dev python3 python3-dev \
3636
python3-pip python3-venv
3737
pip install --user tomli
3838
else
@@ -45,8 +45,9 @@ if { [ -e /etc/os-release ] && OS_RELEASE="/etc/os-release"; } || \
4545

4646
# Pacboy handle package prefixes automatically
4747
pacboy -S --noconfirm --needed \
48-
toolchain cmake gtk3 libnfs libssh meson ninja pixman pkgconf \
49-
python python-pexpect SDL2 zstd libelf asio libslirp
48+
toolchain cmake gtk3 libnfs libssh libzip libelf libslirp \
49+
meson ninja pixman pkgconf python python-pexpect SDL2 \
50+
zstd asio
5051
fi
5152
else
5253
case "$(uname)" in
@@ -55,13 +56,13 @@ else
5556
readonly MAJOR_VERSION
5657

5758
if [ "${MAJOR_VERSION}" = "26" ]; then
58-
brew install asio bison cmake jpeg libelf libslirp meson ninja \
59-
python3 sdl2
60-
pip install --user numpy pexpect
59+
brew install asio bison cmake jpeg libelf libslirp libzip meson \
60+
ninja python3 sdl2
61+
pip install --user pexpect numpy
6162
elif [ "${MAJOR_VERSION}" = "15" ]; then
62-
brew install asio bison cmake jpeg libelf libslirp meson ninja \
63-
python3 sdl2
64-
pip install --user numpy pexpect
63+
brew install asio bison cmake jpeg libelf libslirp libzip meson \
64+
ninja python3 sdl2
65+
pip install --user pexpect numpy
6566
else
6667
unsupported_operating_system
6768
fi

systemc-components/common/include/reg_model_maker/reg_model_maker.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#include <scp/report.h>
1313
#include <rapidjson/include/rapidjson/document.h>
1414
#include <zip.h>
15-
#include <zipint.h>
1615
#include <cciutils.h>
1716
#include <gs_memory.h>
1817
#include <router.h>

0 commit comments

Comments
 (0)