I'm not very experienced in C ++ yet but I'm trying to embed the ruby 1.8 in a qt application, and what I did until it was to download the ruby source code and put it in a project subfolder called '3rdparty' and run./configure inside that folder and aftermake and now I'm getting the followings errors:
:-1: error: /home/gabriel/dev/ruby-exps/embed-ruby-first-tries/3rdparty/ruby-1.8.7-p374//libruby-static.a(dln.o): undefined reference to symbol 'dlclose@@GLIBC_2.2.5'
/lib/x86_64-linux-gnu/libdl.so.2:-1: error: error adding symbols: DSO missing from command line
:-1: error: collect2: error: ld returned 1 exit status
My .pro file is like this:
QT += coreQT -= guiCONFIG += c++11TARGET = embed-ruby-first-triesCONFIG += consoleCONFIG -= app_bundleTEMPLATE = appSOURCES += main.cppwin32:CONFIG(release, debug|release): LIBS += -L$$PWD/3rdparty/ruby-1.8.7-p374/release/ -lruby-staticelse:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/3rdparty/ruby-1.8.7-p374/debug/ -lruby-staticelse:unix: LIBS += -L$$PWD/3rdparty/ruby-1.8.7-p374/ -lruby-staticINCLUDEPATH += 3rdparty/ruby-1.8.7-p374DEPENDPATH += 3rdparty/ruby-1.8.7-p374win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/3rdparty/ruby-1.8.7-p374/release/libruby-static.aelse:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/3rdparty/ruby-1.8.7-p374/debug/libruby-static.aelse:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/3rdparty/ruby-1.8.7-p374/release/ruby-static.libelse:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/3rdparty/ruby-1.8.7-p374/debug/ruby-static.libelse:unix: PRE_TARGETDEPS += $$PWD/3rdparty/ruby-1.8.7-p374/libruby-static.aAnd my main.cpp file is like this:
#include <QDebug>#include <ruby.h>int main(int argc, char *argv[]){ ruby_init(); return ruby_cleanup(0);}I'm using qt 5.6 and ruby 1.8.7-p374 source, it'll be great if anyone tell me how I do to embed the ruby on a cpp program or at least help me understand what's going on.
- 2
- @Casper Do you mean add a line
LIBS += -ldlon .pro file ? I'm not sure if was that but i did it and now it started to return this errors: <br/>/home/gabriel/dev/ruby-exps/embed-ruby-first-tries/3rdparty/ruby-1.8.7-p374/string.c:4513: error: undefined reference to `crypt' <br/>:-1: error: collect2: error: ld returned 1 exit statusGabriel Martins– Gabriel Martins2017-03-15 14:45:36 +00:00CommentedMar 15, 2017 at 14:45 - That I solved with
LIBS += -lcrypt, thank you man, it's finally working, you should post this as the answer so I can mark it as resolvedGabriel Martins– Gabriel Martins2017-03-15 15:01:10 +00:00CommentedMar 15, 2017 at 15:01
1 Answer1
DSO missing from command line
This is usually a sign that you are missing some library from the linking phase. The error message is not very descriptive though.
In this caseundefined reference to symbol 'dlclose' gives a hint of which library is missing. In this casedlclose happens to be inlibdl. So adding:
-ldl...to linker options (LIBS +=) should get you closer to the solution.
Comments
Explore related questions
See similar questions with these tags.


