eteran / edb-debugger

edb is a cross-platform AArch32/x86/x86-64 debugger.
GNU General Public License v2.0
2.69k stars 324 forks source link

Failure with obscure error during compile #442

Closed dylib closed 8 years ago

dylib commented 8 years ago

While trying to compile on CentOS 6.5 cmake fails with a vague error:

$ cd build
$ cmake ..
-- Boost version: 1.61.0
-- Checking for module 'capstone>=3.0.4'
--   
CMake Error at /usr/local/share/cmake-3.6/Modules/FindPkgConfig.cmake:424 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/local/share/cmake-3.6/Modules/FindPkgConfig.cmake:597 (_pkg_check_modules_internal)
  CMakeLists.txt:18 (pkg_check_modules)
-- Configuring incomplete, errors occurred!

I've compiled and installed capstone 3.0.4:

Install the project...
-- Install configuration: ""
-- Installing: /usr/local/include/capstone/arm64.h
-- Installing: /usr/local/include/capstone/arm.h
-- Installing: /usr/local/include/capstone/capstone.h
-- Installing: /usr/local/include/capstone/mips.h
-- Installing: /usr/local/include/capstone/ppc.h
-- Installing: /usr/local/include/capstone/x86.h
-- Installing: /usr/local/include/capstone/sparc.h
-- Installing: /usr/local/include/capstone/systemz.h
-- Installing: /usr/local/include/capstone/xcore.h
-- Installing: /usr/local/include/capstone/platform.h
-- Installing: /usr/local/lib/libcapstone.a
-- Installing: /usr/local/lib/libcapstone.so

I'm really unclear as to what the exact issue is and where the failure might be.

10110111 commented 8 years ago

For some reason you appear to have not installed capstone.pc, which is how EDB finds Capstone (via pkg-config). If pkg-config --modversion capstone doesn't tell you the correct version, Capstone is not installed correctly. If you do have the file installed (which I don't see in the log you provided), they you may want to try setting PKG_CONFIG_PATH environment variable before running cmake.

dylib commented 8 years ago

@10110111 : Well that would certainly make some sense, although where do I find capstone.pc and what is the process for installing it correctly? I searched around, although came up empty.

Before I was just following the docs from the capstone documentation, and hoping for the best.

10110111 commented 8 years ago

I've just cloned capstone's v3 branch, and simple make && make DESTDIR=/tmp/cpst install installed the files like this:

mkdir -p /tmp/cpst/usr/lib
install -m0755 ./libcapstone.so /tmp/cpst/usr/lib
cd /tmp/cpst/usr/lib && \
mv libcapstone.so libcapstone.so.3 && \
ln -s libcapstone.so.3 libcapstone.so
install -m0644 ./libcapstone.a /tmp/cpst/usr/lib
mkdir -p /tmp/cpst/usr/include/capstone
install -m0644 include/*.h /tmp/cpst/usr/include/capstone
mkdir -p /tmp/cpst/usr/lib/pkgconfig
install -m0644 ./capstone.pc /tmp/cpst/usr/lib/pkgconfig/

From your output I see you used cmake to build capstone. I guess their CMakeLists.txt has a bug you may want to report. Meanwhile, try the simple make approach I've described above.

dylib commented 8 years ago

Thanks, your tips / information helped ( successfully installed ):

$ pkg-config --modversion capstone
...
Perhaps you should add the directory containing `capstone.pc'
to the PKG_CONFIG_PATH environment variable
No package 'capstone' found
$ PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/tmp/cpst/usr/lib/pkgconfig/
$ echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig:/usr/bin/pkg-config:/tmp/cpst/usr/lib/pkgconfig/
$ make && make DESTDIR=/tmp/cpst install
$ pkg-config --modversion capstone
3.0.4

So now onto the next next issue, which seems to be related to Qt5XmlPatternsConfig.cmake... I'm reinstalling it, but that's another story I guess...

10110111 commented 8 years ago

Yeah, just make sure that you don't consider /tmp/cpst a permanent location: it'll be lost on reboot. I was using it just as a test.