[Ecls-list] Segfault when a C++ member tries to load a new library
Erik Winkels
aerique at xs4all.nl
Wed Dec 10 08:19:34 UTC 2008
Hey,
I've posted this on the Ogre forums as well
(http://www.ogre3d.org/phpBB2/viewtopic.php?p=318468#318468)
I'm trying to use the Ogre3D library from ECL but I haven't been able to
come very far :) ECL segfaults when I give Ogre the command to load an
external library. (The same thing does work directly from C++).
Ogre is a C++ library by the way.
I actually had the same problem in SBCL with Swig bindings I had created.
What follows is a cut & paste from the abovementioned forum post:
At the moment I'm not at the machine I'm developing the bindings on so I
can't get you gdb or strace output unfortunately. I did use them though
(although I'm not very familiar with them.. though I probably will be in
the near future :) ). Ogre.log shows the same (can't get at it atm
either) except it complains it can't find a plugins.cfg.
Fun fact: it did infact load the plugin once succesfully when running
ECL from strace ("strace ecl") but I wasn't able to reproduce it.
("strace -e trace=open ecl" always gave the same error like below)
I'm basically hoping someone else who'se made language bindings has run
into this same problem and knows the solution.
[b]Note:[/b] The pastes below use Ogre 1.6.0 which I decided to try
yesterday but I had the same problem with 1.4.9. There's also some
commented out code and random Ogre::String stuff since I was trying out
different things.
Here's the C++ program and its output:
[code]// ogre-test.cpp
//
// Compile with: g++ `pkg-config --cflags --libs OGRE` ogre-test.cpp
#include "Ogre.h"
int main (int argc, char *argv[])
{
//Ogre::Root* ogre = new Ogre::Root( "", "" );
Ogre::Root* ogre = new Ogre::Root();
ogre->loadPlugin(Ogre::String("RenderSystem_GL"));
return 0;
}[/code]
[code]$ ./a.out
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
FreeImage version: 3.10.0
This program uses FreeImage, a free, open source image library
supporting all common bitmap
formats. See http://freeimage.sourceforge.net for details
Supported formats:
bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,
pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,
xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
DDS codec registering
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
plugins.cfg not found, automatic plugin loading disabled.
*-*-* OGRE Initialising
*-*-* Version 1.6.0 (Shoggoth)
Loading library RenderSystem_GL
Installing plugin: GL RenderSystem
OpenGL Rendering Subsystem created.
Plugin successfully installed[/code]
Here's the ECL binding and its output:
[code](defun ffi-ogre-root ()
(if *ogre*
*ogre*
(setf *ogre* (ffi:c-inline () () :pointer-void "new Ogre::Root()"
:one-liner t))))
(defun ffi-ogre-root-load-plugin (plugin)
(ffi:c-inline (*ogre* plugin) (:pointer :cstring) :void "{
Ogre::Root* ogre = (Ogre::Root*) #0;
//ogre->loadPlugin(Ogre::String(plugin));
ogre->loadPlugin(\"RenderSystem_GL\");
}"))[/code]
[code]ECL (Embeddable Common-Lisp) 0.9l (CVS 2008-06-19 17:09)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help. Top level.
CL-USER[1]> (load "init")
;;; Loading #P"/usr/local/pub/ekwis/software/okra-0.1/init.lisp"
; loading system definition from ogre-test.asd into #<ASDF0 package>
;;; Loading "/usr/local/pub/ekwis/software/okra-0.1/ogre-test.asd"
; registering #<ASDF:SYSTEM :OGRE-TEST 163091992> as OGRE-TEST
;;; Loading "/usr/local/pub/ekwis/software/okra-0.1/specials.fas"
;;; Loading "/usr/local/pub/ekwis/software/okra-0.1/ffi.fas"
;;; Loading "/usr/local/pub/ekwis/software/okra-0.1/ogre-test.fas"
#P"/usr/local/pub/ekwis/software/okra-0.1/init.lisp"
CL-USER[2]> (ffi-ogre-root)
Creating resource group General
Creating resource group Internal
Creating resource group Autodetect
SceneManagerFactory for type 'DefaultSceneManager' registered.
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
MovableObjectFactory for type 'ParticleSystem' registered.
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
FreeImage version: 3.10.0
This program uses FreeImage, a free, open source image library
supporting all common bitmap
formats. See http://freeimage.sourceforge.net for details
Supported formats:
bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,
pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,
xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2
DDS codec registering
Registering ResourceManager for type HighLevelGpuProgram
Registering ResourceManager for type Compositor
MovableObjectFactory for type 'Entity' registered.
MovableObjectFactory for type 'Light' registered.
MovableObjectFactory for type 'BillboardSet' registered.
MovableObjectFactory for type 'ManualObject' registered.
MovableObjectFactory for type 'BillboardChain' registered.
MovableObjectFactory for type 'RibbonTrail' registered.
plugins.cfg not found, automatic plugin loading disabled.
*-*-* OGRE Initialising
*-*-* Version 1.6.0 (Shoggoth)
#<foreign :VOID 09c52008>
CL-USER[3]> (ffi-ogre-root-load-plugin "RenderSystem_GL")
Loading library RenderSystem_GL
Segmentation violation.
Broken at SI:BYTECODES.No restarts available.
Broken at SI:BYTECODES.
** BREAK [LEVEL 2] >[/code]
More information about the ecl-devel
mailing list