Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A possible solution to fix building on Linux #5

Open
DKingAlpha opened this issue Dec 17, 2023 · 2 comments
Open

A possible solution to fix building on Linux #5

DKingAlpha opened this issue Dec 17, 2023 · 2 comments

Comments

@DKingAlpha
Copy link

Here is a quick fix to solve issues compiling HIDUE on linux.

Source/HIDUE/HIDUE.Build.cs

using System.IO;


        if (Target.Platform == UnrealTargetPlatform.Linux) {
            File.Copy("/usr/include/libudev.h", ModuleDirectory + "/Private/libudev.h", true);
            PublicSystemLibraries.Add("udev");
            PublicSystemLibraryPaths.AddRange(new [] {
                "/usr/lib"     // only this is needed for linking udev
            });
        }

Consider adding this to Linux.md or HIDUE.Build.cs :)

@microdee
Copy link
Owner

microdee commented Dec 19, 2023

there were already couple of people managing to compile HIDUE on Linux in fact submitted #1 and #2 . This was with 4.27 iirc tho, which Unreal version you tried with? 5.3? What is the exact compile error this would solve?

@DKingAlpha
Copy link
Author

DKingAlpha commented Dec 19, 2023

I am compiling UE 5.3.2 on Arch Linux. This linux distribution does not keep subdirs like x86_64-gnu-linux. All dev headers installed from official repositories are installed to /usr/include.

However x86_64-gnu-linux and other subdirs are not the key point. My point is to remove /usr/include and other host header dirs from PublicIncludePaths.

UE made great efforts to isolate host compile/runtime environments by providing prebuilt binaries and self maintained implementations including libcxx. It seems including /usr/include back are confusing the UE again. (I got glibc and other gnu/llvm headers installed to system /usr/include).

Removing /usr/include from include search path and merely include libudev.h fixed the issue for me. Of course it's better to search libudev.h in multiple possible locations.

Here is the original error output with /usr/include added to include path.

------ Building 9 action(s) started ------
[1/9] Compile Module.HIDUE.cpp
In file included from /run/media/dking/Games/UEProjects/UE4-SpaceMouse/product/SpaceMouse/HostProject/Plugins/SpaceMouse/Intermediate/Build/Linux/x64/UnrealEditor/Development/HIDUE/Module.HIDUE.cpp:2:
In file included from /run/media/dking/Games/UEProjects/UE4-SpaceMouse/product/SpaceMouse/HostProject/Plugins/SpaceMouse/Source/HIDUE/Private/HIDUE.cpp:4:
In file included from /run/media/dking/Games/UEProjects/UE4-SpaceMouse/product/SpaceMouse/HostProject/Plugins/SpaceMouse/Source/HIDUE/Public/HIDUE.h:6:
In file included from Runtime/Core/Public/Modules/ModuleManager.h:5:
In file included from Runtime/Core/Public/Containers/Array.h:7:
In file included from Runtime/Core/Public/Misc/ReverseIterate.h:6:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/iterator:684:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/__iterator/common_iterator.h:22:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/variant:218:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/tuple:227:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/utility:251:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/compare:145:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/__compare/compare_partial_order_fallback.h:13:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/__compare/partial_order.h:14:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/__compare/weak_order.h:14:
In file included from ThirdParty/Unix/LibCxx/include/c++/v1/__compare/strong_order.h:18:
/home/dking/Desktop/UnrealEngine/Engine/Source/ThirdParty/Unix/LibCxx/include/c++/v1/cmath:544:5: error: use of undeclared identifier '__promote'
    __promote<_A1, _A2, _A3>
    ^
/home/dking/Desktop/UnrealEngine/Engine/Source/ThirdParty/Unix/LibCxx/include/c++/v1/cmath:548:22: error: no template named '__promote'
    typedef typename __promote<_A1, _A2, _A3>::type __result_type;
                     ^
/home/dking/Desktop/UnrealEngine/Engine/Source/ThirdParty/Unix/LibCxx/include/c++/v1/cmath:552:12: error: call to 'hypot' is ambiguous
    return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
           ^~~~~
/home/dking/Desktop/UnrealEngine/Engine/Source/ThirdParty/Unix/LibCxx/include/c++/v1/cmath:533:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY float       hypot(       float __x,       float __y,       float __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
                                             ^
/home/dking/Desktop/UnrealEngine/Engine/Source/ThirdParty/Unix/LibCxx/include/c++/v1/cmath:534:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY double      hypot(      double __x,      double __y,      double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
                                             ^
/home/dking/Desktop/UnrealEngine/Engine/Source/ThirdParty/Unix/LibCxx/include/c++/v1/cmath:535:46: note: candidate function
inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double __x, long double __y, long double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
                                             ^
3 errors generated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants