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

iOS build not happening due to kotlin #2752

Closed
kutoman opened this issue Apr 1, 2019 · 7 comments
Closed

iOS build not happening due to kotlin #2752

kutoman opened this issue Apr 1, 2019 · 7 comments
Assignees
Milestone

Comments

@kutoman
Copy link
Contributor

kutoman commented Apr 1, 2019

the following error is printed out:

/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8931419071038882208xxx/dist/HacUmraDuaGuide-src/kotlin_collections_ArraysKt___ArraysKt.m:6323:32: error: implicit declaration of function 'java_util_Arrays_copyOf___byte_1ARRAY_int_R_byte_1ARRAY' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    /* CustomInvoke */PUSH_OBJ(java_util_Arrays_copyOf___byte_1ARRAY_int_R_byte_1ARRAY(threadStateData, locals[0].data.o, ilocals_1_));
                               ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8931419071038882208xxx/dist/HacUmraDuaGuide-src/kotlin_collections_ArraysKt___ArraysKt.m:6323:32: note: did you mean 'java_util_Arrays_copyOf___byte_1ARRAY_R_byte_1ARRAY'?
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8931419071038882208xxx/dist/HacUmraDuaGuide-src/kotlin_collections_ArraysKt___ArraysKt.m:8:
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8931419071038882208xxx/dist/HacUmraDuaGuide-src/java_util_Arrays.h:290:13: note: 'java_util_Arrays_copyOf___byte_1ARRAY_R_byte_1ARRAY' declared here
JAVA_OBJECT java_util_Arrays_copyOf___byte_1ARRAY_R_byte_1ARRAY(CODENAME_ONE_THREAD_STATE, JAVA_OBJECT __cn1Arg1);
            ^
1
 error
 generated

The following build commands failed:
	CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8931419071038882208xxx/dist/build/Build/Intermediates.noindex/ArchiveIntermediates/HacUmraDuaGuide/IntermediateBuildFilesPath/HacUmraDuaGuide.build/Release-iphoneos/HacUmraDuaGuide.build/Objects-normal/arm64/kotlin_collections_ArraysKt___ArraysKt.o /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build8931419071038882208xxx/dist/HacUmraDuaGuide-src/kotlin_collections_ArraysKt___ArraysKt.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

@codenameone codenameone added this to the Version 7.0 milestone Apr 2, 2019
shannah added a commit that referenced this issue Apr 2, 2019
@shannah
Copy link
Collaborator

shannah commented Apr 2, 2019

I have implemented this missing method in ParparVM so it should resolve this issue. It will be available in the next update.

@shannah shannah closed this as completed Apr 2, 2019
@kutoman
Copy link
Contributor Author

kutoman commented Apr 5, 2019

@shannah

now the builder is complaining about this:

/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:133:145: note: did you mean 'get_static_java_lang_Boolean_TRUE'?
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:1:
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/HacUmraDuaGuide-Prefix.pch:22:
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/java_lang_Boolean.h:60:20: note: 'get_static_java_lang_Boolean_TRUE' declared here
extern JAVA_OBJECT get_static_java_lang_Boolean_TRUE();
                   ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:157:145: error: implicit declaration of function 'get_static_java_lang_Long_TYPE' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    /* CustomInvoke */PUSH_OBJ(kotlin_jvm_internal_Reflection_getOrCreateKotlinClass___java_lang_Class_R_kotlin_reflect_KClass(threadStateData, get_static_java_lang_Long_TYPE(threadStateData)));
                                                                                                                                                ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:181:145: error: implicit declaration of function 'get_static_java_lang_Integer_TYPE' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    /* CustomInvoke */PUSH_OBJ(kotlin_jvm_internal_Reflection_getOrCreateKotlinClass___java_lang_Class_R_kotlin_reflect_KClass(threadStateData, get_static_java_lang_Integer_TYPE(threadStateData)));
                                                                                                                                                ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:181:145: note: did you mean 'get_static_java_lang_Integer_DIGITS'?
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:1:
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/HacUmraDuaGuide-Prefix.pch:24:
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/java_lang_Integer.h:100:20: note: 'get_static_java_lang_Integer_DIGITS' declared here
extern JAVA_OBJECT get_static_java_lang_Integer_DIGITS();
                   ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:205:145: error: implicit declaration of function 'get_static_java_lang_Float_TYPE' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    /* CustomInvoke */PUSH_OBJ(kotlin_jvm_internal_Reflection_getOrCreateKotlinClass___java_lang_Class_R_kotlin_reflect_KClass(threadStateData, get_static_java_lang_Float_TYPE(threadStateData)));
                                                                                                                                                ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:205:145: note: did you mean 'get_static_java_lang_Float_NaN'?
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:1:
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/HacUmraDuaGuide-Prefix.pch:31:
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/java_lang_Float.h:96:19: note: 'get_static_java_lang_Float_NaN' declared here
extern JAVA_FLOAT get_static_java_lang_Float_NaN();
                  ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:229:145: error: implicit declaration of function 'get_static_java_lang_Double_TYPE' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    /* CustomInvoke */PUSH_OBJ(kotlin_jvm_internal_Reflection_getOrCreateKotlinClass___java_lang_Class_R_kotlin_reflect_KClass(threadStateData, get_static_java_lang_Double_TYPE(threadStateData)));
                                                                                                                                                ^
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:229:145: note: did you mean 'get_static_java_lang_Double_NaN'?
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m:1:
In file included from /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/HacUmraDuaGuide-Prefix.pch:30:
/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/java_lang_Double.h:94:20: note: 'get_static_java_lang_Double_NaN' declared here
extern JAVA_DOUBLE get_static_java_lang_Double_NaN();
                   ^
5 errors generated.

** ARCHIVE FAILED **


The following build commands failed:
	CompileC /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/build/Build/Intermediates.noindex/ArchiveIntermediates/HacUmraDuaGuide/IntermediateBuildFilesPath/HacUmraDuaGuide.build/Release-iphoneos/HacUmraDuaGuide.build/Objects-normal/arm64/com_igmghacumre_duaguide_utils_PrefProperty.o /var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build6406479075350982617xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_PrefProperty.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Process return code is 65
Failed xcodebuild step

my class looks like this:

@Suppress("UNCHECKED_CAST")
class PrefProperty<T: Any> (type: KClass<T>, prefName: String, initial: T): ReadWriteProperty<Any, T> {

    private val setter: (T) -> Unit
    private val getter: () -> T

    init {
        when(type) {
            Boolean::class -> {
                setter = { Preferences.set(prefName, it as Boolean)}
                getter = { Preferences.get(prefName, initial as Boolean) as T }
            }
            Long::class -> {
                setter = { Preferences.set(prefName, it as Long)}
                getter = { Preferences.get(prefName, initial as Long) as T }
            }
            Int::class -> {
                setter = { Preferences.set(prefName, it as Int)}
                getter = { Preferences.get(prefName, initial as Int) as T }
            }
            Float::class -> {
                setter = { Preferences.set(prefName, it as Float)}
                getter = { Preferences.get(prefName, initial as Float) as T }
            }
            Double::class -> {
                setter = { Preferences.set(prefName, it as Double)}
                getter = { Preferences.get(prefName, initial as Double) as T }
            }
            String::class -> {
                setter = { Preferences.set(prefName, it as String)}
                getter = { Preferences.get(prefName, initial as String) as T }
            }
            else -> error("unsupported type: $type")
        }
    }


    override fun getValue(thisRef: Any, property: KProperty<*>): T = getter()

    override fun setValue(thisRef: Any, property: KProperty<*>, value: T) = setter(value)

    companion object {
        inline operator fun <reified T: Any> invoke(prefName: String, initial: T) = PrefProperty(T::class, prefName, initial)
    }
}

@shannah
Copy link
Collaborator

shannah commented Apr 5, 2019

You'll need to avoid anything in the kotlin reflect package (e.g. KClass) since it uses reflection which we don't support.

@kutoman
Copy link
Contributor Author

kutoman commented Apr 5, 2019

oh I see, thanks

@kutoman
Copy link
Contributor Author

kutoman commented Apr 6, 2019

@shannah
sorry for sharing the error reports frequenetly, but there is a next error which I can't really make out. And by the way, why aren't these caused on the other platforms?

/var/folders/p_/xlvwhg4101z8r81_nl13cds80000gn/T/build5952036637615669524xxx/dist/HacUmraDuaGuide-src/com_igmghacumre_duaguide_utils_FromUnitUtilsKt.m:256:23: error: implicit declaration of function 'virtual_java_lang_Exception_addSuppressed___java_lang_Throwable' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    /* CustomInvoke */virtual_java_lang_Exception_addSuppressed___java_lang_Throwable(threadStateData, locals[12].data.o, locals[11].data.o); 
                      ^
1 error generated.

this is FromUnitUtils.kt:


fun inAppHome(relativePath: String) = CN.getAppHomePath() + relativePath

/**
 * .. and closes the streams
 */
fun InputStream.unzip(dirDest: String) {


    try {
        ZipInputStream(this).use { zipStream ->

            // create a buffer to improve copy performance later.
            //val buffer = ByteArray(2048)
            val bufferSize = 2048

            var outdir = dirDest
            if (!outdir.endsWith("/")) outdir += "/"

            while (true) {

                val entry = zipStream.nextEntry ?: break
                val outpath = outdir + "/" + entry.name

                CN.mkdir(outdir)
                CN.openFileOutputStream(outpath).use {
                    Util.copyNoClose(zipStream, it, bufferSize)
                }

            }
        }

    } catch (ex: IOException) {
        Log.e(ex)
    }
}

private val Q = arrayOf("", "K", "M", "G", "T", "P", "E")
fun toHumanReadableBytesSize(bytes: Long, dot: Char = ',', SI: Boolean = true): String {
    for (i in 6 downTo 1) {
        val a = if(SI) 1000.0 else 1024.0
        val step = MathUtil.pow(a, i.toDouble())
        if (bytes > step) return String.format("%3.1f %sB", bytes / step, Q[i]).replace('.', dot)
    }
    return java.lang.Long.toString(bytes)
}

fun showRetryButtonView(insteadOf: Container, onButtonClick: () -> Unit) {

    val btn = Button("retry")
    btn.uiid = "RetryViewButton"

    val symbol = Label("", "RetryViewIcon").apply {
        setMaterialIcon(FontImage.MATERIAL_SIGNAL_WIFI_OFF, 12f)
        allStyles.alignment = Component.CENTER
    }

    val retryView = BorderLayout.centerAbsolute(BoxLayout.encloseY(symbol, btn))
    retryView.uiid = "RetryView"

    val undoAction = GuiUtils.replaceUndoable(insteadOf, retryView)
    retryView.parent.revalidate()

    btn.addActionListener { e ->
        S(btn).fadeOutAndWait(100)
        btn.isVisible = false
        undoAction.run()
        onButtonClick()
    }
}

@kutoman
Copy link
Contributor Author

kutoman commented Apr 9, 2019

@shannah
I couldn't find a solution and am stuck here. Do you have any advice as workaround?

@shannah
Copy link
Collaborator

shannah commented Apr 9, 2019

I have added this missing method to ParparVM. It will be available in the next update and should fix this error.

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

No branches or pull requests

2 participants