google / bindiff

Quickly find differences and similarities in disassembled code
https://zynamics.com/bindiff.html
Apache License 2.0
2.15k stars 130 forks source link

Enable building without the IDA SDK #26

Closed cyrozap closed 7 months ago

cyrozap commented 11 months ago

Is your feature request related to a problem? Please describe. I have no access to the IDA SDK (downloading it appears to require an IDA Pro license/login), but I have no need for the IDA Pro plugin anyways, so I'd like to be able to build the bindiff executable without having to obtain the IDA SDK.

Describe the solution you'd like BinExport can be built without the IDA SDK by setting -DBINEXPORT_ENABLE_IDAPRO=NO, so it would be nice to have a similar setting for BinDiff (e.g., BINDIFF_ENABLE_IDAPRO). It would be even more convenient if the build system could automatically detect the presence or absence of the IDA SDK, so it wouldn't be necessary to set a flag in the first place.

Describe alternatives you've considered I can manually patch the CMakeLists.txt files, but it's not a particularly user-friendly solution.

cblichmann commented 11 months ago

Agreed, this sounds like a good idea. Care to send me your patched CMakeLists.txt? :D

I have no access to the IDA SDK (downloading it appears to require an IDA Pro license/login) Yes, but it's interesting that they publish the full Doxygen docs with full function prototypes. Extracting this and building a compatible/minimal SDK should be possible...

cyrozap commented 11 months ago

Agreed, this sounds like a good idea. Care to send me your patched CMakeLists.txt? :D

Sorry, when I said "manually patch the CMakeLists.txt files", I didn't mean to imply that I had a proper patch ready to be upstreamed. I just deleted the lines that made the build fail, like so:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5e21fe6..3b1421ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -369,9 +369,6 @@ if(NOT MSVC)
 endif()
 install(TARGETS bindiff RUNTIME DESTINATION bindiff-prefix)

-# IDA Pro plugins
-add_subdirectory(ida)
-
 # Utility programs. For now, only contains a tool to modify the BinDiff
 # config from the installer/package scripts.
 add_subdirectory(tools)
diff --git a/cmake/BinDiffDeps.cmake b/cmake/BinDiffDeps.cmake
index 7afa5cc7..e4196fdc 100644
--- a/cmake/BinDiffDeps.cmake
+++ b/cmake/BinDiffDeps.cmake
@@ -28,7 +28,4 @@ if(NOT sqlite_POPULATED)
   endif()
 endif()

-# Setup IDA SDK. Uses FindIdaSdk.cmake from BinExport
-find_package(IdaSdk REQUIRED)
-
 find_package(Protobuf 3.14 REQUIRED) # Make protobuf_generate_cpp available

A proper patch would probably just wrap the deleted lines in if statements, switched on a variable (e.g., BINDIFF_ENABLE_IDAPRO). I don't know enough about how cmake works to say how to set that variable based on the presence or absence of the SDK, however.

I have no access to the IDA SDK (downloading it appears to require an IDA Pro license/login)

Yes, but it's interesting that they publish the full Doxygen docs with full function prototypes. Extracting this and building a compatible/minimal SDK should be possible...

While it may be possible, I'm not sure how legal that would be. The Supreme Court's decision in Google LLC v. Oracle America, Inc. didn't resolve the question of the copyrightability of APIs, so building a minimal SDK from the Doxygen docs could constitute infringement.