Author Topic: Statically link libraries  (Read 6456 times)

Offline geohei

  • Single posting newcomer
  • *
  • Posts: 7
Statically link libraries
« on: January 25, 2017, 03:24:50 pm »
Hi.

I guess users of this forum are able to help:
http://stackoverflow.com/questions/41618835/mysql-library-error-on-different-hardware

I'd like to get rid of this error/warning ...

Code
./mybin: /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18: no version information available (required by ./mybin)

... by statically linking the libmysqlclient.so library. But following the linked postings didn't do anything!

Any ideas why?

Thanks,

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: Statically link libraries
« Reply #2 on: January 25, 2017, 07:33:34 pm »
... by statically linking the libmysqlclient.so library. But following the linked postings didn't do anything!

FYI: You can NOT statically link an dynamic library; IIRC, the ".so" means dynamic library on Linux!

Please read the rules before you get banned http://forums.codeblocks.org/index.php/topic,9996.0.html

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline geohei

  • Single posting newcomer
  • *
  • Posts: 7
Re: Statically link libraries
« Reply #3 on: January 27, 2017, 11:35:54 am »
Hi.

I read the rules at the registration process.

This posting was not about ...
1. a programming issue.
2. a compiler/linker error.
3. being too lazy to search Google or this forum.

I believed it was a Code::Blocks manipulation problem from my side, id est me making a mistake inside the Code::Blocks GUI in order to link a library. So I was asking for help in doing that, and not asking for general programming / compiler / linker help.

Sorry if what I tried was not possible, but I simply followed the stackoverflow article (I linked in OP), which didn't work for me.

FYI: You can NOT statically link an dynamic library; IIRC, the ".so" means dynamic library on Linux!

Thanks for the info!
« Last Edit: January 27, 2017, 11:38:04 am by geohei »

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3353
Re: Statically link libraries
« Reply #4 on: January 27, 2017, 01:22:52 pm »
C::B per se has nothing to do with all this. Codeblocks invokes the compiler with the flags you provide. If you provide the flags for static linking or dynamic linking codeblocks will give them to to linker/compiler....

You question is WHAT flags do you need to make the compiler link this library statically. This kind of question are not allowed. You can ask WHERE you have to apply the linker flag "--static" in codeblocks...

Aside from this fussy formality...
To help you we always need the rebuild log as described here:
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F

You can't link a .so library: see http://stackoverflow.com/a/725550

So you need a static version of your library. I don't know where you can get that, probably you have to compile the library into a static library
If you have the static library you can replace your so file in the linker options with the static version...

greetings

Offline geohei

  • Single posting newcomer
  • *
  • Posts: 7
Re: Statically link libraries
« Reply #5 on: February 04, 2017, 10:29:18 am »
Understood.

I actually installed Ubuntu 12.04 on a VM and recompiled.
Not very elegant, but life isn't perfect ... :)
This (of course) fixed the issue, but as I said, initially I believed it was a C::B manip issue on my side.

Thanks for your answers!
« Last Edit: February 04, 2017, 11:09:54 am by geohei »