Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How to link Linux libraries like udev?

I'm writing some C++ code that uses udev library available on Ubuntu 16.04. If I was writing standalone executable I can link my code by ether specifying -ludev option to GCC or using following line in CMakeLists.txt:

 target_link_libraries(MyExecutable udev)

How do I do this in Unreal build system? The problem is that I can't use PublicAdditionalLibraries in Build.cs because the file name for Linux libraries like udev could be libudev.1.so or something like that which is system dependent wich why GCC option -ludev exists.

Background info: The reason I'm using udev is to get joystick vendor ID which seems to be the only viable way in Linux. The reason I'm getting in to this at all is because Unreal doesn't support DirectInput based joysticks like flight RCs :(.

Product Version: UE 4.17
more ▼

asked Sep 04 '17 at 08:30 PM in Linux

avatar image

251 17 31 47

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first


You should be able to use PublicAdditionalLibraries.Add("udev") as this will pass -ludev to the linker in the UBT toolchain. This is how Core.Build.cs links in dlopen for example.

Also as a note to your reasoning for using udev directly; UE4 uses SDL for the input backend (which uses udev and evdev internally) and therefore it should be able to be updated to support your joystick without needing to use udev in the engine code. There are essentially two ways you can do this:

  1. Map the joystick to an xinput (XBox) style controller using the SDL GameController mappings.
    1. One way is mapping the joystick can be done is through the functions https://wiki.libsdl.org/SDL_GameControllerMapping

    2. Another way is passing in the mappings as an environment variable SDL_GAMECONTROLLERCONFIG.

    3. Finally you can also find a community crowd source database of input mappings here https://github.com/gabomdq/SDL_GameControllerDB and then (as directed in the readme) use SDL_GameControllerAddMappingsFromFile.

  2. Add in your own SDL_Joystick code into LinuxApplication.cpp and use this code path if SDL_IsGameController returns false.

more ▼

answered Dec 15 '17 at 12:31 PM

avatar image

0x414e54 STAFF
66 2 4 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question