unity-jar-resolver icon indicating copy to clipboard operation
unity-jar-resolver copied to clipboard

[Bug] Unable to build from source, MacOS 11.4.

Open JimmyDeemo opened this issue 4 years ago • 12 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2019.4.24f1
  • External Dependency Manager version: Latest
  • Source you installed EDM4U: Trying to build from source
  • Features in External Dependency Manager in use: Android resolver, iOS resolver
  • Plugins SDK in use: N/A
  • Platform you are using the Unity editor on: Mac

[REQUIRED] Please describe the issue here:

I am unable to build from source with a fresh clone of the master branch. I am running MacOS 11.4 and it appears that mono will not execute on this platform. See attached log. Please advise if I am able to build from source using this platform and if not, please can a feature request be added for support? building_resolver.log

Please answer the following, if applicable:

What's the issue repro rate? 100%

What happened? How can we make the problem occur? Fresh clone of the master branch. Navigate to the project directory and execute ./gradlew build --stacktrace --info. Build fails.

JimmyDeemo avatar Aug 25 '21 10:08 JimmyDeemo

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Aug 25 '21 10:08 google-oss-bot

Seems similat to #448.

JimmyDeemo avatar Aug 25 '21 10:08 JimmyDeemo

Hi @JimmyDeemo,

When utilizing the resolver, you can add this in your project by importing the .unitypackagefile or using the Package Manager. In order to identify what's causing this behavior, could you provide the complete steps in replicating this issue?

paulinon avatar Aug 25 '21 11:08 paulinon

Hello @paulinon

I'm not trying to utilise the resolver. I am trying to build from source from my own fork so I can attempt a fix for #427 and possibly contribute to the project.

Building from source is referenced here; https://github.com/googlesamples/unity-jar-resolver#building-from-source. It only says to run .gradlew build which I have done and have found my setup has an error.

Are there more pre-requisites needed? Can I build from source without mono? Please help me to build from source rather than integrating the package. I would be happy to file this issue in another way if that would be helpful.

JimmyDeemo avatar Aug 25 '21 11:08 JimmyDeemo

Thanks for the additional information, @JimmyDeemo. While we identify what's causing the issue, could you confirm if you're running on an M1 Mac?

paulinon avatar Aug 26 '21 16:08 paulinon

I can confirm I am not using an M1 Mac. It is a MacBook Pro. I have tried to run the mono version command manually and get the same error. Perhaps something to do with my Unity installation?

JimmyDeemo avatar Aug 26 '21 21:08 JimmyDeemo

@JimmyDeemo

Thank you for being interested in contributing to EDM4U!

Currently EDM4U requires Unity 2017+ in your desktop to build. You also need to setup the environment variable like the following (in .bashrc or .bash_profile)

export UNITY_EXE="/Applications/Unity/Hub/Editor/2018.4.36f1/Unity.app/Contents/MacOS/Unity"

Based on the log, I believe you got this part covered.

Also, EDM4U build script requires mono executable to build C# code. I did noticed that Unity moved mono to a different folder in Unity 2019.4.28...which is unfortunate.

/Applications/Unity/Hub/Editor/2018.4.36f1/Unity.app/Contents/Mono/bin/mono -V
/Applications/Unity/Hub/Editor/2019.4.28f1/Unity.app/Contents/MonoBleedingEdge/bin/mono -V

This log basically say that it cannot find mono based on MONO_EXE anymore

MONO_EXE: /Applications/Unity/Unity.app/Contents/Mono/bin/mono
Starting process 'command '/Applications/Unity/Unity.app/Contents/Mono/bin/mono''. Working directory: /Users/jamesdeeman/Dev/git/unity-jar-resolver Command: /Applications/Unity/Unity.app/Contents/Mono/bin/mono -V

FAILURE: Build failed with an exception.

EDM4U build script does have logic to find mono and cache it in gradle.properties. I wonder how your gradle.properties ended up cached a wrong value in it.

Any case, could you try to change your MONO_EXE in gradle.properties to the following:

MONO_EXE=/Applications/Unity/Unity.app/Contents/MonoBleedingEdge/bin/mono

Try again and see if builds?

Shawn

chkuang-g avatar Aug 27 '21 00:08 chkuang-g

BTW, just noticed that you need to bump up python version here to 3.9.4 because...

  1. EDM4U build script depends on gradle-python-envs,
  2. gradle-python-envs depends on python-build
  3. And python-build removed definition for 3.9.3

Fun! :(

Side story, this JetBrains plugin is part of the reason why EDM4U does not build on Windows. Perhaps there is a better way to install Python locally to the project or just reuse the existing one. :/

chkuang-g avatar Aug 27 '21 01:08 chkuang-g

Any case, could you try to change your MONO_EXE in gradle.properties to the following:

Please be advised that I do not have a gradle.properties file in the project. This is because the build script fails prior to this line File projectPropertiesFile = new File(scriptDirectory,"gradle.properties"). Therefore nothing is cached. Should I define MONO_EXE via an export similar to what you advised for UNITY_EXE?

BTW, just noticed that you need to bump up python version here to 3.9.4 because...

I will endeavour to update to this version of python.

JimmyDeemo avatar Aug 27 '21 07:08 JimmyDeemo

That is odd.

First of all, could you make sure if /Applications/Unity/Unity.app/Contents/MonoBleedingEdge/bin/mono exists?

Second, could you run with --no-build-cache and --no-daemon? That is, try to run this way:

./gradlew --no-build-cache --no-daemon build

And yes, doing the following shall do as well.

export MONO_EXE=/Applications/Unity/Unity.app/Contents/MonoBleedingEdge/bin/mono

Sorry for the inconvenience. I tried to build with 2019.4.28f1 and did not see any error like yours. I am a bit confused about why it happened as well.

Shawn

chkuang-g avatar Sep 01 '21 00:09 chkuang-g

Yes, that path does indeed exist. Note: The version of mono there is different from the one in the 2019 installation;

▶ /Applications/Unity/Unity.app/Contents/MonoBleedingEdge/bin/mono -V   
Mono JIT compiler version 5.0.1 (unity-2017.4-mbe/10aeba76d03 Mon Oct 22 21:37:46 GMT 2018)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)
                                                                                                     
▶ /Applications/Unity/Hub/Editor/2019.4.24f1/Unity.app/Contents/MonoBleedingEdge/bin/mono -V
Mono JIT compiler version 5.11.0 ((HEAD/90cf2678d79 Fri Feb  5 18:05:48 GMT 2021)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  amd64
	Disabled:      shared_perfcounters
	Misc:          softdebug 
	Interpreter:   yes
	LLVM:          supported, not enabled.
	GC:            sgen (concurrent by default)

Running ./gradlew --no-build-cache --no-daemon build without adding the MONO_EXE export didn't work. I have also tried setting this export with both versions of mono listed above and get a similar error though it does seem to be getting further. I noticed that the gradle.properties file had cached the standard versions too so cleared it such that it would cache the 2019 path but still it didn't build. I have attached logs of both attempts.

Very sorry, I just don't know what is wrong with my setup. Conflicting mono versions perhaps? Gradle issues? I also noticed that the python installed with Homebrew was greater than the version you mentioned, could the build process be using an older version? How would I check that?

build_2019-mono.log build.log

JimmyDeemo avatar Sep 01 '21 08:09 JimmyDeemo

I think the better solution is to add CI build test for EDM4U against different version of Unity from different OS.

Will update once we have something like this.

chkuang-g avatar Oct 10 '22 10:10 chkuang-g