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

Failed installing IL2C.Runtime.msvc on Unreal Engine produced VC2017 project. #81

Open
kekyo opened this issue Sep 14, 2019 · 16 comments
Open
Labels

Comments

@kekyo
Copy link
Owner

kekyo commented Sep 14, 2019

cause: Cannot reference SubSystem on condition: "%(Link.Subsystem) == "EFI Application""

@kekyo kekyo added the rare label Sep 14, 2019
@kekyo
Copy link
Owner Author

kekyo commented Sep 17, 2019

Related info: 1 day hacking "IL2C on UE4"

@kekyo
Copy link
Owner Author

kekyo commented Sep 17, 2019

@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:

  1. Totally will distribute IL2C.Runtime source codes and (binary precompiled) libraries in zip format or like.
  2. I don't know what integrate in Unreal Engine build process (easier building-packing for UE marketplace), do you have more suggestions?

@ayumax
Copy link

ayumax commented Sep 17, 2019

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.

@kekyo
Copy link
Owner Author

kekyo commented Sep 18, 2019

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

  • Architectures: Win32/x64
  • VC runtime configurations: rts/rtd (static/dynamic. means NOT IL2C, currently not thinking about DLLize (libil2c.dll) because it'll have performance issue)
  • Build configurations: Debug/Release (Debug contains a lot debug assertion for IL2C related code fragments)

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?

@ayumax
Copy link

ayumax commented Sep 18, 2019

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.

https://github.com/ayumax/IL2CTest_OnUE4/blob/8fc000b6cc163e0959aee89bc2590aeeb603edc0/Source/IL2CTest/IL2CTest.Build.cs#L24-L49

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

@kekyo
Copy link
Owner Author

kekyo commented Sep 19, 2019

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?

@ayumax
Copy link

ayumax commented Sep 21, 2019

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.

  • Whole Program Optimization : Yes -> No
    image

@kekyo
Copy link
Owner Author

kekyo commented Sep 21, 2019

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!

@kekyo
Copy link
Owner Author

kekyo commented Sep 23, 2019

@ayumax Published 0.4.93 and made new runtime artifacts zipped file, download from here.

(It doesn't contain annotation for UE4 in README)

@ayumax
Copy link

ayumax commented Sep 24, 2019

Downloaded and added to project.
I was able to confirm that it started with the 64bit setting.

@kekyo
Copy link
Owner Author

kekyo commented Sep 24, 2019

Remains:

@kekyo
Copy link
Owner Author

kekyo commented Oct 2, 2019

@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.

@ayumax
Copy link

ayumax commented Oct 2, 2019

Thank you for teaching me. I'll give it a try. Do I need to call il2c_initialize () and il2c_shutdown () for each thread?

@kekyo
Copy link
Owner Author

kekyo commented Oct 3, 2019

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.

  1. Use System.Threading.Thread. It become from Win32 _beginthreadex() API.
  2. Override runtime implementation named 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.)

@ayumax
Copy link

ayumax commented Oct 3, 2019

OK. We will write the above code at the start and end of the process.

Thank you for the explanation about the thread.

@kekyo
Copy link
Owner Author

kekyo commented May 11, 2022

@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?

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

No branches or pull requests

2 participants