News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Statically link libraries

Started by geohei, January 25, 2017, 03:24:50 PM

Previous topic - Next topic

geohei

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

./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,

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Quote from: geohei on January 25, 2017, 03:24:50 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.next.codeblocks.org/index.php/topic,9996.0.html

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

geohei

#3
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.

Quote from: stahta01 on January 25, 2017, 07:33:34 PM
FYI: You can NOT statically link an dynamic library; IIRC, the ".so" means dynamic library on Linux!

Thanks for the info!

BlueHazzard

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:
Quote from: stahta01 on January 25, 2017, 06:05:39 PM
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

geohei

#5
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!