[Openmcl-devel] oprofile and libelf

Gary Byers gb at clozure.com
Mon Apr 6 23:13:08 PDT 2009


see the thread starting with:

<http://clozure.com/mailman/htdig/openmcl-devel/2008-October/008563.html>

Short version: many Linux distributions provide two similar but
incompatible implementations of a "libelf" shared library; one
of them has version numbers of the form "0.13x" or thereabouts,
and the other has version numbers of the form "0.8.x".  (This was
true as of 6 months or so ago; both sets of version numbers may
have been bumped a few times since.)

The oprofile stuff expects the version with a "0.13x"-style version
number.  (I don't know what the differences are or what would be
involved in getting the oprofile symbol-writing stuff working with
the other libelf.)

I also don't know exactly what the packaging system that your Linux
distribution uses calls the package that contains the "right" version
of libelf, so getting that package installed may involve some trial
and error.

On Tue, 7 Apr 2009, Osei Poku wrote:

> Hi,
>
> Trying to follow: http://ccl.clozure.com/manual/chapter11.1.html for
> enabling profiling in ccl using oprofile...
>
> Calling (ccl::write-elf-symbols-to-file "/home/opoku/elf-symbols")
> fails though with the error...
>
> "Error: Can't initialize libelf object for "/home/opoku/elf-symbols":
> Request error: invalid ELF_C_* argument"
> > While executing: CCL::CREATE-ELF-OBJECT, in process listener(1).
> > Type :POP to abort, :R for a list of available restarts.
> > Type :? for other options.
> 1 > :b
>  (2AAAAACBBA58) : 0 (CREATE-ELF-OBJECT "/home/opoku/elf-symbols") 485
>  (2AAAAACBBA88) : 1 (WRITE-ELF-SYMBOLS-TO-FILE "/home/opoku/elf-
> symbols") 53
>  (2AAAAACBBAC0) : 2 (CALL-CHECK-REGS CCL::WRITE-ELF-SYMBOLS-TO-FILE "/
> home/opoku/elf-symbols") 229
>  (2AAAAACBBAF8) : 3 (TOPLEVEL-EVAL (CCL::WRITE-ELF-SYMBOLS-TO-FILE "/
> home/opoku/elf-symbols") NIL) 733
>  (2AAAAACBBB98) : 4 (READ-LOOP :INPUT-STREAM #<SYNONYM-STREAM to
> *TERMINAL-IO* #x300040EF424D> :OUTPUT-STREAM #<SYNONYM-STREAM to
> *TERMINAL-IO* #x300040EF40ED> :BREAK-LEVEL 0 :PROMPT-FUNCTION
> #<Compiled-function (:INTERNAL CCL::READ-LOOP) (Non-Global)
> #x3000405448FF>) 2053
>  (2AAAAACBBDD8) : 5 (TOPLEVEL-LOOP) 109
>  (2AAAAACBBE08) : 6 (FUNCALL #'#<(:INTERNAL (TOPLEVEL-FUNCTION
> (CCL::LISP-DEVELOPMENT-SYSTEM T)))>) 101
>  (2AAAAACBBE20) : 7 (FUNCALL #'#<(:INTERNAL CCL::MAKE-MCL-LISTENER-
> PROCESS)>) 645
>  (2AAAAACBBEB8) : 8 (RUN-PROCESS-INITIAL-FORM #<TTY-LISTENER
> listener(1) [Active] #x300040EF2F9D> (#<COMPILED-LEXICAL-CLOSURE #
> #x300040EF2CAF>)) 717
>  (2AAAAACBBF48) : 9 (FUNCALL #'#<(:INTERNAL CCL::%PROCESS-PRESET-
> INTERNAL)> #<TTY-LISTENER listener(1) [Active] #x300040EF2F9D>
> (#<COMPILED-LEXICAL-CLOSURE # #x300040EF2CAF>)) 389
>  (2AAAAACBBF98) : 10 (FUNCALL #'#<(:INTERNAL CCL::THREAD-MAKE-STARTUP-
> FUNCTION)>) 301
>
> I don't see why though, ccl:library:elf.lisp... this is create-elf-
> object and ELF_C_WRITE is defined in the the libelf.h header file as a
> valid command.  My system is using version 0.8.6. and ccl version
> Version 1.3-RC1-r11885M.
>
> (defun create-elf-object (pathname)
>   (let* ((namestring (native-translated-namestring pathname))
>          (fd (ccl::fd-open namestring
>                            (logior #$O_RDWR #$O_CREAT #$O_TRUNC)
>                            #o755)))
>     (if (< fd 0)
>       (signal-file-error fd pathname)
>       (progn
>         (check-libelf-version)
>         (let* ((ptr (#_elf_begin fd #$ELF_C_WRITE +null-ptr+)))
>           (if (%null-ptr-p ptr)
>             (error "Can't initialize libelf object for ~s: ~a"
>                    pathname (libelf-error-string))
>             (make-elf-object :libelf-pointer (assert-pointer-type
> ptr :<E>lf)
>                              :fd fd
>                              :pathname pathname)))))))
>
>
> Thanks,
>
> Osei
> _______________________________________________
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
> http://clozure.com/mailman/listinfo/openmcl-devel
>
>



More information about the Openmcl-devel mailing list