Closed popey closed 3 years ago
Hi! It's possible that Ubuntu has an older version of capstone than the one I'm using. It builds fine with Capstone 4.0.2 on Arch linux as well as on mingw. I'll add the version requirement to the cmake script
Thanks for the quick reply! Yes, Ubuntu has capstone 3.x, so I guess I'll try building a newer one from source to fulfil that. Cheers!
Had the same issues on Ubuntu. Posting here so hopefully helps other folks compiling on Ubuntu.
find_package(Python 3.8 COMPONENTS Interpreter Development)
CC="gcc-10" CXX="g++-10" cmake ..
to fix the fatal error: concepts: No such file or directory 6 | #include <concepts>
Now stuck at /usr/bin/ld: cannot find -lLLVMDemangle
. llvm is installed but guessing I'm not using a new enough version.
[ 88%] Building CXX object CMakeFiles/ImHex.dir/libs/ImGui/source/imgui_demo.cpp.o
[ 91%] Building CXX object CMakeFiles/ImHex.dir/libs/ImGui/source/imgui_impl_opengl3.cpp.o
[ 94%] Building CXX object CMakeFiles/ImHex.dir/libs/ImGui/source/ImGuiFileBrowser.cpp.o
[ 97%] Building CXX object CMakeFiles/ImHex.dir/libs/ImGui/source/TextEditor.cpp.o
In file included from <redated>/opt/ImHex/source/lang/parser.cpp:3:
<redated>/opt/ImHex/include/helpers/utils.hpp: In instantiation of ‘std::string hex::format(const string&, Args ...) [with Args = {}; std::string = std::__cxx11::basic_string<char>]’:
<redated>/opt/ImHex/source/lang/parser.cpp:300:87: required from here
<redated>/opt/ImHex/include/helpers/utils.hpp:25:32: warning: format not a string literal and no format arguments [-Wformat-security]
25 | ssize_t size = snprintf( nullptr, 0, format.c_str(), args ... );
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<redated>/opt/ImHex/include/helpers/utils.hpp:31:17: warning: format not a string literal and no format arguments [-Wformat-security]
31 | snprintf(buffer.data(), size + 1, format.c_str(), args ...);
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[100%] Linking CXX executable ImHex
/usr/bin/ld: cannot find -lLLVMDemangle
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ImHex.dir/build.make:595: ImHex] Error 1
make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/ImHex.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
It would be nice if this could build with out-of-the-box stuff on Ubuntu 20.04 (as it's a popular LTS), though it requires GCC 10 (Ubuntu has GCC 9) and I had to hack the CMake file to require Python 3.8.5 instead of 3.8.6. Still haven't pulled off a full build. Will keep trying.
@xorhex Neither Debian nor Ubuntu seems to ship LLVMDemangle as a shared library, only a static library. I'm trying to figure out a way to link against the static version instead.
If you change CMakeLists.txt like so, you should be able to build:
target_link_libraries(ImHex libglfw.so libmagic.so libcrypto.so libdl.so libcapstone.so ${LLVM_LIBRARY_DIRS}/libLLVMDemangle.a ${Python_LIBRARIES} nlohmann_json::nlohmann_json)
I haven't tested all the functionality yet, but it compiles and executes.
Ubuntu 20.10 has capstone 4.0.1 which also fails.
Ubuntu 20.10 has capstone 4.0.1 which also fails.
Except, it doesn't really. For reasons I can't figure out, Debian and Ubuntu have packaged 3.0.5 and called it 4.0.1: https://packages.ubuntu.com/groovy/libcapstone3 shows 4.0.1+really+3.0.5-2
as the version string. I've never seen anything like it, but if you look at the source, it really is a 3.0.5 build.
When my projects have dependencies on likely-to-not-be-present packages, I usually make the related functionality optional in the project (e.g. if LLVM demangling is not available, disable demangling via a define from CMake). Could perhaps be a possibility for some of the deps.
So is this issue fixed? I'm having the problem mentioned above on Ubuntu 20.10--the weird updated but not really updated deal.
yes, builds fine for me on a 20.10 box.
I just tried on a fresh install of 20.04.1 and following this thread I'm still getting the "concepts error:
george@Ubuntu-20:~/ImHex/build$ make clean
george@Ubuntu-20:~/ImHex/build$ CC=gcc-10 CXX=g++-10 cmake ..
-- Configuring done
-- Generating done
-- Build files have been written to: /home/george/ImHex/build
george@Ubuntu-20:~/ImHex/build$ make -j 2
[ 5%] Building CXX object CMakeFiles/ImHex.dir/source/window.cpp.o
[ 5%] Building CXX object CMakeFiles/ImHex.dir/source/main.cpp.o
In file included from /home/george/ImHex/source/main.cpp:1:
/home/george/ImHex/include/window.hpp:3:10: fatal error: concepts: No such file or directory
3 | #include <concepts>
| ^~~~~~~~~~
compilation terminated.
In file included from /home/george/ImHex/source/window.cpp:1:
/home/george/ImHex/include/window.hpp:3:10: fatal error: concepts: No such file or directory
3 | #include <concepts>
| ^~~~~~~~~~
compilation terminated.
make[2]: *** [CMakeFiles/ImHex.dir/build.make:63: CMakeFiles/ImHex.dir/source/main.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: *** [CMakeFiles/ImHex.dir/build.make:76: CMakeFiles/ImHex.dir/source/window.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:77: CMakeFiles/ImHex.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
I deleted the cloned directory and started over. I did have capstone downloaded, compiled and installed and I ran CC=gcc-10 CXX=g++-10 cmake ..
and this time it compiled successfully so I'm not sure if it was the capstone, the change in cmake, or just user error.
Hi. Trying to build on a clean VM of Ubuntu 20.04. I'm building the latest stable (and master) and get the same.
I have the following dependencies installed:
Perhaps I'm missing something? Capstone related? The only thing I modified was to bodge it to use Python 3.8.5 rather than the explicitly specified 3.8.6 as Ubuntu doesn't have that. But I don't think that's related.