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

Message ListMessage List     Post MessagePost Message

  Struggling to get things working on codeblocks/Ubuntu (cannot open shared object file).
Posted by Tony on Jan-13-2023 23:29
Hi all,

I'm so close. I'm new to Linux so this is probably one of the reasons.

I've got my executable, and I've tried specifying "-Wl,-R" in both compile and linker options. My executable refuses to find libchartdir.so.7.0 no matter what I do. I've coped them into the same folder as the executable, and with the "-Wl,-R" flags, I understand it should load.

Any ideas? I assume I'm making a very simple mistake.

Thanks in advance,

Tony.

  Re: Struggling to get things working on codeblocks/Ubuntu (cannot open shared object file).
Posted by Tony on Jan-13-2023 23:31
Seems I've managed to sort it out.

If I create a lib folder in the same folder as my executable, copy all the ChartDirector files there, and then use "-Wl,-Rlib" options, it finds them.

Tony.

  Re: Struggling to get things working on codeblocks/Ubuntu (cannot open shared object file).
Posted by Tony on Jan-13-2023 23:35
Codeblocks still refuses to run the debugger on it, but it does run via a terminal. So must be something I'm missing in codeblocks.

Any suggestions are more than welcome.

Tony.

  Re: Struggling to get things working on codeblocks/Ubuntu (cannot open shared object file).
Posted by Peter Kwan on Jan-14-2023 00:40
Hi Tony,

The libchartdir.so.7 is just a standard shared object. Linux will search for it just like any other shared objects your shared executable depends on.

By default, at runtime, Linux will search for the shared object using its runtime search path. The exact search path depends on your Linux brand and version. It may include something like "/usr/lib64" or "/lib64", etc.. You can use "ldd your_exe" to determine what shared objects you executable needs and how the linker finds them.

https://man7.org/linux/man-pages/man1/ldd.1.html

The -Wl,-Rxxx flag is used to add a directory "xxx" to the runtime search path. Note that "-Wl,-R" is not valid (there is no directory). If you mean the "current directory", it should be "-Wl,-R. ".

Like in all OS, if a relative path is used, it is relative to the current working directory, which may not ne the same as the executable directory. For example, if you are in the directory "/home/abc", and you executable "/home/def/path/to/myprogram", the currently directory is "/home/abc", not "/home/def/path/to". If in "-Wl,-Rxxx", the "xxx" is relative to the executable directory, it will only work if you run the program from the executable directory.

I have never used codeblocks before. It is possible codeblocks is executing the program from another directory, so the "-Wl,-Rxxx" using a relative path "xxx" would not work. In many IDE, you can IDE to start the program in a certain directory. If codeblocks allows this, please configure it to start your executable in the executable directory.

Best Regards
Peter Kwan

  Re: Struggling to get things working on codeblocks/Ubuntu (cannot open shared object file).
Posted by Tony on Jan-15-2023 02:41
Thanks for the suggestions, I'm up and running now.

The executable was in <project>/bin/Debug, but the working folder was <project>. I cannot seem to change this in Codeblocks without creating a custom makefile, so just moved the Chartdirector libs there and now it runs.

Thanks again,

Tony.