-
Notifications
You must be signed in to change notification settings - Fork 261
Description
Version and Platform (required):
- Binary Ninja Version: 5.2.8455-dev Ultimate, c11250a0
- OS: macos
- OS Version: 26.0
- CPU Architecture: arm64
Bug Description:
A user on Slack asked about building the WARP plug-in from source in order to test some local changes. They hit this error:
add_library cannot create target "binaryninjaui" because another target
with the same name already exists. The existing target is an interface
library created in source directory
I looked at it locally and there are a number of CMake issues that unintentionally prevent building outside of an internal build. But there are also dependencies on the code on having an internal checkout:
| #include "../../../../../ui/mainwindow.h" |
🫠
Steps To Reproduce:
git clone --recurse-submodules https://github.com/vector35/binaryninja-api.git
cd binaryninja-api
cmake -S plugins/warp -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -G Ninja -DBN_API_PATH=$PWD -DCMAKE_PREFIX_PATH=$HOME/Qt/6.8.2/clang_64/lib/cmake
cmake --build build
Additional Information:
The initial problem is that for non-internal builds, plugins/warp/api and plugins/warp/ui both call add_subdirectory on $BN_API_PATH. This causes CMake to attempt to redefine the same targets.
Removing that code leads to some errors while building Rust code as variables like BN_CORE_PLUGIN_DIR and BN_INSTALL_BIN_DIR are used when constructing command lines. These are not defined for non-internal builds.
And that leaves the dependency on mainwindow.h.