Electronicks / JoyShockMapper

A tool for PC gamers to play games with DualShock 4s, JoyCons, and Pro Controllers. Gyro aiming, flick stick.
Other
343 stars 20 forks source link

Building instructions for Ubuntu 21.10 #54

Open positiveway opened 2 years ago

positiveway commented 2 years ago

For anyone trying to run it on Ubuntu:

Installing dependencies: sudo apt-get install -y libappindicator3-dev gir1.2-appindicator3-0.1 libgtkmm-3.0-dev clang libsdl2-dev libdecoration0 libdrm-dev libhidapi-dev libusb-1.0-0 libgtk-3-dev

Building:

mkdir build && cd build
cmake .. -DCMAKE_CXX_COMPILER=clang++ && cmake --build .

Running: (Requires sudo)

cd ./JoyShockMapper
sudo ./JoyShockMapper
positiveway commented 2 years ago

@Electronicks maybe add this to readme?

TauAkiou commented 2 years ago

let me take a closer look into this and see why the current versions aren't building on Ubuntu.

TauAkiou commented 2 years ago

libdecoration0 is, according to the Ubuntu package manifest, the window decoration library for Compiz, which is not the same as libdecor0.

Ubuntu's current repositories for 21.10 appear to be missing the libdecor-0 package. Building it from source appeared to resolve at least that error, but building fails when cmake is performing some standard checks. I don't know if this is an issue with my VM or with Ubuntu itself, but I've never had this issue on Arch or Fedora.

I would suggest building libdecor-0 from source (https://gitlab.gnome.org/jadahl/libdecor) and trying again.

Additional dependency required: libusb-1.0-0-dev to enable HIDAPI support (else, motion will not work).

If it fails, please post a gist containing the results of './build/CMakeFiles/CMakeError.log'

positiveway commented 2 years ago

@TauAkiou Thank you for replying! I compiled libdecor from source and installed libusb. Compilation progressed much further but failed on some type conversion. I got 2 errors:

JoyShockMapper/src/main.cpp:4038:32: error: no viable conversion from '<overloaded function type>' to 'JSMVariable<AdaptiveTriggerSetting>::FilterDelegate' (aka 'function<AdaptiveTriggerSetting (AdaptiveTriggerSetting, AdaptiveTriggerSetting)>')
        left_trigger_effect.SetFilter(&filterInvalidValue);
JoyShockMapper/src/main.cpp:4039:33: error: no viable conversion from '<overloaded function type>' to 'JSMVariable<AdaptiveTriggerSetting>::FilterDelegate' (aka 'function<AdaptiveTriggerSetting (AdaptiveTriggerSetting, AdaptiveTriggerSetting)>')
        right_trigger_effect.SetFilter(&filterInvalidValue);

Both errors are because of the same reason, just two places in code that use AdaptiveTriggerSetting type. As far as I understand it's used as a base type in template fuction. My guess is it has something to do with overloading types while porting code on Linux.

Attaching the gist

TauAkiou commented 2 years ago

mirror of issue #52

it's a compiler problem that likely doesn't happen on MSVC but does so on GCC/clang.

i have a fix for it which i'll create a PR for later.

TauAkiou commented 2 years ago

The program appeared to build and run properly with the change for me, but some testing on both Windows and Linux is required.

See https://github.com/Electronicks/JoyShockMapper/pull/55 and https://github.com/TauAkiou/JoyShockMapper/tree/linux-fix-master.

positiveway commented 2 years ago

It works now with your fix. Thank you!

positiveway commented 2 years ago

As for dependencies: Forgot to include libevdev-dev

Full command is sudo apt-get install -y libappindicator3-dev gir1.2-appindicator3-0.1 libgtk-3-dev libgtkmm-3.0-dev clang libsdl2-dev libdrm-dev libhidapi-dev libusb-1.0-0 libusb-1.0-0-dev libevdev-dev

Then compile and install libdecor-0 from here sudo apt install -y meson libwayland-dev wayland-protocols libpango1.0-dev libdbus-1-dev libegl-dev libxkbcommon-dev

Download and unpack source code to a folder

meson build --buildtype release
meson install -C build
positiveway commented 2 years ago

Created pull request #56 to include instruction in Readme

Helipil0t commented 2 years ago

@TauAkiou Thank you for replying! I compiled libdecor from source and installed libusb. Compilation progressed much further but failed on some type conversion. I got 2 errors:

JoyShockMapper/src/main.cpp:4038:32: error: no viable conversion from '<overloaded function type>' to 'JSMVariable<AdaptiveTriggerSetting>::FilterDelegate' (aka 'function<AdaptiveTriggerSetting (AdaptiveTriggerSetting, AdaptiveTriggerSetting)>')
        left_trigger_effect.SetFilter(&filterInvalidValue);
JoyShockMapper/src/main.cpp:4039:33: error: no viable conversion from '<overloaded function type>' to 'JSMVariable<AdaptiveTriggerSetting>::FilterDelegate' (aka 'function<AdaptiveTriggerSetting (AdaptiveTriggerSetting, AdaptiveTriggerSetting)>')
        right_trigger_effect.SetFilter(&filterInvalidValue);

Both errors are because of the same reason, just two places in code that use AdaptiveTriggerSetting type. As far as I understand it's used as a base type in template fuction. My guess is it has something to do with overloading types while porting code on Linux.

Attaching the gist

I'm trying to compile on Ubuntu 20.04 using the fix from https://github.com/TauAkiou/JoyShockMapper/tree/linux-fix-master and am getting the same errors.

Helipil0t commented 2 years ago

Ok I'm a bit confused. I pulled from: https://github.com/TauAkiou/JoyShockMapper/tree/linux-fix-master and noticed it did not have the fix in main.cpp at line 4038 and 4039. Did it get pushed?
Anyway, I added the fix from https://github.com/Electronicks/JoyShockMapper/pull/55/commits/1baa81973ac78ab31c3b9370913da0bd50a4900f and it compiles successfully.

TauAkiou commented 2 years ago

if it wasn't there, you may have not actually checked out the linux-fix-master branch.

Electronicks commented 11 months ago

Can this be closed?