ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Unable to link to libs on Ubuntu builds
Posted by DC Kelley on Mar-21-2018 04:13
Peter
I am having much the same issues as I try and bring up anotherwise stable CD project from Windows 32/64 built on Ubuntu.

> We use ".dll" as the extension for Linux as well as Windows so that we can use
> the same "php.ini" in both Linux and Windows.

Here we are still using ChartDirector 6 and all I see in the /lib folder are twp symbolic links back to libchartdir.so.6.0.0      Am I missing something or perhaps the use of DLL on Unix is release seven change?

More to the core issue, when I look at any of the *.pro files for the provided qtdemo examples, none of them seem to mention the llib or a path for where to get it

I see the normal wins stuff
  win32:DESTDIR = $$PWD
  win32:LIBS += ../../lib/chartdir60.lib
  win32:QMAKE_POST_LINK += copy /Y ....libchartdir60.dll "$$PWD"

But honestly I have no idea how the libchartdir.so.6.0.0 - whow (or why) does this work and perhaps it depends on a specific folder relationship?

As always, many thanks for your tireless support. DC Kelley

  Re: Unable to link to libs on Ubuntu builds
Posted by Peter Kwan on Mar-21-2018 19:00
Hi DC Kelly,

The [We use ".dll" as the extension for Linux as well as Windows] is for PHP. PHP uses loadable modules. It is not the same as C++, in which your code needs to link to the dynamic libraries.

The people who built PHP cannot know all possible PHP extensions that exists in the world. So when compiling PHP, it cannot link to all PHP possible extensions. The PHP needs to load those modules at runtime without linking to it during compilation. These loadable modules can use any extension, not necessarily DLL or SO. The Linux OS itself sometimes use KO or other extensions.

For C++ applications, it is different. Normally, C++ applications will link to the dynamic library during compilation. If this is the case, it need to follow the operating system rules for linking. For Linux, it needs to use ".so" as the extension. On Windows, it must be ".dll" and on Mac OS X, it must be ".dylib".

In our own sample code, the part of the Qt project file that is application for Linux is:

unix:!macx:LIBS += -L../../lib -lchartdir
unix:!macx:QMAKE_RPATHDIR += ../../lib

The above means during linking, it will add "../../lib" to the library search path, and link to the library "libchartdir.so". It also instructs the operating system to add "../../lib" to the library search path during runtime.  (The "-lchartdir" means link to libchartdir.so. The linker automatically add "lib" in front and use ".so" as the extension.)

The symbolic links to libchartdir.so.6.0.0 related to Linux rules on version control. If you look at the "/usr/lib" or "/usr/lib64", you will see that virtually all Linux shared objects are distributed this way.

Hope this can help.

Regards
Peter Kwan

  Re: Unable to link to libs on Ubuntu builds
Posted by DC Kelley on Mar-21-2018 20:14
Duh on my part!  I completely missed the basic point that

   unix:!macx{

should be read as "any UNIX OS that is not MacX, i.e. Debian Linux, i.e. Ubuntu"  and now I see the relative path to it.    Know how to proceed now, many thanks Peter.  DCK