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

problem compiling for android on mac #1452

Closed
teamblubee opened this issue Feb 27, 2015 · 8 comments
Closed

problem compiling for android on mac #1452

teamblubee opened this issue Feb 27, 2015 · 8 comments

Comments

@teamblubee
Copy link
Contributor

When trying to compile godot for android from a mac, mac creates .dylib files that break when you try to load the android app.

A few references on the issue
http://stackoverflow.com/questions/5259249/creating-static-mac-os-x-c-build
http://stackoverflow.com/questions/3304095/how-to-point-scons-to-a-different-compiler-installed-in-my-home-directory

@godotengine
Copy link
Collaborator

help appreciated as i dont have a mac

On Fri, Feb 27, 2015 at 5:56 PM, blubee notifications@github.com wrote:

When trying to compile godot for android from a mac, mac creates .dylib
files that break when you try to load the android app.

A few references on the issue
http://stackoverflow.com/questions/5259249/creating-static-mac-os-x-c-build

http://stackoverflow.com/questions/3304095/how-to-point-scons-to-a-different-compiler-installed-in-my-home-directory


Reply to this email directly or view it on GitHub
#1452.

OkamStudio

@teamblubee
Copy link
Contributor Author

I am researching to see how I can create a static library on mac but any additional help would be appreciated as well.

@reduz
Copy link
Member

reduz commented Feb 27, 2015

ah i think i know the problem...

open platform/android/detect.py

you will see an if:

if env['PLATFORM'] == 'win32':

import methods
env.Tool('gcc')
env['SPAWN'] = methods.win32_spawn
env['SHLIBSUFFIX'] = '.so'

you should add below, i think the following:

if env['PLATFORM'] == 'check which one is for the mac´ :

env['SHLIBSUFFIX'] = '.so'

and it will work

On Fri, Feb 27, 2015 at 5:58 PM, blubee notifications@github.com wrote:

I am researching to see how I can create a static library on mac but any
additional help would be appreciated as well.


Reply to this email directly or view it on GitHub
#1452 (comment).

@punto-
Copy link
Contributor

punto- commented Feb 27, 2015

does it load on android if you rename it to .so?

On Fri, Feb 27, 2015 at 10:04 PM, Juan Linietsky notifications@github.com
wrote:

ah i think i know the problem...

open platform/android/detect.py

you will see an if:

if env['PLATFORM'] == 'win32':

import methods
env.Tool('gcc')
env['SPAWN'] = methods.win32_spawn
env['SHLIBSUFFIX'] = '.so'

you should add below, i think the following:

if env['PLATFORM'] == 'check which one is for the mac´ :

env['SHLIBSUFFIX'] = '.so'

and it will work

On Fri, Feb 27, 2015 at 5:58 PM, blubee notifications@github.com wrote:

I am researching to see how I can create a static library on mac but any
additional help would be appreciated as well.


Reply to this email directly or view it on GitHub
#1452 (comment).


Reply to this email directly or view it on GitHub
#1452 (comment).

@teamblubee
Copy link
Contributor Author

Updating the code in detect.py the filename comes out as .so but still getting crash on android.

Brother:bin blubee$ otool -L libgodot.android.opt.debug.so
libgodot.android.opt.debug.so: is not an object file

Output
I/ActivityManager( 2266): START u0 {act=android.intent.action.MAIN flg=0x10000000 cmp=com.android.noname/com.android.godot.Godot} from pid 21939
D/AndroidRuntime(21939): Shutting down VM
V/Zygote (21951): Switching descriptor 32 to /dev/null
V/Zygote (21951): Switching descriptor 9 to /dev/null
I/ActivityManager( 2266): Start proc com.android.noname for activity com.android.noname/com.android.godot.Godot: pid=21951 uid=10222 gids={50222}
D/ActivityThread(21951): handleBindApplication:com.android.noname
D/ActivityThread(21951): setTargetHeapUtilization:0.75
D/ActivityThread(21951): setTargetHeapMinFree:2097152
D/GODOT (21951): ** GODOT ACTIVITY CREATED HERE ***
W/System.err(21951): java.io.FileNotFoundException: cl
W/System.err(21951): at android.content.res.AssetManager.openAsset(Native Method)
W/System.err(21951): at android.content.res.AssetManager.open(AssetManager.java:335)
W/System.err(21951): at android.content.res.AssetManager.open(AssetManager.java:309)
W/System.err(21951): at com.android.godot.Godot.getCommandLine(Godot.java:282)
W/System.err(21951): at com.android.godot.Godot.onCreate(Godot.java:391)
W/System.err(21951): at android.app.Activity.performCreate(Activity.java:5231)
W/System.err(21951): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
W/System.err(21951): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2169)
W/System.err(21951): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2271)
W/System.err(21951): at android.app.ActivityThread.access$800(ActivityThread.java:144)
W/System.err(21951): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1205)
W/System.err(21951): at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err(21951): at android.os.Looper.loop(Looper.java:136)
W/System.err(21951): at android.app.ActivityThread.main(ActivityThread.java:5146)
W/System.err(21951): at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(21951): at java.lang.reflect.Method.invoke(Method.java:515)
W/System.err(21951): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:732)
W/System.err(21951): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:566)
W/System.err(21951): at dalvik.system.NativeStart.main(Native Method)
D/GODOT (21951): ERROR Exception java.io.FileNotFoundException:cl
W/dalvikvm(21951): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lcom/android/godot/GodotLib;
D/AndroidRuntime(21951): Shutting down VM
W/dalvikvm(21951): threadid=1: thread exiting with uncaught exception (group=0x41c3ace0)
E/AndroidRuntime(21951): FATAL EXCEPTION: main
E/AndroidRuntime(21951): Process: com.android.noname, PID: 21951
E/AndroidRuntime(21951): java.lang.UnsatisfiedLinkError: Couldn't load godot_android from loader dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.android.noname-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.android.noname-1, /vendor/lib, /system/lib]]]: findLibrary returned null
E/AndroidRuntime(21951): at java.lang.Runtime.loadLibrary(Runtime.java:358)
E/AndroidRuntime(21951): at java.lang.System.loadLibrary(System.java:526)

[edit]
Seems the xcode gcc just doesn't support static libraries, I've read some reports that you can use the homebrew or macports gcc to build and that does support making .so files.
I will install that later and give it a shot.

@vkbsb
Copy link
Contributor

vkbsb commented Mar 10, 2015

If you compile for android , rename the .dynlib to .so and use it. This works i've tested this.

@akien-mga
Copy link
Member

What's the status on this issue? There seems to be a need to enforce ".so" extension (for all platforms I guess?), but is it all that is needed to solve this?

@akien-mga
Copy link
Member

For the official android templates for 2.0.1, we had them built on OSX as .dylib files, and indeed renaming them to .so before generating the apk on Linux seemed to do the trick.

So I guess the fix is just what @reduz mentioned above and what @vkbsb confirmed.

akien-mga added a commit to akien-mga/godot that referenced this issue Apr 30, 2016
akien-mga added a commit that referenced this issue May 1, 2016
akien-mga added a commit that referenced this issue May 1, 2016
Fixes #1452.
(cherry picked from commit 94274b9)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants