This is a problem with assumptions about *features*

On Darwin we should be loading .dylib which is generated by the - bundle option to gcc/ld

UFFI looks for tags in *features* as follows to determine the lib type to load:

(defun foreign-library-types ()
"Returns list of string naming possible library types for platform, sorted by preference"
  #+(or win32 mswindows) '("dll" "lib")
  #+(or macosx darwin ccl-5.0) '("dylib" "bundle")
  #-(or win32 mswindows macosx darwin ccl-5.0) '("so" "a" "o")
)

Our compile script in elephant.asd relies on darwin/macosx as the indicator as to what kind of library to produce (-shared vs. - bundle). I have no idea why OpenMCL changed the *features* list! Very annoying.

I notice that :darwin-host is on the list to differentiate from :darwin-target, presumably to allow cross-compilation.

I think the right solution is to push :macosx onto the *features* list for now so everything just works. Do this before you load elephant. Perhaps we can find out from the OpenMCL folks what the right *feature* is to rely on before we modify our script and ask the UFFI maintainer to add new tags to update foreign-library-types to accommodate OpenMCL 1.1

Ian

On Jan 24, 2007, at 11:22 AM, [EMAIL PROTECTED] wrote:

I have been trying to make 0.6.1 work under OpenMCL Version 1.1- pre-061231 (DarwinX8664). However, as I mentioned before, I have been having compilation problems.

They seem to be mainly related to libmemutil.

Out of the box attempt, I got the following error:

; $ /usr/bin/gcc -shared -Wall -fPIC -O3 -o /Users/dev/lisp/ elephant/src/memutil/libmemutil.so /Users/dev/lisp/elephant/src/ memutil/libmemutil.c -lm
i686-apple-darwin8-gcc-4.0.1: unrecognized option '-shared'
/usr/bin/ld: Undefined symbols:
_main
collect2: ld returned 1 exit status

Upon inspection of elephant.asd, I made the following change:

(defmethod compiler-options ((compiler (eql :gcc)) (c elephant-c- source) &key input-file output-file) "Default compile and link options to create a library; no -L or - I options included; math lib as default"
  (unless (and input-file output-file)
    (error "Must specify both input and output files"))
  (list
   #-(or openmcl darwin macosx) "-shared"
   #+(or openmcl darwin macosx) "-bundle"
   "-Wall"
   "-fPIC"
   "-O3"
   "-o" output-file
   input-file
   "-lm"))

What I basically did is I added "openmcl" to the conditionalization #- and #+. After making this change, it successfully builds the libmemutil.so file. However, while the file actually exists, it fails to load with the following message:

Error opening shared library "/Users/dev/lisp/elephant/src/memutil/ libmemutil.so": dlopen(/Users/dev/lisp/elephant/src/memutil/ libmemutil.so, 10): no suitable image found. Did find: /Users/dev/lisp/elephant/src/memutil/libmemutil.so: mach-o, but wrong architecture
   [Condition of type SIMPLE-ERROR]

FYI, my *FEATURES* is:

(:KMR-NORMAL-DSDC :KMR-NORMAL-CESD :KMR-MOP :ASDF :PRIMARY- CLASSES :COMMON-LISP :OPENMCL :CLOZURE :ANSI-CL :UNIX :OPENMCL- NATIVE-THREADS :OPENMCL-PARTIAL-MOP :MCL-COMMON-MOP-SUBSET :OPENMCL- MOP-2 :OPENMCL-PRIVATE-HASH-TABLES :OPENMCL-HASH- CONSING :X86-64 :X86-64 :X86-TARGET :X86-HOST :X8664-TARGET :X8664- HOST :DARWIN-HOST :DARWIN-TARGET :DARWINX86-TARGET :DARWINX8664- TARGET :DARWINX8664-HOST :POWEROPEN-TARGET :64-BIT-TARGET :64-BIT- HOST :LITTLE-ENDIAN-TARGET :LITTLE-ENDIAN-HOST :MCL)

I don't really know why it cannot load the shared library. I don't know if the problem is basically a compat issue with this CVS version of OpenMCL in this architecture and/or UFFI. However, I thought I would share this just in case anyone has information that could speed this process or any suggestions of what I may try next.

Thanks,
Daniel

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to