From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 34239 invoked by alias); 18 May 2016 06:08:51 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 32691 invoked by uid 89); 18 May 2016 06:08:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=3.0 required=5.0 tests=BAYES_20,KAM_INFOUSMEBIZ,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,XPRIO autolearn=no version=3.3.2 spammy=Connect, H*F:D*me, subsequently, H*x:Open-Xchange X-HELO: atl4mhob14.myregisteredsite.com Received: from atl4mhob14.myregisteredsite.com (HELO atl4mhob14.myregisteredsite.com) (209.17.115.52) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 18 May 2016 06:08:40 +0000 Received: from atl4oxapp01pod3 ([10.30.77.69]) by atl4mhob14.myregisteredsite.com (8.14.4/8.14.4) with ESMTP id u4I68Znd030603 for ; Wed, 18 May 2016 02:08:35 -0400 Date: Wed, 18 May 2016 06:08:00 -0000 From: "dto xelf.me" Reply-To: "dto xelf.me" To: libffi-discuss@sourceware.org Message-ID: <1314332318.20981.1463551715826@webmail3.networksolutionsemail.com> Subject: loading shared objects via libffi on Android "CDECL does no denote a valid calling convention." MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Originating-Client: open-xchange-appsuite X-SW-Source: 2016/txt/msg00023.txt.bz2 Hi! I am having trouble loading libSDL-1.2.so with libffi 3.2.1 (included w= ith ecl) on my Android system. I get a Lisp error with "CDECL does no denot= e a valid calling convention." Backtrace and error text to be found below. Using git HEAD does not help either. Seems to be related to this issue: https://stackoverflow.com/questions/9559855/does-ecl-support-callbacks here is the error message where it appears in the code: https://gitlab.com/embeddable-common-lisp/ecl/blob/develop/src/c/ffi.d#L419 The tricky part is: CL-OPENGL bindings compile/load against /system/lib/lib= GLESv2.so just fine. I know these SDL-1.2.so shared libs work, because i pu= lled them from a working build made with this SDL 1.2 android port: https:/= /github.com/pelya/commandergenius So we know that both GLES and SDL shared objects are working on the target = system, but GLES loads fine via (ql:quickload :cl-opengl), but (ql:quickloa= d :lispbuilder-sdl) subsequently fails as described.=20 You can find the shared objects I built here: http://xelf.me/android-sdl-1.= 2-shared-objects.tar.gz=20 Here are links to all the scripts I am using to make builds. They're adapte= d from the various documentation and are set up to use ~/src as a staging a= rea. https://gitlab.com/dto/xelf/blob/master/build/clean-ecl.sh https://gitlab.com/dto/xelf/blob/master/build/clone-ecl.sh https://gitlab.com/dto/xelf/blob/master/build/build-ecl-toolchain.sh https://gitlab.com/dto/xelf/blob/master/build/build-ecl-android.sh (optional) https://gitlab.com/dto/xelf/blob/master/build/insert-upstream-li= bffi.sh My sequence of steps is as follows: 1. Build and install EclAndroid-debug.apk using the above scripts. 2. Download slime 2.14 from: https://github.com/slime/slime/archive/v2.14.t= ar.gz 3. Git clone https://github.com/3b/cl-opengl 4. Edit cl-opengl/gl/library.lisp and change the :UNIX line to this: (:unix (:or "libGLESv2.so" "libGLES_android.so"))) 5. Start the Ecl app on the android device and eval "(get-quicklisp)" This is important because it creates directories in /data/data/org.lisp.= ecl/...=20 where some missing pieces (swank and modified cl-opengl) must now go. 6. copy the slime-2.14 directory from your build machine to Android's /data= /data/org.lisp.ecl/app_resources/home/ 7. copy cl-opengl from your build machine to Android's=20 /data/data/org.lisp.ecl/app_resources/home/quicklisp/local-projects/ 8. I can't yet figure out how to get the libraries properly bundled in the = APK, so I remount /system as a read/write filesystem, and then copy the SDL 1.2 shared obj= ects *.so into=20 /system/lib/=20 9. Quit and restart ECL Android app. This time Swank should take a few mome= nts so compile. 10. Click top right corner menu and choose Swank Server. You should see a m= essage showing that it has started. 11. Connect from Emacs. ------------------------------------------------------- And finally here is the error message and backtrace: ------------------------------- CDECL does no denote a valid calling convention. =C2=A0=C2=A0 [Condition of type SIMPLE-ERROR] Restarts: =C2=A00: [TRY-RECOMPILING] Recompile events and try loading it again =C2=A01: [RETRY] Retry loading FASL for #. =C2=A02: [ACCEPT] Continue, treating loading FASL for # as having been successful. =C2=A03: [RETRY] Retry ASDF operation. =C2=A04: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetti= ng the configuration. =C2=A05: [ABORT] Give up on "lispbuilder-sdl" =C2=A0--more-- Backtrace: =C2=A0 0: # =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Locals: =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SWANK/BACKEND::DEBUGGER-LOOP-FN = =3D #> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 SWANK/BACKEND::F =3D #> =C2=A0 1: # =C2=A0 2: # =C2=A0 3: # =C2=A0 4: # =C2=A0 5: # =C2=A0 6: # =C2=A0 7: # =C2=A0 8: # =C2=A0 9: # =C2=A010: # =C2=A011: # =C2=A012: # =C2=A013: # =C2=A014: # =C2=A015: # =C2=A016: # =C2=A017: # =C2=A018: # =C2=A019: # =C2=A020: # =C2=A021: # =C2=A022: # =C2=A023: # =C2=A024: # =C2=A025: # =C2=A026: # =C2=A027: # =C2=A028: # =C2=A029: # =C2=A030: # =C2=A031: # =C2=A032: # =C2=A033: # =C2=A034: # =C2=A035: # =C2=A036: # =C2=A037: # =C2=A038: # =C2=A039: # =C2=A040: # =C2=A041: # =C2=A042: # =C2=A043: # =C2=A044: # =C2=A045: # =C2=A046: # =C2=A047: # =C2=A048: # =C2=A049: # =C2=A050: # =C2=A051: # =C2=A052: # =C2=A053: # =C2=A054: # =C2=A055: # =C2=A056: # =C2=A057: # =C2=A058: # =C2=A059: # =C2=A060: # =C2=A061: # =C2=A062: # =C2=A063: NIL