wei-spring / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

Undefined symbols for architecture armv7: "_java_lang_Object_finalize__" #1307

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Disable elimination of unused methods in build server.
2. Create basic hello world app.
3. Send iOS debug build

What is the expected output? What do you see instead?

Should build successfully.  Actual result is build error:

Ld build/Release-iphoneos/DMTest.app/DMTest normal armv7
    cd /var/folders/k7/b5qdhxt88v58wp008k8yxy180000gn/T/build8339543568809164885xxx/dist
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    export PATH="/Applications/Xcode6.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode6.1.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode6.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch armv7 -isysroot /Applications/Xcode6.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk -L/var/folders/k7/b5qdhxt88v58wp008k8yxy180000gn/T/build8339543568809164885xxx/dist/build/Release-iphoneos -L/var/folders/k7/b5qdhxt88v58wp008k8yxy180000gn/T/build8339543568809164885xxx/dist/DMTest-src -F/var/folders/k7/b5qdhxt88v58wp008k8yxy180000gn/T/build8339543568809164885xxx/dist/build/Release-iphoneos -filelist /var/folders/k7/b5qdhxt88v58wp008k8yxy180000gn/T/build8339543568809164885xxx/dist/build/DMTest.build/Release-iphoneos/DMTest.build/Objects-normal/armv7/DMTest.LinkFileList -dead_strip -fobjc-link-runtime -miphoneos-version-min=6.0 -framework OpenGLES -framework CoreGraphics -framework UIKit -framework GLKit -framework Foundation -liconv -framework AdSupport -framework AddressBookUI -framework SystemConfiguration -framework MapKit -framework AudioToolbox -lxml2 -framework QuartzCore -framework AddressBook -lsqlite3 -lsqlite3.0 -framework GameKit -framework Security -framework StoreKit -framework CoreMotion -framework CoreLocation -framework MessageUI -framework MediaPlayer -framework AVFoundation -framework CoreVideo -framework QuickLook -framework iAd -framework CoreMedia -lz -lzbar -Xlinker -dependency_info -Xlinker /var/folders/k7/b5qdhxt88v58wp008k8yxy180000gn/T/build8339543568809164885xxx/dist/build/DMTest.build/Release-iphoneos/DMTest.build/Objects-normal/armv7/DMTest_dependency_info.dat -o /var/folders/k7/b5qdhxt88v58wp008k8yxy180000gn/T/build8339543568809164885xxx/dist/build/Release-iphoneos/DMTest.app/DMTest
Undefined symbols for architecture armv7:
  "_java_lang_Object_finalize__", referenced from:
      _com_codename1_impl_ios_IOSImplementation_TextureAlphaMask_finalize__ in com_codename1_impl_ios_IOSImplementation_TextureAlphaMask.o
ld: symbol(s) not found for architecture armv7

Please use labels and text to provide additional information.

The finalize() method of the TextureAlphaMask() method is:
@Override
        protected void finalize() throws Throwable {
            dispose();
            super.finalize(); 
        }

i.e. it calls super.finalize().  In the old iOS port, the finalize method 
existed.  I could just eliminate this call, but does that mean that the GC 
doesn't call the finalizers?  There is some cleanup here that relies on the 
finalizer being called.  If finalizers aren't called, we will have memory leaks 
building up.

(Note:  This problem is only present if elimination of unused methods is 
disabled... but that was the point.  I want to run across errors like this).

Original issue reported on code.google.com by steve.ha...@codenameone.com on 24 Jan 2015 at 10:01

GoogleCodeExporter commented 9 years ago
We need to eliminate the super.finalize() call and avoid the override 
annotation here. That's a design mistake.

Having a finalizer incurs a big overhead on the GC which needs to execute 
additional code to perform the finalization and possibly delay the GC itself. 
Having a finalize method in object means delaying the GC for every single 
object in the system. 

Original comment by shai.almog on 25 Jan 2015 at 6:50

GoogleCodeExporter commented 9 years ago
So the gc will still call finalize if the method exists?

Original comment by steve.ha...@codenameone.com on 25 Jan 2015 at 2:12

GoogleCodeExporter commented 9 years ago

Original comment by steve.ha...@codenameone.com on 25 Jan 2015 at 3:05

GoogleCodeExporter commented 9 years ago
Yes the GC will invoke finalize if there is such a method defined on the object.

Original comment by shai.almog on 26 Jan 2015 at 7:16