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

Unity 2019.3 - Missing RegisterMonoModule.h #359

Open
5 tasks done
sp-ivan-hernandez opened this issue Nov 26, 2019 · 11 comments
Open
5 tasks done

Unity 2019.3 - Missing RegisterMonoModule.h #359

sp-ivan-hernandez opened this issue Nov 26, 2019 · 11 comments
Labels

Comments

@sp-ivan-hernandez
Copy link

sp-ivan-hernandez commented Nov 26, 2019

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Unity Editor Version: 2019.3.12b
  • Unity SDK Version: 7.18.0, 7.17.2
  • Installation Platform & Version: [iOS] version 10.0+

Goals

Build for iOS using Unity 2019.3

Expected Results

Successful build

Actual Results

Compilation fails because RegisterMonoModule.h is no longer provided in Unity 2019.3 by design: https://issuetracker.unity3d.com/issues/filenotfoundexception-when-building-a-project-with-facebook-sdk-for-ios

Since the minimum Unity supported version is already 5.4 you could just simply remove the FixUp part related with RegisterMonoModules.cpp and RegisterMonoModules.h i guess and remove the lines 21-27 from the FBUnityInterface.h.

Steps to Reproduce

What are the steps necessary to reproduce this issue?

  1. Create an empty project on 2019.3+
  2. Add FB SDK 7.18.0 or 7.17.2
  3. Try to build for an IOS
@m-kul
Copy link

m-kul commented Dec 14, 2019

Did you find a solution?

@sp-ivan-hernandez
Copy link
Author

Did you find a solution?

Just removing the #include "RegisterMonoModules.h" from the Facebook/FacebookSDK/SDK/Editor/iOS/FBUnityInterface.h and always including the UnityTrampolineConfigure.h worked for us.


The RegisterModules.h it was a file with only a method: void RegisterMonoModules();
In unity 2019.3 the have wisely removed it.

But Facebook SDK is asking for this file just to add a HAS_UNITY_VERSION_DEF if unity is newer than 4.3 xD
https://github.com/facebook/facebook-sdk-for-unity/blob/f76fd1cec1f08a36d90b21c8ab74cba1168f0d84/Facebook.Unity.Editor/iOS/FixupFiles.cs

So, i have also changed the FBUnityInterface.h to always include the UnityTrampolineConfigure.h (to keep the same behaviour that we had).

@wagenheimer
Copy link

I also have this problem!
I removed #include "RegisterMonoModules.h"

But it still fails with /Pods/Headers/Public/FBSDKShareKit/FBSDKShareKit/FBSDKHashtag.h:24:9: Module 'FBSDKCoreKit' not found

@m-kul
Copy link

m-kul commented Jan 20, 2020

Until Facebook issues an update, the best solution is below amongst the ones I tried:

  • Create an empty RegisterMonoModules.h file
  • Copy this inside 'Unity/..../Trampoline/..' next to FBUnityInterface.h
  • After you successfully build your project, copy it to library in XCode also

That file is useless now but FB SDK is still dependant on it.

@rosen-omnidrone
Copy link

This file is also referenced from the post process script which breaks the post process.

@mahgo
Copy link

mahgo commented Feb 3, 2020

Has anyone come up with a workaround for this yet?

@h3902340
Copy link

h3902340 commented Feb 4, 2020

I have commented up the "#include RegisterModules.h" line, but when I rebuilt the game, it still said that the RegisterModules.h couldn't be found.

@mahgo
Copy link

mahgo commented Feb 4, 2020

@h3902340 This is because one of the dlls has a reference to RegisterModules.h as well.

@h3902340
Copy link

h3902340 commented Feb 7, 2020

Hi, I have just upgrade my Facebook SDK for Unity to 7.18.1, it removed the "#include RegisterModules.h" line, but this line of code is still referencing RegisterMonoModules.h, so the console is stilling complaining about not finding the RegisterMonoModules.h file. Because this line of code is in a dll file, there is no easy workaround to this issue, please fix it as soon as possible.

@sp-ivan-hernandez
Copy link
Author

Local builds were built despite the error, but builds in batchmode failed because of the missing file.

Aside from removing the #include "RegisterMonoModules.h" from the Facebook/FacebookSDK/SDK/Editor/iOS/FBUnityInterface.h and always including the UnityTrampolineConfigure.h.

We are using this workaround to have a fake file:

#if UNITY_2019_3_OR_NEWER

using System.IO;
using UnityEditor;
using UnityEditor.Callbacks;

namespace BuildTools.Editor
{
    public static class TemporaryFacebookFix20193
    {
        [PostProcessBuild(99)]
        static void BeforeFacebookOnPostProcessBuild(BuildTarget target, string pathToBuiltProject)
        {
            if(target != BuildTarget.iOS)
            {
                return;
            }

            var fullPath = Path.Combine(pathToBuiltProject, Path.Combine("Libraries", "RegisterMonoModules.h"));
            if(!File.Exists(fullPath))
            {
                File.Create(fullPath).Close();
            }
        }
    }
}
#endif

@broersma
Copy link

broersma commented Feb 17, 2020

Repeating @h3902340

It seems 177ff89 removed the #include "RegisterMonoModules.h". However the code that depends on RegisterMonoModules.h is still in master:

It also means HAS_UNITY_VERSION_DEF won't ever be defined in FBUnityInterface.h (that define came from the modified RegisterMonoModules.h) so the preprocessor strips this include:

#if HAS_UNITY_VERSION_DEF
#include "UnityTrampolineConfigure.h"
#endif

This file would be included in previous versions of the Facebook SDK for Unity when building for Unity 4.3+. I am not quite sure if this was an intended side effect of 177ff89 (the commit I mentioned above).

Update re HAS_UNITY_VERSION_DEF:
UnityTrampolineConfigure.h is basically a file auto-generated by Unity containing:

#define UNITY_VERSION 201930

// known unity versions
#define UNITY_4_2_0 420
#define UNITY_4_2_1 421
#define UNITY_4_2_2 422
// ---8<---
#define UNITY_2019_1_0 201910
#define UNITY_2019_2_0 201920
#define UNITY_2019_3_0 201930

So it seems #include "UnityTrampolineConfigure.h" and the #ifdef surrounding it can be removed without problems, since UNITY_VERSION is used nowhere in the SDK...

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

7 participants