pok3r-custom / pok3r_re_firmware

Reverse engineering project for the POK3R and related keyboards.
219 stars 17 forks source link

Error making pok3rtool #5

Closed sonph closed 7 years ago

sonph commented 7 years ago

Nice work you're doing here! I'm having trouble compiling the pok3rtool if you could help me out.

code/pok3r_re_firmware % make pok3rtool
[  4%] Built target rawhid
[ 88%] Built target chaos
[ 91%] Linking CXX executable pok3rtool
Undefined symbols for architecture x86_64:
  "LibChaos::ZArray<LibChaos::ZAssoc<LibChaos::ZString, LibChaos::ZString>::Data>::operator[](unsigned long long) const", referenced from:
      LibChaos::ZAssoc<LibChaos::ZString, LibChaos::ZString>::key(unsigned long long) const in libchaos.a(zstring.cpp.o)
      LibChaos::ZAssoc<LibChaos::ZString, LibChaos::ZString>::at(unsigned long long) const in libchaos.a(zstring.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [pok3rtool/pok3rtool] Error 1
make[2]: *** [pok3rtool/CMakeFiles/pok3rtool.dir/all] Error 2
make[1]: *** [pok3rtool/CMakeFiles/pok3rtool.dir/rule] Error 2
make: *** [pok3rtool] Error 2

On a side note the libchaos submodule seems to be out of date and I had to fetch and checkout the latest commit to resolve an error.

pellettiero commented 7 years ago

Hi, just compiled it an hour ago and it works for me, try restarting with a fresh clone and these commands:

$ git submodule update --init
$ cmake .
$ make all

It should build correctly.

Good luck!

sonph commented 7 years ago

Thanks @pellettiero, but still no luck :( I'm compiling on macOS if that matters.

Since it's noted in the wiki that the tool is portable/requires no runtime deps, maybe releasing pre-built binaries is an option?

pellettiero commented 7 years ago

I'm not the owner of the project, but I think it only works on Linux and not macOS because of the different libraries and binaries required.

(Paging @ChaoticConundrum, let's see what he thinks)

sonph commented 7 years ago

I successfully built it in a linux VM, so the error is mac specific. The wiki says that the tool should also runs on windows and mac. I had some problems with libssl (openssl on mac) as well, but was able to resolve those. Tbh I'm a total noob when it comes to compiling C/C++ code.

ChaoticEnigma commented 7 years ago

Hey @sonph, unfortunately, I wasn't unable to reproduce your issue. I was able to build and run pok3rtool on OSX, with "Apple LLVM version 8.0.0 (clang-800-0.38)" for "Target: x86_64-apple-darwin15.6.0" (El Capitan). If your compiler / target is different, it would be good to know.

The two functions that couldn't be linked for you are a little confusing, since I haven't changed or used the ZAssoc class in a long time, and was meaning to remove it. So, I went ahead and just deleted it and fixed all the references to it. The submodule has been updated to the new version.

If you could pull, and git submodule update, please let me know if you still have any issues.

As a side note, I went and built pok3rtool on Windows as well, and libchaos was quite broken there from some recent changes. I've fixed and tested that now. So, thanks for bringing this up!

pellettiero commented 7 years ago

I've sent a pull request to fix the compilation issue: ChaoticConundrum/libchaos#1

sonph commented 7 years ago

I pulled and updated the submodule to d15fc48 I got an error regarding zassoc.h:

% make all

-- snip --

[  6%] Building CXX object pok3rtool/libchaos/chaos/CMakeFiles/chaos.dir/base/zclock.cpp.o
In file included from /tmp/pok3r_re_firmware/pok3rtool/libchaos/chaos/base/zclock.cpp:6:
In file included from /tmp/pok3r_re_firmware/pok3rtool/libchaos/chaos/base/zclock.h:9:
/tmp/pok3r_re_firmware/pok3rtool/libchaos/chaos/string/zstring.h:14:10: fatal error: 'zassoc.h' file
      not found
#include "zassoc.h"
         ^
1 error generated.
make[2]: *** [pok3rtool/libchaos/chaos/CMakeFiles/chaos.dir/base/zclock.cpp.o] Error 1
make[1]: *** [pok3rtool/libchaos/chaos/CMakeFiles/chaos.dir/all] Error 2
make: *** [all] Error 2

Patching ChaoticConundrum/libchaos#1 fixes this and it builds properly. Seems like you're not tracking the right branch/commit?

Anyway, I think that setting up continuous integration would be nice. If you're ok with using travis-ci, I can PR in a basic config file for linux and macos.

ChaoticEnigma commented 7 years ago

Hmm, it looks like I made a mistake somewhere, pok3r/patches and the libchaos submodule should have been at c1a794a as of yesterday. They are both at abab6f8 right now, which includes the same changes as that pull request.

But it looks like either way, removing ZAssoc resolved your issue, although I'm not sure why...

And yea, continuous integration is another thing on the todo list. I've never had users before (much less contributors), so I'm trying to catch up. If you have experience with the configs, I'd be glad to accept.