JibbSmart / JoyShockMapper

A tool for PC gamers to play games with DualShock 4, DualSense, JoyCon, and Switch Pro Controllers. Gyro aiming, flick stick.
Other
786 stars 67 forks source link

Fails to Compile on Arch Linux with Clang++ v10.0.1 #92

Open gardotd426 opened 4 years ago

gardotd426 commented 4 years ago

Tried building both completely manually as well as using the AUR package (which just runs the same commands, essentially), both fail with a bunch of warnings and errors. Here's the full output (edit: also included as text file in comment below):

==> Starting build()...
-- The CXX compiler identification is Clang 10.0.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking for one of the modules 'gtk+-3.0'
-- Checking for one of the modules 'appindicator3-0.1'
-- Checking for one of the modules 'libevdev'
-- JSM version is v1.6.1-97
-- CPM: adding package JoyShockLibrary@1.2.1 (v1.2.1)
-- Checking for one of the modules 'hidapi-hidraw'
-- CPM: adding package magic_enum@0.6.6 (v0.6.6)
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/build
Scanning dependencies of target JoyShockLibrary
[  9%] Building CXX object _deps/joyshocklibrary-build/JoyShockLibrary/CMakeFiles/JoyShockLibrary.dir/JoyShockLibrary.cpp.o
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/build/_deps/joyshocklibrary-src/JoyShockLibrary/JoyShockLibrary.cpp:62:41: warning: format specifies type 'int' but the argument has type 'hid_device *' (aka 'hid_device_ *') [-Wformat]
                                printf("Controller %d timed out\n", jc->handle);
                                                   ~~               ^~~~~~~~~~
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/build/_deps/joyshocklibrary-src/JoyShockLibrary/JoyShockLibrary.cpp:76:61: warning: format specifies type 'int' but the argument has type 'hid_device *' (aka 'hid_device_ *') [-Wformat]
                                                printf("Attempting to re-initialise controller %d\n", jc->handle);
                                                                                               ~~     ^~~~~~~~~~
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/build/_deps/joyshocklibrary-src/JoyShockLibrary/JoyShockLibrary.cpp:84:61: warning: format specifies type 'int' but the argument has type 'hid_device *' (aka 'hid_device_ *') [-Wformat]
                                                printf("Attempting to re-initialise controller %d\n", jc->handle);
                                                                                               ~~     ^~~~~~~~~~
3 warnings generated.
[ 18%] Linking CXX static library libJoyShockLibrary.a
[ 18%] Built target JoyShockLibrary
Scanning dependencies of target JoyShockMapper
[ 45%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/main.cpp.o
[ 45%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/operators.cpp.o
[ 45%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/CmdRegistry.cpp.o
[ 54%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/linux/Whitelister.cpp.o
[ 90%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/linux/Init.cpp.o
[ 90%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/linux/PlatformDefinitions.cpp.o
[ 90%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/linux/InputHelpers.cpp.o
[ 90%] Building CXX object JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/linux/StatusNotifierItem.cpp.o
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/linux/PlatformDefinitions.cpp:13:13: error: redefinition of 'AUTOLOAD_FOLDER' as different kind of symbol
const char *AUTOLOAD_FOLDER = [] {
            ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/include/PlatformDefinitions.h:106:20: note: previous definition is here
extern const char *AUTOLOAD_FOLDER();
                   ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/linux/PlatformDefinitions.cpp:30:13: error: redefinition of 'GYRO_CONFIGS_FOLDER' as different kind of symbol
const char *GYRO_CONFIGS_FOLDER = [] {
            ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/include/PlatformDefinitions.h:107:20: note: previous definition is here
extern const char *GYRO_CONFIGS_FOLDER();
                   ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/linux/PlatformDefinitions.cpp:47:13: error: redefinition of 'BASE_JSM_CONFIG_FOLDER' as different kind of symbol
const char *BASE_JSM_CONFIG_FOLDER = [] {
            ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/include/PlatformDefinitions.h:108:20: note: previous definition is here
extern const char *BASE_JSM_CONFIG_FOLDER();
                   ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/linux/PlatformDefinitions.cpp:76:15: error: out-of-line definition of 'nameToKey' does not match any declaration in 'KeyCode'
WORD KeyCode::nameToKey(const std::string &name)
              ^~~~~~~~~
4 errors generated.
make[2]: *** [JoyShockMapper/CMakeFiles/JoyShockMapper.dir/build.make:147: JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/linux/PlatformDefinitions.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/linux/InputHelpers.cpp:701:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        ::system("xdg-open https://github.com/JibbSmart/JoyShockMapper/blob/master/README.md");
        ^~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:174:10: error: no matching conversion for functional-style cast from 'const char [100]' to 'std::exception'
                        throw exception("ChordStack should always include ButtonID::NONE, for the chorded variable to return the base value.");
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/exception.h:66:5: note: candidate constructor not viable: no known conversion from 'const char [100]' to 'const std::exception' for 1st argument
    exception(const exception&) = default;
    ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/exception.h:68:5: note: candidate constructor not viable: no known conversion from 'const char [100]' to 'std::exception' for 1st argument
    exception(exception&&) = default;
    ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/bits/exception.h:63:5: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
    exception() _GLIBCXX_NOTHROW { }
    ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:365:11: warning: enumeration values 'OnTurbo', 'OnTapRelease', and 'INVALID' not handled in switch [-Wswitch]
                switch (evt)
                        ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:442:10: warning: enumeration value 'None' not handled in switch [-Wswitch]
        switch (actMod)
                ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:470:35: error: second argument to 'va_arg' is of non-POD type 'OnEventAction' (aka 'function<void (DigitalButton *)>') [-Wnon-pod-varargs]
                auto action = va_arg(arguments, OnEventAction);
                                                ^~~~~~~~~~~~~
/usr/lib/clang/10.0.1/include/stdarg.h:19:50: note: expanded from macro 'va_arg'
#define va_arg(ap, type)    __builtin_va_arg(ap, type)
                                                 ^~~~
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:494:11: warning: 15 enumeration values not handled in switch: 'INVALID', 'NONE', 'LUP'... [-Wswitch]
                switch (index) {
                        ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:600:12: warning: 49 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
                        switch (index) {
                                ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:653:12: warning: 32 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
                        switch (index)
                                ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:753:12: warning: 56 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_THRESHOLD', 'MAX_GYRO_THRESHOLD'... [-Wswitch]
                        switch (index)
                                ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:1911:10: warning: enumeration value 'INVALID' not handled in switch [-Wswitch]
        switch (gyro.ignore_mode) {
                ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:600:12: warning: 49 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
                        switch (index) {
                                ^
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:600:12: warning: 49 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:600:12: warning: 49 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:600:12: warning: 49 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:600:12: warning: 49 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:600:12: warning: 49 enumeration values not handled in switch: 'INVALID', 'MIN_GYRO_SENS', 'MAX_GYRO_SENS'... [-Wswitch]
13 warnings and 2 errors generated.
make[2]: *** [JoyShockMapper/CMakeFiles/JoyShockMapper.dir/build.make:82: JoyShockMapper/CMakeFiles/JoyShockMapper.dir/src/main.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:172: JoyShockMapper/CMakeFiles/JoyShockMapper.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

I definitely have all the dependencies required.

Arch Linux Kernel 5.8.1 (as well as 5.7.15) Ryzen 7 3800X Clang++ 10.0.1

gardotd426 commented 4 years ago

Sorry, I realize now that text is really hard to read. Here it is in a file:

joyshockerrors.txt

Obviously it seems the relevant errors are

/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:470:35: error: second argument to 'va_arg' is of non-POD type 'OnEventAction' (aka 'function<void (DigitalButton *)>') [-Wnon-pod-varargs]
                auto action = va_arg(arguments, OnEventAction);
                                                ^~~~~~~~~~~~~

and

/tmp/makepkg/joyshockmapper-git/src/JoyShockMapper/JoyShockMapper/src/main.cpp:174:10: error: no matching conversion for functional-style cast from 'const char [100]' to 'std::exception'
                        throw exception("ChordStack should always include ButtonID::NONE, for the chorded variable to return the base value.");
                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

there are also 13 warnings, but those are the two errors.

StripedMonkey commented 4 years ago

Same issue, Arch w/ clang v10.0.1

Electronicks commented 4 years ago

I'm getting some refactoring done Windows side, a few of them affecting (i.e. breaking) the linux build, Such as the macros found in PlatformDefinition.h. We have a contributor looking at maintaining the Linux build, but feel free to contribute yourself. Contributors are syncing on the GyroGaming discord in a private channel. Just ask to be added.

platyple commented 3 years ago

for reference, another error that tends to pop up is /JoyShockMapper/src/main.cpp:2837:30: error: use of undeclared identifier 'cmdLine'

Yamakaky commented 3 years ago

Did you consider adding a github CI build? That would help catch these errors earlier.

TauAkiou commented 3 years ago

I've been working on fixing JSM for Linux, and here are the changes I've come up with so far: https://github.com/TauAkiou/JoyShockMapper

The fixes have worked so far for me, but I'd like to see some additional reports from others before creating a PR.

sjuxax commented 3 years ago

@TauAkiou that branch builds but crashes on startup when a DualShock 4 is plugged in. Here's the backtrace:

Stack trace of thread 3158286:
#0  0x00007fa37f0f059a hid_write (libhidapi-hidraw.so.0 + 0x359a)
#1  0x000055d24eb114fc _ZN8JoyShockC2EP15hid_device_infoi (JoyShockMapper + 0x9c4fc)
#2  0x000055d24eb0cf56 JslConnectDevices (JoyShockMapper + 0x97f56)
#3  0x000055d24ea8d3d4 _Z14connectDevicesv (JoyShockMapper + 0x183d4)
#4  0x000055d24ea95571 main (JoyShockMapper + 0x20571)
#5  0x00007fa37ec0f152 __libc_start_main (libc.so.6 + 0x28152)
#6  0x000055d24ea89eae _start (JoyShockMapper + 0x14eae)

EDIT: Actually it also crashes when nothing is plugged in:

(gdb) bt
#0  0x0000555555656f90 in  ()
#1  0x00005555555e9340 in std::function<void ()>::operator()() const (this=0x7fffffffc210) at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/std_function.h:622
#2  StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0::operator()() const (this=0x555555662048) at /usr/src/debug/JoyShockMapper/JoyShockMapper/src/linux/StatusNotifierItem.cpp:29
#3  std::__invoke_impl<void, StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0>(std::__invoke_other, StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0&&) (__f=...)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/invoke.h:60
#4  std::__invoke<StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0>(StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0&&) (__fn=...)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/bits/invoke.h:95
#5  std::thread::_Invoker<std::tuple<StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0> >::_M_invoke<0ul>(std::_Index_tuple<0ul>) (this=0x555555662048)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/thread:264
#6  std::thread::_Invoker<std::tuple<StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0> >::operator()() (this=0x555555662048)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/thread:271
#7  std::thread::_State_impl<std::thread::_Invoker<std::tuple<StatusNotifierItem::StatusNotifierItem(void*, std::function<void ()>&&)::$_0> > >::_M_run() (this=0x555555662040)
at /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.2.0/../../../../include/c++/10.2.0/thread:215
#8  0x00007ffff748dc24 in std::execute_native_thread_routine(void*) (__p=0x555555662040) at /build/gcc/src/gcc/libstdc++-v3/src/c++11/thread.cc:80
#9  0x00007ffff75b33e9 in start_thread () at /usr/lib/libpthread.so.0
#10 0x00007ffff7195293 in clone () at /usr/lib/libc.so.6

May be because I'm trying to use a remote X server, etc. Will check next time I get a chance to attach a monitor to it.

TauAkiou commented 3 years ago

@sjuxax Keep in mind that it might also crash if you don't have read/write access to hidraw devices.

Try making a new udev rule in /etc/udev/rules.d and see if it changes anything (you will have to add your user to the plugdev group if it exists)

Here's the one I use: KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"