PDA

View Full Version : error when i compile examples



kachan
09-28-2013, 07:38 PM
i install ClanLib 3.0


./configure --prefix=/usr
make
sudo make install

then i want to compile examples, i go to Examples/Display/Basics2d, do make and have an error

Original
g++ `pkg-config --cflags clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0 clanSWRender-3.0` -pthread Sources/basic2d.o Sources/precomp.o Sources/program.o -o basic2d `pkg-config --libs clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0 clanSWRender-3.0`
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libclan30GL.so: error: undefined reference to 'dlsym'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libclan30Display.so: error: undefined reference to 'dlopen'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libclan30Display.so: error: undefined reference to 'dlclose'
collect2: ошибка: выполнение ld завершилось с кодом возврата 1
make: *** Ошибка 1
[B]Translated by google translate
g++ `pkg-config --cflags clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0 clanSWRender-3.0` -pthread Sources/basic2d.o Sources/precomp.o Sources/program.o -o basic2d `pkg-config --libs clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0 clanSWRender-3.0`
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libclan30GL.so: error: undefined reference to 'dlsym'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libclan30Display.so: error: undefined reference to 'dlopen'
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/libclan30Display.so: error: undefined reference to 'dlclose'
collect2: ERROR: Execution completed with code ld Return 1
make: *** [basic2d] Error 1

Linux, Xubuntu 13.10
how to fix this problem?
Sorry for my english, im from Ukraine and 17 years old

rombust
09-28-2013, 08:05 PM
I am not sure why it's not working on just your machine. It shouldn't work on all machines !

The linker is missing: "-ldl" (see http://linux.die.net/man/3/dlopen)

Two easy ways of fixing it.

1) Change in configure.ac
extra_LIBS_clanDisplay=" -lX11 $extra_LIBS_clanDisplay "
to
extra_LIBS_clanDisplay=" -lX11 -ldl $extra_LIBS_clanDisplay "

Run "./autogen.sh"
./configure --prefix=/usr
touch Sources/Display/display.cpp # Not sure if this is required to update the pkgconfig's
make -j9
sudo install

2) Edit "../../Makefile.conf" , adding -ldl for the linker (This fix will be lost when ./configure is reran or ./autogen.sh is run, if I remember correctly)

kachan
09-29-2013, 01:50 AM
i choose first way, compile some exapmles and it works perfectly. Thanks for lib and thanks for help.

kachan
09-29-2013, 10:16 AM
when i compile Examples/3D/Object3D i have an error

kachan@kachans:~$ cd ClanLib-3.0.0/Examples/3D/Object3D/
kachan@kachans:~/ClanLib-3.0.0/Examples/3D/Object3D$ make
g++ -I./ -I Sources `pkg-config --cflags clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0` -pthread ./Sources/example.o ./Sources/program.o ./Sources/shader.o ./Sources/precomp.o -o object3d `pkg-config --libs clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0` -lassimp
/usr/bin/ld: error: cannot find -lassimp
./Sources/example.o:example.cpp:function App::start(std::vector<std::string, std::allocator<std::string> > const&): error: undefined reference to 'GraphicStore::GraphicStore(clan::GraphicContext&)'
./Sources/example.o:example.cpp:function App::start(std::vector<std::string, std::allocator<std::string> > const&): error: undefined reference to 'GraphicStore::~GraphicStore()'
./Sources/example.o:example.cpp:function App::start(std::vector<std::string, std::allocator<std::string> > const&): error: undefined reference to 'GraphicStore::~GraphicStore()'
./Sources/example.o:example.cpp:function App::render(clan::GraphicContext&): error: undefined reference to 'Scene::Draw(clan::Mat4<float>&, clan::GraphicContext&)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::Model(clan::GraphicContext&, GraphicStore*, char const*, bool)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::Model(clan::GraphicContext&, GraphicStore*, char const*, bool)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::Model(clan::GraphicContext&, GraphicStore*, char const*, bool)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::SetMaterial(float, clan::Vec4<float> const&, clan::Vec4<float> const&, clan::Vec4<float> const&)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::SetMaterial(float, clan::Vec4<float> const&, clan::Vec4<float> const&, clan::Vec4<float> const&)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'GraphicStore::LoadImages(clan::GraphicContext&)'
./Sources/example.o:example.cpp:function App::update_light(clan::GraphicContext&): error: undefined reference to 'SceneObject::GetWorldMatrix(clan::Mat4<float>&)'
./Sources/example.o:example.cpp:function App::update_light(clan::GraphicContext&): error: undefined reference to 'ShaderTexture::SetLight(clan::Vec3<float>&, clan::Vec4<float>&, clan::Vec4<float>&, clan::Vec4<float>&)'
./Sources/example.o:example.cpp:function App::calculate_matricies(clan::GraphicContext&): error: undefined reference to 'SceneObject::GetWorldMatrix(clan::Mat4<float>&)'
./Sources/example.o:example.cpp:function App::calculate_matricies(clan::GraphicContext&): error: undefined reference to 'SceneObject::GetWorldMatrix(clan::Mat4<float>&)'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Scene::Scene()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Model::Model()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Model::Model()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Model::Model()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Scene::~Scene()'
./Sources/program.o:program.cpp:function App::~App(): error: undefined reference to 'Scene::~Scene()'
collect2: ошибка: выполнение ld завершилось с кодом возврата 1
make: *** [object3d] Ошибка 1

how to fix than?
And what meshes can load ClanLib? Collada?

kachan
09-29-2013, 10:54 AM
when i compile Examples/3D/Object3D i have an error


kachan@kachans:~$ cd ClanLib-3.0.0/Examples/3D/Object3D/
kachan@kachans:~/ClanLib-3.0.0/Examples/3D/Object3D$ make
g++ -I./ -I Sources `pkg-config --cflags clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0` -pthread ./Sources/example.o ./Sources/program.o ./Sources/shader.o ./Sources/precomp.o -o object3d `pkg-config --libs clanApp-3.0 clanDisplay-3.0 clanCore-3.0 clanGL-3.0` -lassimp
/usr/bin/ld: error: cannot find -lassimp
./Sources/example.o:example.cpp:function App::start(std::vector<std::string, std::allocator<std::string> > const&): error: undefined reference to 'GraphicStore::GraphicStore(clan::GraphicContext&)'
./Sources/example.o:example.cpp:function App::start(std::vector<std::string, std::allocator<std::string> > const&): error: undefined reference to 'GraphicStore::~GraphicStore()'
./Sources/example.o:example.cpp:function App::start(std::vector<std::string, std::allocator<std::string> > const&): error: undefined reference to 'GraphicStore::~GraphicStore()'
./Sources/example.o:example.cpp:function App::render(clan::GraphicContext&): error: undefined reference to 'Scene::Draw(clan::Mat4<float>&, clan::GraphicContext&)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::Model(clan::GraphicContext&, GraphicStore*, char const*, bool)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::Model(clan::GraphicContext&, GraphicStore*, char const*, bool)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::Model(clan::GraphicContext&, GraphicStore*, char const*, bool)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'SceneObject::SceneObject(Scene&, SceneObject*)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::SetMaterial(float, clan::Vec4<float> const&, clan::Vec4<float> const&, clan::Vec4<float> const&)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'Model::SetMaterial(float, clan::Vec4<float> const&, clan::Vec4<float> const&, clan::Vec4<float> const&)'
./Sources/example.o:example.cpp:function App::create_scene(clan::GraphicContext&): error: undefined reference to 'GraphicStore::LoadImages(clan::GraphicContext&)'
./Sources/example.o:example.cpp:function App::update_light(clan::GraphicContext&): error: undefined reference to 'SceneObject::GetWorldMatrix(clan::Mat4<float>&)'
./Sources/example.o:example.cpp:function App::update_light(clan::GraphicContext&): error: undefined reference to 'ShaderTexture::SetLight(clan::Vec3<float>&, clan::Vec4<float>&, clan::Vec4<float>&, clan::Vec4<float>&)'
./Sources/example.o:example.cpp:function App::calculate_matricies(clan::GraphicContext&): error: undefined reference to 'SceneObject::GetWorldMatrix(clan::Mat4<float>&)'
./Sources/example.o:example.cpp:function App::calculate_matricies(clan::GraphicContext&): error: undefined reference to 'SceneObject::GetWorldMatrix(clan::Mat4<float>&)'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Scene::Scene()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Model::Model()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Model::Model()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Model::Model()'
./Sources/program.o:program.cpp:function App::App(): error: undefined reference to 'Scene::~Scene()'
./Sources/program.o:program.cpp:function App::~App(): error: undefined reference to 'Scene::~Scene()'
collect2: ошибка: выполнение ld завершилось с кодом возврата 1
make: *** [object3d] Ошибка 1

Assimp 3
how to fix?

rombust
09-29-2013, 05:29 PM
See http://clanlib.org/assimp-linux.html