embedthis / makeme

Embedthis MakeMe
https://embedthis.com/makeme
Other
0 stars 0 forks source link

How to set compiler when cross? #77

Closed feifei17 closed 8 years ago

feifei17 commented 8 years ago

hello, I use makeme to compile appweb6.2.1,but i can't set compiler when cross, I config with this:

CC=/opt/arm-2014.05/bin/arm-none-linux-gnueabi-gcc ./configure --with sqlite --set esp.depends sqlite --with ejscript --without watchdog --platform linux-arm-release --set compiler.hasDynLoad=true

but the linux-arm-release/platform.me like this:

platform: {
  8         name: "linux-arm-release",
  9         os: "linux",
 10         arch: "arm",
 11         like: "unix",
 12         dist: "ubuntu",
 13         profile: "release",
 14         dev: "linux-x86-release",
 15         cross: true,
 16         "arch-map": {
 17             x86: "i686",
 18             x64: "x86_64",
 19         },
 20     },
compiler: {
 67             hasAtomic: false,
 68             hasMmu: false,
 69             hasPam: false,
 70             hasAtomic64: false,
 71             hasDoubleBraces: false,
 72             hasDynLoad: false,
 73             hasLibEdit: false,
 74             hasLibRt: false,
 75             hasMtune: false,
 76             hasStackProtector: false,
 77             hasSync: false,
 78             hasSync64: false,
 79             hasSyncCas: false,
 80             hasUnnamedUnions: false,
 81             warnUnused: false,
 82             warn64to32: false,
 83         },
embedthis commented 8 years ago

More detail please. What did you expect and what did you get? Please include compile output.

feifei17 commented 8 years ago

I want to use mprLoadModule in my app , and my app running ok in local system, but in ARM error. output: mprLoadModule: initModule failed Product built without the ability to load modules dynamically

in my appweb.conf like this:LoadModule initModule libmod_init

compile ok,output:

fei@fei-wk:~/appweb/appweb-6.2.1$ me
     [Build] linux-x86-debug
      [Copy] build/linux-x86-debug/inc/osdep.h
      [Copy] build/linux-x86-debug/inc/embedtls.h
      [Copy] build/linux-x86-debug/inc/mbedtls.h
   [Compile] build/linux-x86-debug/obj/mbedtls.o
   [Archive] build/linux-x86-debug/bin/libmbedtls.a
      [Copy] build/linux-x86-debug/inc/mpr.h
   [Compile] build/linux-x86-debug/obj/mpr-mbedtls.o
   [Archive] build/linux-x86-debug/bin/libmpr-mbedtls.a
   [Compile] build/linux-x86-debug/obj/mprLib.o
      [Link] build/linux-x86-debug/bin/libmpr.so
      [Copy] build/linux-x86-debug/inc/pcre.h
   [Compile] build/linux-x86-debug/obj/pcre.o
      [Link] build/linux-x86-debug/bin/libpcre.so
      [Copy] build/linux-x86-debug/inc/http.h
   [Compile] build/linux-x86-debug/obj/httpLib.o
      [Link] build/linux-x86-debug/bin/libhttp.so
      [Copy] build/linux-x86-debug/inc/mpr-version.h
   [Compile] build/linux-x86-debug/obj/mpr-version.o
   [Archive] build/linux-x86-debug/bin/libmpr-version.a
      [Copy] build/linux-x86-debug/inc/esp.h
   [Compile] build/linux-x86-debug/obj/espLib.o
      [Link] build/linux-x86-debug/bin/libesp.so
      [Copy] build/linux-x86-debug/inc/appweb.h
      [Copy] build/linux-x86-debug/inc/customize.h
   [Compile] build/linux-x86-debug/obj/config.o
   [Compile] build/linux-x86-debug/obj/convenience.o
   [Compile] build/linux-x86-debug/obj/rom.o
   [Compile] build/linux-x86-debug/obj/cgiHandler.o
   [Compile] build/linux-x86-debug/obj/espHandler.o
      [Link] build/linux-x86-debug/bin/libappweb.so
   [Compile] build/linux-x86-debug/obj/appweb.o
      [Link] build/linux-x86-debug/bin/appweb
   [Compile] build/linux-x86-debug/obj/authpass.o
      [Link] build/linux-x86-debug/bin/authpass
      [Copy] build/linux-x86-debug/inc/zlib.h
   [Compile] build/linux-x86-debug/obj/zlib.o
      [Link] build/linux-x86-debug/bin/libzlib.so
      [Copy] build/linux-x86-debug/inc/ejs.h
      [Copy] build/linux-x86-debug/inc/ejs.slots.h
      [Copy] build/linux-x86-debug/inc/ejsByteGoto.h
   [Compile] build/linux-x86-debug/obj/ejsLib.o
src/ejscript/ejsLib.c: In function ‘searchForModule’:
src/ejscript/ejsLib.c:65887:18: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
             path = mprGetCurrentPath();
                  ^
      [Link] build/linux-x86-debug/bin/libejs.so
   [Compile] build/linux-x86-debug/obj/ejsc.o
      [Link] build/linux-x86-debug/bin/appweb-ejsc
   [Compile] ejs.mod
   [Compile] build/linux-x86-debug/obj/ejs.o
      [Link] build/linux-x86-debug/bin/appweb-ejs
   [Compile] build/linux-x86-debug/obj/esp.o
      [Link] build/linux-x86-debug/bin/appweb-esp
      [Copy] extras => build/linux-x86-debug/bin
   [Compile] build/linux-x86-debug/obj/http.o
      [Link] build/linux-x86-debug/bin/http
      [Copy] install-certs => build/linux-x86-debug/bin
   [Compile] build/linux-x86-debug/obj/ejsHandler.o
      [Link] build/linux-x86-debug/bin/libmod_ejs.so
   [Compile] build/linux-x86-debug/obj/makerom.o
      [Link] build/linux-x86-debug/bin/makerom
   [Compile] build/linux-x86-debug/obj/sqlite.o
      [Link] build/linux-x86-debug/bin/sqlite
  [Complete] all
     [Build] linux-arm-release
      [Copy] build/linux-arm-release/inc/osdep.h
      [Copy] build/linux-arm-release/inc/mbedtls.h
   [Compile] build/linux-arm-release/obj/mbedtls.o
   [Archive] build/linux-arm-release/bin/libmbedtls.a
      [Copy] build/linux-arm-release/inc/mpr.h
   [Compile] build/linux-arm-release/obj/mpr-mbedtls.o
   [Archive] build/linux-arm-release/bin/libmpr-mbedtls.a
   [Compile] build/linux-arm-release/obj/mprLib.o
      [Link] build/linux-arm-release/bin/libmpr.so
   [Compile] build/linux-arm-release/obj/pcre.o
      [Link] build/linux-arm-release/bin/libpcre.so
      [Copy] build/linux-arm-release/inc/http.h
   [Compile] build/linux-arm-release/obj/httpLib.o
      [Link] build/linux-arm-release/bin/libhttp.so
      [Copy] build/linux-arm-release/inc/mpr-version.h
   [Compile] build/linux-arm-release/obj/mpr-version.o
   [Archive] build/linux-arm-release/bin/libmpr-version.a
      [Copy] build/linux-arm-release/inc/esp.h
   [Compile] build/linux-arm-release/obj/espLib.o
      [Link] build/linux-arm-release/bin/libesp.so
      [Copy] build/linux-arm-release/inc/appweb.h
   [Compile] build/linux-arm-release/obj/config.o
   [Compile] build/linux-arm-release/obj/convenience.o
   [Compile] build/linux-arm-release/obj/rom.o
   [Compile] build/linux-arm-release/obj/cgiHandler.o
   [Compile] build/linux-arm-release/obj/espHandler.o
      [Link] build/linux-arm-release/bin/libappweb.so
   [Compile] build/linux-arm-release/obj/appweb.o
      [Link] build/linux-arm-release/bin/appweb
      [Copy] build/linux-arm-release/inc/zlib.h
   [Compile] build/linux-arm-release/obj/zlib.o
      [Link] build/linux-arm-release/bin/libzlib.so
      [Copy] build/linux-arm-release/inc/ejs.h
   [Compile] build/linux-arm-release/obj/ejsLib.o
src/ejscript/ejsLib.c: In function 'searchForModule':
src/ejscript/ejsLib.c:65887:18: warning: assignment discards 'const' qualifier from pointer target type [enabled by default]
             path = mprGetCurrentPath();
                  ^
      [Link] build/linux-arm-release/bin/libejs.so
   [Compile] build/linux-arm-release/obj/ejsc.o
      [Link] build/linux-arm-release/bin/appweb-ejsc
   [Compile] ejs.mod
   [Compile] build/linux-arm-release/obj/ejs.o
      [Link] build/linux-arm-release/bin/appweb-ejs
      [Copy] extras => build/linux-arm-release/bin
   [Compile] build/linux-arm-release/obj/http.o
      [Link] build/linux-arm-release/bin/http
      [Copy] install-certs => build/linux-arm-release/bin
   [Compile] build/linux-arm-release/obj/ejsHandler.o
      [Link] build/linux-arm-release/bin/libmod_ejs.so
   [Compile] build/linux-arm-release/obj/makerom.o
      [Link] build/linux-arm-release/bin/makerom
   [Compile] build/linux-arm-release/obj/watchdog.o
      [Link] build/linux-arm-release/bin/appman
  [Complete] all
fei@fei-wk:~/appweb/appweb-6.2.1$ 
embedthis commented 8 years ago

MakeMe tests the compiler to see if it has support for dynamic library loading. But this is hard to do for some embedded systems.

Edit build//platform.me and change the setting for settings.compiler.hasDynLoad. Then edit build//inc/me.h and change

#define ME_COMPILER_HAS_DYN_LOAD 1

Generally folks build static without dynamic modules on embedded targets.

feifei17 commented 8 years ago

Thank you very much!

feifei17 commented 8 years ago

As your saied, I modified the hasDynLoad to true and ME_COMPILER_HAS_DYN_LOAD to 1 then,when compile some files the compiler like this: [Run] arm-linux-gnueabi-gcc -o build/linux-arm-release/bin/appman -g -rdynamic -Wl,--enable-new-dtags -Wl,-rpath,$ORIGIN/ -Lbuild/linux-arm-release/bin "build/linux-arm-release/obj/watchdog.o" -lmpr -lmpr-mbedtls -lmbedtls -lpthread -lm -lmpr -lmpr-mbedtls -lmbedtls -lpthread -lm me: ERROR: Building target watchdog

Command failure: build/linux-arm-release/bin/libmpr.so:对‘dlsym’未定义的引用 build/linux-arm-release/bin/libmpr.so:对‘dlerror’未定义的引用 build/linux-arm-release/bin/libmpr.so:对‘dlopen’未定义的引用 build/linux-arm-release/bin/libmpr.so:对‘dlclose’未定义的引用 collect2: 错误: ld 返回 1

then ,I manually add options “-ldl” and complie like this: fei@fei-wk:~/appweb/appweb-6.2.1$ arm-linux-gnueabi-gcc -o build/linux-arm-release/bin/appman -g -rdynamic -Wl,--enable-new-dtags -Wl,-rpath,$ORIGIN/ -Lbuild/linux-arm-release/bin "build/linux-arm-release/obj/watchdog.o" -lmpr -lmpr-mbedtls -lmbedtls -lpthread -lm -lmpr -lmpr-mbedtls -lmbedtls -lpthread -lm -ldl

and the compiler looks work well. but ,when running on the ARM board still error, like this: [root@IoT9608 srv]# ls bin/ appman* http* libmod_init.so* libsscom.so appweb* libappweb.so* libmod_io.so* libzlib.so appweb-ejs* libejs.so* libmod_sms.so* makerom appweb-ejsc* libesp.so* libmod_zig.so* roots.crt ca.crt libhttp.so* libmpr-mbedtls.a self.crt ca.key libmbedtls.a libmpr-version.a self.key ec.crt libmod_com.so* libmpr.so* test.crt ec.key libmod_ejs.so* libpcre.so* test.key ejs.mod libmod_gps.so* libsnmp_nms.so* vcvars.bat esp-compile.json libmod_hio.so* libsql.so [root@IoT9608 srv]# bin/appweb --config appweb.conf -v bin/appweb: error while loading shared libraries: libappweb.so: cannot open shared object file: No such file or directory [root@IoT9608 srv]#

so,I think: When I was not modified hasDynLoad and ME_COMPILER_HAS_DYN_LOAD , the appweb can running(but can't loadMods),Whether I can recognize the powder at that time the appweb can load the libappweb.so ? but why can't load lib myself ? such as libmod_init.so ?

I'm trying to compile static, Thank you very much!