Linux peripheral.joystick build failure on Arch
#1
I have succefully built Kodi retroplayer 17a2 + game.libretro and gotten genplus/fba to work. Looks really good I must say Smile

But when I try to build peripheral.joystick using a Arch Linux PKGBUILD I put together, I get the following error;
Code:
==> Making package: kodi-addon-peripheral-joystick 20160714.6090a90-1 (Tue  2 Aug 16:44:00 CEST 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating kodi-addon-peripheral-joystick git repo...
Fetching origin
==> Validating source files with sha256sums...
    kodi-addon-peripheral-joystick ... Skipped
==> Extracting sources...
  -> Creating working copy of peripheral.joystick git repo...
Cloning into 'kodi-addon-peripheral-joystick'...
done.
Switched to a new branch 'makepkg'
==> Starting pkgver()...
==> Starting build()...
-- The C compiler identification is GNU 6.1.1
-- The CXX compiler identification is GNU 6.1.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Checking to see if CXX compiler accepts flag -flto
-- Checking to see if CXX compiler accepts flag -flto - yes
-- Found PCRE: /usr/include  
-- Looking for include file syslog.h
-- Looking for include file syslog.h - found
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Checking for module 'sdl2'
--   Found sdl2, version 2.0.4
-- Found Sdl: /usr/include/SDL2  
-- Looking for include file linux/joystick.h
-- Looking for include file linux/joystick.h - found
-- JOYSTICK_VERSION=1.1.0
-- Configuring done
-- Generating done
-- Build files have been written to: /home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick
Scanning dependencies of target peripheral.joystick
[  2%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/api/AnomalousTriggerFilter.cpp.o
[  5%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/api/JoystickInterfaceCallback.cpp.o
[  8%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/addon.cpp.o
[ 10%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/api/JoystickAsync.cpp.o
[ 13%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/api/JoystickManager.cpp.o
[ 16%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/api/Joystick.cpp.o
[ 18%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/api/JoystickTranslator.cpp.o
[ 21%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/api/PeripheralScanner.cpp.o
[ 24%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/DirectoryCache.cpp.o
[ 27%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/DirectoryUtils.cpp.o
[ 29%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/Filesystem.cpp.o
[ 32%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/FileUtils.cpp.o
[ 35%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/generic/ReadableFile.cpp.o
[ 37%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/generic/SeekableFile.cpp.o
[ 40%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/vfs/VFSDirectoryUtils.cpp.o
[ 43%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/filesystem/vfs/VFSFileUtils.cpp.o
[ 45%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/log/Log.cpp.o
[ 48%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/log/LogAddon.cpp.o
[ 51%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/log/LogConsole.cpp.o
[ 54%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/ButtonMap.cpp.o
[ 56%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/settings/Settings.cpp.o
[ 59%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/ButtonMapTranslator.cpp.o
[ 62%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/Device.cpp.o
[ 64%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/JustABunchOfFiles.cpp.o
[ 67%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/StorageManager.cpp.o
[ 70%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/StorageUtils.cpp.o
[ 72%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/api/DatabaseJoystickAPI.cpp.o
[ 75%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/xml/ButtonMapXml.cpp.o
/home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.cpp: In static member function ‘static ADDON::DriverPrimitive JOYSTICK::ButtonMapTranslator::ToDriverPrimitive(const string&)’:
/home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.cpp:77:73: error: no matching function for call to ‘ADDON::DriverPrimitive::DriverPrimitive(int)’
       primitive = ADDON::DriverPrimitive(std::atoi(strPrimitive.c_str()));
                                                                         ^
In file included from /home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.h:22:0,
                 from /home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.cpp:21:
/usr/include/kodi/kodi_peripheral_utils.hpp:436:5: note: candidate: ADDON::DriverPrimitive::DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE&)
     DriverPrimitive(const JOYSTICK_DRIVER_PRIMITIVE& primitive) :
     ^~~~~~~~~~~~~~~
/usr/include/kodi/kodi_peripheral_utils.hpp:436:5: note:   no known conversion for argument 1 from ‘int’ to ‘const JOYSTICK_DRIVER_PRIMITIVE&’
/usr/include/kodi/kodi_peripheral_utils.hpp:420:5: note: candidate: ADDON::DriverPrimitive::DriverPrimitive(unsigned int, JOYSTICK_DRIVER_SEMIAXIS_DIRECTION)
     DriverPrimitive(unsigned int axisIndex, JOYSTICK_DRIVER_SEMIAXIS_DIRECTION direction) :
     ^~~~~~~~~~~~~~~
/usr/include/kodi/kodi_peripheral_utils.hpp:420:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/kodi/kodi_peripheral_utils.hpp:408:5: note: candidate: ADDON::DriverPrimitive::DriverPrimitive(unsigned int, JOYSTICK_DRIVER_HAT_DIRECTION)
     DriverPrimitive(unsigned int hatIndex, JOYSTICK_DRIVER_HAT_DIRECTION direction) :
     ^~~~~~~~~~~~~~~
/usr/include/kodi/kodi_peripheral_utils.hpp:408:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/kodi/kodi_peripheral_utils.hpp:388:5: note: candidate: ADDON::DriverPrimitive::DriverPrimitive()
     DriverPrimitive(void) :
     ^~~~~~~~~~~~~~~
/usr/include/kodi/kodi_peripheral_utils.hpp:388:5: note:   candidate expects 0 arguments, 1 provided
/usr/include/kodi/kodi_peripheral_utils.hpp:376:5: note: candidate: ADDON::DriverPrimitive::DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE, unsigned int)
     DriverPrimitive(JOYSTICK_DRIVER_PRIMITIVE_TYPE type, unsigned int driverIndex) :
     ^~~~~~~~~~~~~~~
/usr/include/kodi/kodi_peripheral_utils.hpp:376:5: note:   candidate expects 2 arguments, 1 provided
/usr/include/kodi/kodi_peripheral_utils.hpp:370:10: note: candidate: constexpr ADDON::DriverPrimitive::DriverPrimitive(const ADDON::DriverPrimitive&)
   struct DriverPrimitive
          ^~~~~~~~~~~~~~~
/usr/include/kodi/kodi_peripheral_utils.hpp:370:10: note:   no known conversion for argument 1 from ‘int’ to ‘const ADDON::DriverPrimitive&’
/usr/include/kodi/kodi_peripheral_utils.hpp:370:10: note: candidate: constexpr ADDON::DriverPrimitive::DriverPrimitive(ADDON::DriverPrimitive&&)
/usr/include/kodi/kodi_peripheral_utils.hpp:370:10: note:   no known conversion for argument 1 from ‘int’ to ‘ADDON::DriverPrimitive&&’
make[2]: *** [CMakeFiles/peripheral.joystick.dir/build.make:567: CMakeFiles/peripheral.joystick.dir/src/storage/ButtonMapTranslator.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/peripheral.joystick.dir/all] Error 2
make: *** [Makefile:150: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...

Anyone got any ideas?
Reply
#2
gcc6 enables c++11 by default, which probably didn't happen before. c++11 implies among other things no implicit cast from int to an enum -> you need to cast that the int to the enum type explicitly.

Code:
primitive = ADDON::DriverPrimitive(static_cast<JOYSTICK_DRIVER_PRIMITIVE>(atoi(strPrimitive.c_str()));

and no cookie to garbear for relying on implicit casts.
Reply
#3
(2016-08-03, 08:27)ironic_monkey Wrote: gcc6 enables c++11 by default, which probably didn't happen before. c++11 implies among other things no implicit cast from int to an enum -> you need to cast that the int to the enum type explicitly.

Code:
primitive = ADDON::DriverPrimitive(static_cast<JOYSTICK_DRIVER_PRIMITIVE>(atoi(strPrimitive.c_str()));

and no cookie to garbear for relying on implicit casts.

I added the cast, but it still errors in the same place.

Code:
[ 75%] Building CXX object CMakeFiles/peripheral.joystick.dir/src/storage/xml/ButtonMapXml.cpp.o
/usr/bin/c++   -DBUILD_KODI_ADDON -DHAVE_LINUX_JOYSTICK -DHAVE_SDL -Dperipheral_joystick_EXPORTS -I/home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src -I/usr/include/kodi -I/usr/include/p8-platform -I/usr/include/SDL2  -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong --param=ssp-buffer-size=4 -flto -O3 -DNDEBUG -fPIC   -DTARGET_POSIX -DTARGET_LINUX -D_LINUX -o CMakeFiles/peripheral.joystick.dir/src/storage/xml/ButtonMapXml.cpp.o -c /home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/xml/ButtonMapXml.cpp
/home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.cpp: In static member function ‘static ADDON::DriverPrimitive JOYSTICK::ButtonMapTranslator::ToDriverPrimitive(const string&)’:
/home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.cpp:77:112: error: no matching function for call to ‘JOYSTICK_DRIVER_PRIMITIVE::JOYSTICK_DRIVER_PRIMITIVE(int)’
       primitive = ADDON::DriverPrimitive(static_cast<JOYSTICK_DRIVER_PRIMITIVE>(std::atoi(strPrimitive.c_str())));
                                                                                                                ^
In file included from /usr/include/kodi/kodi_peripheral_utils.hpp:22:0,
                 from /home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.h:22,
                 from /home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick/src/storage/ButtonMapTranslator.cpp:21:
/usr/include/kodi/kodi_peripheral_types.h:232:18: note: candidate: JOYSTICK_DRIVER_PRIMITIVE::JOYSTICK_DRIVER_PRIMITIVE()
   typedef struct JOYSTICK_DRIVER_PRIMITIVE
                  ^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/kodi/kodi_peripheral_types.h:232:18: note:   candidate expects 0 arguments, 1 provided
/usr/include/kodi/kodi_peripheral_types.h:232:18: note: candidate: constexpr JOYSTICK_DRIVER_PRIMITIVE::JOYSTICK_DRIVER_PRIMITIVE(const JOYSTICK_DRIVER_PRIMITIVE&)
/usr/include/kodi/kodi_peripheral_types.h:232:18: note:   no known conversion for argument 1 from ‘int’ to ‘const JOYSTICK_DRIVER_PRIMITIVE&’
/usr/include/kodi/kodi_peripheral_types.h:232:18: note: candidate: constexpr JOYSTICK_DRIVER_PRIMITIVE::JOYSTICK_DRIVER_PRIMITIVE(JOYSTICK_DRIVER_PRIMITIVE&&)
/usr/include/kodi/kodi_peripheral_types.h:232:18: note:   no known conversion for argument 1 from ‘int’ to ‘JOYSTICK_DRIVER_PRIMITIVE&&’
make[2]: *** [CMakeFiles/peripheral.joystick.dir/build.make:567: CMakeFiles/peripheral.joystick.dir/src/storage/ButtonMapTranslator.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[2]: Leaving directory '/home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick'
make[1]: *** [CMakeFiles/Makefile2:100: CMakeFiles/peripheral.joystick.dir/all] Error 2
make[1]: Leaving directory '/home/onarch/packges/kodi-addon-peripheral-joystick/src/kodi-addon-peripheral-joystick'
make: *** [Makefile:150: all] Error 2
==> ERROR: A failure occurred in build().
    Aborting...
Reply
#4
ok, got a bit further now.

Seems like the retroplayer branch and #aaa7bfcee10 is missing the following piece of code:
Code:
+   /*!
+    * \brief Construct a driver primitive representing a button
+    */
+    DriverPrimitive(unsigned int buttonIndex) :
+      m_type(JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON),
+      m_driverIndex(buttonIndex),
+      m_hatDirection(JOYSTICK_DRIVER_HAT_UNKNOWN),
+      m_semiAxisDirection(JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN)
+    {
+    }
+

Note that this piece of code exist upstream in Kodi master so it is a bit strange it is missing from the retroplayer branch. Maybe something went wrong when the retroplayer branch was rebase/merged onto the master branch(?).

Anyhow after patching in this code I get peripheral.joystick to at least build, but this may not be the whole story.


When I try to setup controllers in Kodi I get the following message:
Joystick support not found
Controller configuration is disabled. Install the proper joystick support add-on.

Looking in the log I find the following messages:
Code:
16:26:35 T:140103278762048   DEBUG: Add-on bus: Registering add-on peripheral.joystick
16:26:35 T:140103278762048   DEBUG: PERIPHERAL - CreateAddon - creating peripheral add-on instance 'Joystick Support'
16:26:35 T:140103278762048   DEBUG: ADDON: Dll Initializing - Joystick Support
16:26:35 T:140103278762048   DEBUG: SECTION:LoadDLL(/usr/lib/kodi/addons/peripheral.joystick/peripheral.joystick.so.1.1.0)
16:26:35 T:140103278762048   DEBUG: Loading: /usr/lib/kodi/addons/peripheral.joystick/peripheral.joystick.so.1.1.0
16:26:35 T:140103278762048   ERROR: Unable to load /usr/lib/kodi/addons/peripheral.joystick/peripheral.joystick.so.1.1.0, reason: /usr/lib/kodi/addons/peripheral.joystick/peripheral.joystick.so.1.1.0: undefined symbol: PowerOffJoystick

So more stuff is missing, I guess...

Is peripheral.joystick master branch suppose to work with retroplayer or is there a special branch I have to use?
Reply
#5
(2016-08-04, 16:46)onarch Wrote: Is peripheral.joystick master branch suppose to work with retroplayer or is there a special branch I have to use?

Answering my own question:

Yes, there is a separate branch and its called 'retroplayer'. DUH

Everything seems to build and work here now.
Reply
#6
Sorry I didn't see this two days ago, the forum doesn't notify me of new threads, only replies to existing threads. Feel free to open an issue on github, I'll see that within seconds Smile

RetroPlayer includes the rumble support from PR9663. PR9663 breaks ABI by adding rumble support, so both PR9663 and RetroPlayer need to be built against the 'retroplayer' peripheral.joystick branch.

Glad you figured this out, if you have any other questions post them here.
Reply

Logout Mark Read Team Forum Stats Members Help
peripheral.joystick build failure on Arch0