Skip to content

Compile issues #1

@drthinh

Description

@drthinh

Thank you for your previous reply in /mini_jvm
I have some problems when compile minijvm_rt.jar to C code

  • I use intelliJ Idea to compile class2c.jar and run it to make /out/c .c file, it's ok
    but file generated "metadata.h" have struct struct java_lang_Class {InstProp prop; VMTable* vm_table; struct java_lang_ClassLoader* classLoader_3; struct java_lang_String* name_4; JArray * enumConstants_5; struct java_util_Map* enumConstantDirectory_6; s64 classHandle_7; struct org_mini_reflect_ReflectClass* refClass_8;};
    it's not compatible with default jvc.c, native_std.c : JObject *ins_of_Class_create_get(JThreadRuntime *runtime, JClass *clazz) { JClass *java_lang_class = g_procache.java_lang_class_raw->clazz; if (java_lang_class) { if (clazz->ins_of_Class) { return clazz->ins_of_Class; } else { struct java_lang_Class *ins = (struct java_lang_Class *) new_instance_with_class(runtime, java_lang_class); gc_refer_hold(ins); Java_java_lang_Class__init____V(runtime, ins); clazz->ins_of_Class = (__refer) ins; ins->classHandle_6 = (s64) (intptr_t) clazz;//todo , find it use field refer return (JObject *) ins; } } return NULL; }
    So I changed classHandle_6 to classHandle_7, before that vm/
    .c file could be compiled to .obj file
  1. after that I use CMake to genarate Makefile, but it stuck when compile jvm.c file
    so I remove {GUI_FILES} in CMake, it ran OK, compiled all /out/c/*c file to obj
    But there are errors at last combination:
    CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x4938e): undefined reference to new_instance_with_classraw_index'
    CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x49408): undefined reference to construct_string_with_utfraw_index' CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x49445): undefined reference to new_instance_with_classraw_index'
    CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x49488): undefined reference to throw_exception' CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x49571): undefined reference to new_instance_with_classraw_index'
    CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x495b4): undefined reference to throw_exception' CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x495ee): undefined reference to new_instance_with_classraw_index'
    CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x49631): undefined reference to throw_exception' CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x496ca): undefined reference to new_instance_with_classraw_index'
    CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x49744): undefined reference to construct_string_with_utfraw_index' CMakeFiles\ccjvm.dir/objects.a(com.sun.cldc.util.mini.TimeZoneImpl.c.obj):com.sun.cldc.util.mini.TimeZoneImpl.c:(.text+0x49781): undefined reference to new_instance_with_classraw_indexCMakeFiles\ccjvm.dir\build.make:11704: recipe for target 'ccjvm.exe' failed
    mingw32-make[2]: *** [ccjvm.exe] Interrupt
    CMakeFiles\Makefile2:93: recipe for target 'CMakeFiles/ccjvm.dir/all' failed
    mingw32-make[1]: *** [CMakeFiles/ccjvm.dir/all] Error 130
    Makefile:101: recipe for target 'all' failed
    mingw32-make: *** [all] Error 130`
    Could you help me handle there problems. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions