1

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.a

And 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.

Antonio's user avatar
Antonio
20.6k14 gold badges109 silver badges221 bronze badges
askedMar 15, 2017 at 12:47
Gabriel Martins's user avatar
3
  • 2
    Add-ldl to linker arguments?CommentedMar 15, 2017 at 13:40
  • @Casper Do you mean add a lineLIBS += -ldl on .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 statusCommentedMar 15, 2017 at 14:45
  • That I solved withLIBS += -lcrypt, thank you man, it's finally working, you should post this as the answer so I can mark it as resolvedCommentedMar 15, 2017 at 15:01

1 Answer1

1

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.

answeredMar 15, 2017 at 18:53
Casper's user avatar
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.