digitalgust / miniJVM

Develop iOS Android app in java, Cross platform java virtual machine , the minimal jvm .
MIT License
315 stars 89 forks source link

Building on Ubuntu 18.04 fails due to wrong shell syntax #8

Open mingodad opened 3 years ago

mingodad commented 3 years ago

Trying to build on Ubuntu 18.04 I get this error:

./build_mac_linux.sh
Requirement: gcc 
Linux
compile mini_jvm
../minijvm/c/utils/miniz.c:3031:9: note: #pragma message: Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.
 3031 | #pragma message("Using fopen, ftello, fseeko, stat() etc. path for file I/O - this path may not support large files.")
      |         ^~~~~~~
/tmp/ccEx5qCZ.o: In function `mtx_init':
tinycthread.c:(.text+0x26): undefined reference to `pthread_mutexattr_init'
tinycthread.c:(.text+0x41): undefined reference to `pthread_mutexattr_settype'
tinycthread.c:(.text+0x63): undefined reference to `pthread_mutexattr_destroy'
/tmp/ccEx5qCZ.o: In function `mtx_trylock':
tinycthread.c:(.text+0xeb): undefined reference to `pthread_mutex_trylock'
/tmp/ccEx5qCZ.o: In function `thrd_create':
tinycthread.c:(.text+0x2ea): undefined reference to `pthread_create'
/tmp/ccEx5qCZ.o: In function `thrd_join':
tinycthread.c:(.text+0x3cc): undefined reference to `pthread_join'
/tmp/ccEx5qCZ.o: In function `tss_create':
tinycthread.c:(.text+0x54f): undefined reference to `pthread_key_create'
/tmp/ccEx5qCZ.o: In function `tss_delete':
tinycthread.c:(.text+0x576): undefined reference to `pthread_key_delete'
/tmp/ccEx5qCZ.o: In function `tss_get':
tinycthread.c:(.text+0x58e): undefined reference to `pthread_getspecific'
/tmp/ccEx5qCZ.o: In function `tss_set':
tinycthread.c:(.text+0x5b0): undefined reference to `pthread_setspecific'
/tmp/cc06t1Sw.o: In function `java_lang_Math_exp':
jni_std.c:(.text+0xeb3): undefined reference to `exp'
/tmp/cc06t1Sw.o: In function `java_lang_Math_sin':
jni_std.c:(.text+0xfce): undefined reference to `sin'
/tmp/cc06t1Sw.o: In function `java_lang_Math_cos':
jni_std.c:(.text+0x1036): undefined reference to `cos'
/tmp/cc06t1Sw.o: In function `java_lang_Math_tan':
jni_std.c:(.text+0x109e): undefined reference to `tan'
/tmp/cc06t1Sw.o: In function `java_lang_Math_sqrt':
jni_std.c:(.text+0x1106): undefined reference to `sqrt'
/tmp/cc06t1Sw.o: In function `java_lang_Math_ceil':
jni_std.c:(.text+0x116e): undefined reference to `ceil'
/tmp/cc06t1Sw.o: In function `java_lang_Math_floor':
jni_std.c:(.text+0x11d6): undefined reference to `floor'
/tmp/cc06t1Sw.o: In function `java_lang_Math_asin':
jni_std.c:(.text+0x123e): undefined reference to `asin'
/tmp/cc06t1Sw.o: In function `java_lang_Math_acos':
jni_std.c:(.text+0x12a6): undefined reference to `acos'
/tmp/cc06t1Sw.o: In function `java_lang_Math_atan':
jni_std.c:(.text+0x130e): undefined reference to `atan'
/tmp/cc06t1Sw.o: In function `java_lang_Math_log':
jni_std.c:(.text+0x1376): undefined reference to `log'
/tmp/cc06t1Sw.o: In function `java_lang_Math_atan2':
jni_std.c:(.text+0x1414): undefined reference to `atan2'
/tmp/cc06t1Sw.o: In function `java_lang_Math_pow':
jni_std.c:(.text+0x14a0): undefined reference to `pow'
/tmp/cc06t1Sw.o: In function `java_lang_System_loadLibrary0':
jni_std.c:(.text+0x2545): undefined reference to `dlopen'
jni_std.c:(.text+0x2555): undefined reference to `dlerror'
jni_std.c:(.text+0x2593): undefined reference to `dlsym'
collect2: error: ld returned 1 exit status
compile glfw_gui
mv: cannot stat 'mini_jvm': No such file or directory

Then changing the order of the gcc command allow it to build:

diff build_mac_linux.sh build_mac_linux-dad.sh 
30c30
< ${GCC}  -o mini_jvm -I${CSRC}/jvm -I${CSRC}/utils/ -I${CSRC}/utils/sljit/ -I${CSRC}/utils/https/ -I${CSRC}/utils/https/mbedtls/include/ -lpthread -lm -ldl  $SRCLIST ${CSRC}/utils/sljit/sljitLir.c
---
> ${GCC}  -o mini_jvm -I${CSRC}/jvm -I${CSRC}/utils/ -I${CSRC}/utils/sljit/ -I${CSRC}/utils/https/ -I${CSRC}/utils/https/mbedtls/include/  $SRCLIST ${CSRC}/utils/sljit/sljitLir.c  -lpthread -lm -ldl

Then when trying to build the lib/minijvm_rt.jar I'm getting this error:

./build_jar.sh
Requirement: jdk1.8 jar javac 
./build_jar.sh: 8: ./build_jar.sh: Syntax error: "(" unexpected

Then changing the syntax on build_jar.sh solves it:

diff build_jar.sh build_jar-dad.sh 
1c1
< 
---
> #!/bin/sh
8c8
< function build_jar(){
---
> build_jar(){

Thanks for your great work !

digitalgust commented 3 years ago

Let me test it tomorrow

digitalgust commented 3 years ago

build scripts issue fixed and test on Ubuntu 18.04. thanks for Domingo Alvarez Duarte