Open kekyo opened 5 years ago
Related info: 1 day hacking "IL2C on UE4"
@ayumax I found a problem for what failing. We already shared the Unreal Engine 4's vcxproj driven by NMake. Causes using NMake because it doesn't have a lot of lacks MSBuild definitions. In special case for IL2C.Runtime, doesn't define ItemDefinitionGroup/Link/SubSystem...
I feel better methods:
I agree to distribute the source code and library files in zip format.
The method for adding a library to an Unreal Engine C ++ project is to define the include directory and library file path in the * .build.cs file.
build.cs file example https://github.com/ayumax/IL2CTest_OnUE4/blob/3a8020f8ef7423524e09370a4aa1163ea3bea724/Source/IL2CTest/IL2CTest.Build.cs#L13-L25
For this reason, library users can use it by extracting the zip file to an arbitrary folder and then writing it in the above file.
OK, I released new 0.4.90 packages yesterday, please check these package contained items (it's nuget, doesn't zip format):
The runtime libraries matrix naming rules are:
Debug/libil2c-msvc-win-Win32-rtd.lib
I'm thinking about how to locate these items inside zip file. For example:
src/ // IL2C runtime sources
include/ // IL2C runtime includes
lib/ // IL2C binary prebuilt libraries
-- Debug/
----- libil2c-msvc-win-Win32-rtd.lib
----- ...
-- Release/
----- ...
cmake/ // IL2C cmake scripts (not related for Unreal Engine but I wanna place it)
Any other ideas?
I tried 0.4.90 packages and confirmed that it works in 64bit version.
It seems that the library to link can be separated by describing Build.cs as follows.
Therefore, I think that the folder structure of the zip file is good above.
However, an error occurred in the build log for the 0.4.90 packages 32-bit library. I don't know what's wrong. However, since the possibility of using 32 bits is low, I think that the corresponding priority is low.
UATHelper: Packaging (Windows (32-bit)): libil2c-msvc-win-Win32-rtd.lib(Object.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
UATHelper: Packaging (Windows (32-bit)): fatal error C1007: unrecognized flag '-archSSE2' in 'p2'
UATHelper: Packaging (Windows (32-bit)): LINK : fatal error LNK1257: code generation failed
Seems to be strange error for link-time code generation related at: https://stackoverflow.com/questions/26279291/what-causes-linker-warning-msil-netmodule-or-module-compiled-with-gl-found-r Do you know link-time code generation option on Unreal Engine 4 and try to enable it?
Hmm... too complex for prebuilt binary variations when use IL2C by end user...
Edited:
Unrecognized option archSSE2
is strange error too. It's available for VS2017 (on 32bit compilation), enables using x86 SSE2 optimization. But I concern it's just arch:SSE2
not archSSE2
. I feel it's minor bug? I don't know where's declared it... Could you grep it on generated NMake script?
I checked various things, but I didn't know how to set Unreal Engine's link-time code generation option.
I think that the setting items on the following page are build setting items, but I didn't know which setting would solve this problem. . .
When I built a 32-bit static library of IL2C.Runtime with the following settings, this error disappeared. However, it is unknown why this error occurred only in 32 bits. . . It may be a problem on the Unreal Engine side.
Hmm, no problem. I'll not change GL option on 32bit, I agreed you suggested to use 64bit library in Unreal Engine. I'll place a README file inside zip file and write will cause problem to use 32bit library in Unreal Engine. Thank you and wait for next deploy!
@ayumax Published 0.4.93 and made new runtime artifacts zipped file, download from here.
(It doesn't contain annotation for UE4 in README)
Downloaded and added to project. I was able to confirm that it started with the 64bit setting.
Remains:
@ayumax I forgot tell you about how to initialize/shutdown sequence for IL2C runtime. They required call named il2c_initialize() before using IL2C's exported functions and call named il2c_shutdown() after end of using. We could finish first try to implement on UE4 together, it didn't cause any problem because it isn't using any runtime code/objrefs including stackwalking and gc.
Thank you for teaching me. I'll give it a try. Do I need to call il2c_initialize () and il2c_shutdown () for each thread?
No, both functions call only when each first and last runtime execution. (Means often beginning and terminating the process on Windows platform) If you use any threads, IL2C will give two options.
il2c_create_thread__()
.If UE4's threading management has special internal features both beginning/terminating sequence, you have to handle option 2. (You can find what different threading support on IL2C in Linux implementations and Excluded threading support.)
In that case, insert ifdef UE4 or make UE4's depndant code into Platform directory. I recommend you can make UE4's platform codes deriving from windows.[ch] files, and change minimumly difference. (And insert include directive into here.)
OK. We will write the above code at the start and end of the process.
Thank you for the explanation about the thread.
@ayumax Are you still interested in supporting UE4? I have a fully automated native build in #79. This may make the method we were discussing here obsolete (although it should still work at this point).
In order to do a fully automated native build, you will probably need to add a toolchain package for UE4 (or is it UE5 now?). Right now, IL2C.Toolchain.gcc4-mingw32 does this on Windows, but I am planning another package called IL2C.Toolchain.msvc, which will allow you to build with VC if we install it.
As for me, I am very interested in making IL2C work with UE4/5, but I don't have the knowledge of UE4/5 to make the package. So, if you are willing to try to make one, what do you think, we can discuss the necessary information here?
cause:
Cannot reference SubSystem on condition: "%(Link.Subsystem) == "EFI Application""