Recent

Author Topic: $LINKLIB ssl and $LINKLIB crypto  (Read 2383 times)

ozznixon

  • Jr. Member
  • **
  • Posts: 85
    • http://www.modernpascal.com/
$LINKLIB ssl and $LINKLIB crypto
« on: September 22, 2018, 01:33:40 am »
Can someone refresh my memory - if I put $LINKLIB in my code, I am linking the .a into my binary - so I should not worry about dependency on another Linux box, right?

I dev on Fedora, thus have a newer OPENSSL than my production server (1.0.2m versus 1.0.1p) ... so I thought I would recompile 1.0.2m to have the .a files - link it into my binary and get around it... if it is supposed to work that way, I missed something - as the production server reports /usr/lib64/libssl.10 version_1.0.2 expected (loosely).

Project compiles w/o issue on Fedora with or without $LINKLIB. Which brings up the question, when it is linking it into my binary, what obj/dump command shows dependencies?

Thanks (been 4 years since I had to recompile this project - notes are vague).
Ozz
« Last Edit: September 22, 2018, 01:47:56 am by ozznixon »
---
Want to kick the tires to a Free Pascal like script engine? http://www.ModernPascal.com/

Basile-B

  • Sr. Member
  • ****
  • Posts: 457
Re: $LINKLIB ssl and $LINKLIB crypto
« Reply #1 on: September 22, 2018, 11:19:59 am »
I'm interested by this topic. TFPHTTPClient is affected, i don't know what to do about that.

https://bugs.freepascal.org/view.php?id=32789

petite pique;

- Savez-vous porquoi les Belges aiment la librarie standard de FreePascal ?
- Parce que la la librarie standard de FreePascal s'effrite.

sash

  • Sr. Member
  • ****
  • Posts: 287
Re: $LINKLIB ssl and $LINKLIB crypto
« Reply #2 on: September 22, 2018, 11:25:38 am »
Can someone refresh my memory - if I put $LINKLIB in my code, I am linking the .a into my binary - so I should not worry about dependency on another Linux box, right?

Yes, it should link a static library. However, those static libs in turn could have dependencies on other dynamic libs (.so) which could stay unresolved on another machine.

To show dynamic library dependencies of executable/other library use ldd:

Code: Bash  [Select]
  1. $ldd yourexecutable
  2.   linux-vdso.so.1 (0x00007ffe4519b000)
  3.   libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f467db98000)
  4.   ...
  5.  


Lazarus 2.0.6 FPC 3.0.4 x86_64-linux-gtk2 -- Ubuntu 19.10 XFCE

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7592
Re: $LINKLIB ssl and $LINKLIB crypto
« Reply #3 on: September 22, 2018, 11:33:53 am »
Afaik it only passes -lcrypto (etc) to the linker telling it to link that library (though nothing about the form)

To force static linking afaik you need -Xt:

 -Xt        Link with static libraries (-static is passed to linker)

ozznixon

  • Jr. Member
  • **
  • Posts: 85
    • http://www.modernpascal.com/
Re: $LINKLIB ssl and $LINKLIB crypto [part 2]
« Reply #4 on: September 22, 2018, 02:26:14 pm »
Thanks, the -Xt unveiled that I am also linking pthread, dl, and c. This is a single threaded application, with no support for threading - so how do I find there the pthread logic is coming from? (I am 99% sure I know where, but, it is for mutex - so I may have to refactor the code)... like the libc - that one I am stumped on what is calling anything from libc. I have tried to keep this project libc free. As I only release binaries.  :-[
---
Want to kick the tires to a Free Pascal like script engine? http://www.ModernPascal.com/

PascalDragon

  • Hero Member
  • *****
  • Posts: 711
  • Compiler Developer
Re: $LINKLIB ssl and $LINKLIB crypto
« Reply #5 on: September 22, 2018, 08:20:27 pm »
You can check your dynamically linked binary whether it requires libc. If it doesn't then it's a dependency of one of the static libraries you link against. Most probably it's the OpenSSL library that requires it...