Closed mdluhosch closed 4 weeks ago
I don't even know how you got this far. I can't even generate project files with this thing
@mdluhosch You have to make sure cmake can see your unreal compiler. You should be able to identify the compiler location using cmake options (-DCMAKE_C_COMPILER_TARGET=..., etc...) fed to the add
command via args
bool add(ReadOnlyTargetRules target, ModuleRules rules, string targetName, string targetLocation, string args, bool useSystemCompiler=false)
@Starkium let me know the issue and I might be able to help or catch me on discord.
Also I spent sometime awhile
back, trying to get static builds working https://github.com/caseymcc/UE4CMake/tree/linux_clang. I did get it to work by manually coping all the settings (as everything in the build system is private). However you might be better off setting useSystemCompiler = true
and building a SO.
@mdluhosch You have to make sure cmake can see your unreal compiler. You should be able to identify the compiler location using cmake options (-DCMAKE_C_COMPILER_TARGET=..., etc...) fed to the
add
command viaargs
bool add(ReadOnlyTargetRules target, ModuleRules rules, string targetName, string targetLocation, string args, bool useSystemCompiler=false)
@Starkium let me know the issue and I might be able to help or catch me on discord.
I think it's more than that. I'm trying to get this to work on Unreal 5.4 and it seems like a lot of stuff is either deprecated or just missing an include or something
@caseymcc not sure If we talk about the same thing. I have not an issue anymore. For me static linking with the Unreal Clang is fine. Here is the history of how I made it work:
This did fail as soon as CMake tried to test the C/C++ compiler.
Then I made it work like this:
This already worked and I could link my static library build by Unreals Clang. First I thought nice now I have a solution but then I found it kind of strange that this did not work out of the box because the bool at the end kind of suggests that this should work out of the box. So I came up with the naive patch above.
@mdluhosch I think that will work for most things, however you may run into an issue with crashing if you pass structures through the library interface as unfortunately the default cmake setup that will be generated will not match the same compiler flags that the unreal build is using. which is why at one point I attempted to duplicate the compiler/linker flags from the unreal build system.
Now I see... Yes I agree it seems to be much harder to get all the settings correct. I will close this Issue.
I used the latest main branch as a submodule but it was not able to use the clang from Unreal Engine. I made it work by adding following lines to https://github.com/caseymcc/UE4CMake/blob/main/Source/toolchains/unix_toolchain.in
set(CMAKE_C_COMPILER_TARGET x86_64-unknown-linux) set(CMAKE_CXX_COMPILER_TARGET x86_64-unknown-linux)
With this CMake knows how to invoke the clang and clang++ correctly. Without this the CMake configure step fails as soon as CMake tries to check if the compiler is working.
I am not sure how to generate the correct triple correctly. If you invoke the unreal clang with -print-target-triple then you get "x86_64-unknown-linux-gnu" which unfortunately does not work you need to remove the -gnu.
I am using latest unreal engine (5.4.3)