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

Compile crosscompile Linux from Windows doesn't work #28

Open
AndreaCatania opened this issue Sep 18, 2024 · 4 comments
Open

Compile crosscompile Linux from Windows doesn't work #28

AndreaCatania opened this issue Sep 18, 2024 · 4 comments

Comments

@AndreaCatania
Copy link
Contributor

Hi, I'm trying to Cross Compile a linux version from Windows. The compilation errors during the linking phase:

ld.lld: warning: C:/..../NetSync.lib: archive member 'NetSync.dir\Release\AbilitiesDB.obj' is neither ET_REL nor LLVM bitcode

Digging more I've noticed that when I launch the compilation, the detected platform is still "Windows" so UE4CMake still uses all the windows compilers causing the libraries to be compiled for Windows instead to be compiled for linux. That's explains why the linker fails with the above error.

Notice, I've tried to delete the Intermediate folder, to ensure that the config files are re-generated, but it didn't solve the issue.

The question is then how can we cross compile for linux, from Windows, using this plugin?

@AndreaCatania
Copy link
Contributor Author

I've been debugging it further and noticed that the Unreal Build Tool runs the configuration three times (still not sure why).

The first time, it sets the target as Win64, and then it runs two more times with Linux as the target.

This causes the Linux binary to never be compiled, as it’s already being compiled during the first execution. I'm trying to follow this comment to fix the issue, but if you have any other suggestions, they would be very welcome.

@AndreaCatania
Copy link
Contributor Author

Here I've created a PR with a change that allows building the project into platform-specific folders: #29

Now the Linux compilation starts, but the unreal toolchain is not properly loaded therefore the compilation fails. Any idea on how to load it?

CMakeTarget load target: NetworkSynchronizer loc:C:\MyProject\Source\FlashFramework\LibraryNetworkSynchronizer\./NetworkSynchronizer/cmake
Loading cmake target: UnrealBuildTool.ReadOnlyTargetRules
Target NetworkSynchronizer CMakeLists.txt out of date, rebuilding
CMakeTarget calling cmake with:  -G "Unix Makefiles"   -S "C:\MyProject\Intermediate\CMakeTarget\NetworkSynchronizer\Linux" -B "C:\MyProject\Intermediate\CMakeTarget\NetworkSynchronizer\Linux\build" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\MyProject\Intermediate\CMakeTarget" -DCMAKE_TOOLCHAIN_FILE="C:\MyProject\Intermediate\CMakeTarget\NetworkSynchronizer\Linux\toolchain.cmake" -T host=x64  -DGENERATE_DEBUG_SYMBOLS=ON  -DENABLE_DEBUG=ON  -DENABLE_DEBUGGER_UI=ON  -DUSE_STATIC_MSVC_RUNTIME_LIBRARY=OFF  -DBUILD_MSVC_MD=ON
Calling: cmd.exe /c cmake.exe -G "Unix Makefiles"   -S "C:\MyProject\Intermediate\CMakeTarget\NetworkSynchronizer\Linux" -B "C:\MyProject\Intermediate\CMakeTarget\NetworkSynchronizer\Linux\build" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="C:\MyProject\Intermediate\CMakeTarget" -DCMAKE_TOOLCHAIN_FILE="C:\MyProject\Intermediate\CMakeTarget\NetworkSynchronizer\Linux\toolchain.cmake" -T host=x64  -DGENERATE_DEBUG_SYMBOLS=ON  -DENABLE_DEBUG=ON  -DENABLE_DEBUGGER_UI=ON  -DUSE_STATIC_MSVC_RUNTIME_LIBRARY=OFF  -DBUILD_MSVC_MD=ON
CMake Error at C:/MyProject/Source/FlashFramework/LibraryNetworkSynchronizer/NetworkSynchronizer/cmake/CMakeLists.txt:2 (project):
  Generator

    Unix Makefiles

  does not support toolset specification, but toolset

    host=x64

  was specified.


CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!


CMake Error at C:/MyProject/Source/FlashFramework/LibraryNetworkSynchronizer/NetworkSynchronizer/cmake/CMakeLists.txt:2 (project):  Generator    Unix Makefiles  does not support toolset specification, but toolset    host=x64  was specified.CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage-- Configuring incomplete, errors occurred!
Cannot configure CMake project. Exited with code: 1
CMakeTarget failed to load target: NetworkSynchronizer

@caseymcc
Copy link
Owner

caseymcc commented Sep 19, 2024

I am out of town till next week and can look at some of this then. There is also a branch tool_chains that is attempting to load the cxx flags from the build tools and inject that into cmake that may also help.

@AndreaCatania
Copy link
Contributor Author

@caseymcc Thanks! At the moment I’ve abandoned the idea of building using the cross-compiler, so I’m trying to compile directly on Linux. I fixed a small issue that was preventing the proper compilation of CMake libraries (#30), and now I’m investigating a problem with the linker. I’m not sure if it’s caused by an issue with the library or the way this plugin compiles the library.

In any case, I would really use some help ti figure it out. Here the error:

0>[1/6] Link (lld) libUnrealEditor-FlashCore.so
0>ld.lld: Error  : undefined symbol: JPH::BodyManager::Draw(JPH::BodyManager::DrawSettings const&, JPH::PhysicsSettings const&, JPH::DebugRenderer*, JPH::BodyDrawFilter const*)
0>>>> referenced by PhysicsSystem.h:133 (/home/andrea/Workspace/FlyingLegends/Source/FlashFramework/LibraryJolt/JoltPhysics/Jolt/Physics/PhysicsSystem.h:133)
0>>>>               /home/andrea/Workspace/FlyingLegends/Intermediate/Build/Linux/x64/UnrealEditor/Development/FlashCore/JoltDebugRenderer.cpp.o:(JoltDebugRendererInternal::Draw(UJoltSettings_DebugRender const&, UJWorld&))

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