Recent

Author Topic: Undefined symbol: atexit  (Read 3300 times)

RDL

  • Jr. Member
  • **
  • Posts: 71
Undefined symbol: atexit
« on: January 23, 2022, 10:51:59 am »
Hello.

Linux Arch + Lazarus 2.2.0 + Cross Win64

I am trying to statically link libcrypto.a and libssl.a
But when compiling I get an error "Undefined symbol: atexit"  :'(

I wrote a demo project with which you can repeat this mistake.

To get libcrypto.a and libssl.a you need to compile OpenSSL 1.0.2:

./Configure mingw64 --cross-compile-prefix=x86_64-w64-mingw32- mingw64
make

the files will be in the root of the openssl directory, they need to be put in the directory with the project

Can someone suggest how to fix it?

thanks in advance.
« Last Edit: January 23, 2022, 04:46:37 pm by RDL »
Sorry for my english, google translation!

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11351
  • FPC developer.
Re: Undefined symbol: atexit
« Reply #1 on: January 23, 2022, 11:15:24 am »
Make sure your EXE links to all the relevant mingw libraries that are dependencies. mingw's libc and mingwex etc. You might want to look at the packages/gdbint/src package, because that linked mingw libraries statically in the past.

RDL

  • Jr. Member
  • **
  • Posts: 71
Re: Undefined symbol: atexit
« Reply #2 on: January 23, 2022, 03:47:36 pm »
@marcov
@jamie


Yes, all registers are respected.
I added
Code: Pascal  [Select][+][-]
  1. {$linklib /usr/x86_64-w64-mingw32/lib/libmsvcr120.a}
and the demo project compiled.

But my real project doesn't compile and throws a different error. I will finish the demo project later to show it to you.
Sorry for my english, google translation!

RDL

  • Jr. Member
  • **
  • Posts: 71
Re: Undefined symbol: atexit
« Reply #3 on: January 23, 2022, 04:35:24 pm »
I updated the demo project.
The whole point is that if you refer to any procedure / function openssl in the code, then the project does not compile.

If between begin - end remove
Code: Pascal  [Select][+][-]
  1. OpenSSL_add_all_ciphers;
The project will compile successfully.

Any ideas about this?
« Last Edit: January 23, 2022, 04:38:44 pm by RDL »
Sorry for my english, google translation!

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: Undefined symbol: atexit
« Reply #4 on: January 23, 2022, 04:44:54 pm »
Yes, openssl deprecated a lot of cyphers in recent versions, but they are still in the Pascal bindings/header file.
The minimum is now tls 1.1. the recommended is tls 1.3.
« Last Edit: January 23, 2022, 04:46:43 pm by Thaddy »
Specialize a type, not a var.

RDL

  • Jr. Member
  • **
  • Posts: 71
Re: Undefined symbol: atexit
« Reply #5 on: January 23, 2022, 04:48:24 pm »
@Thaddy
I am currently trying to work with openssl 1.0.2
Sorry for my english, google translation!

RDL

  • Jr. Member
  • **
  • Posts: 71
Re: Undefined symbol: atexit
« Reply #6 on: January 24, 2022, 02:21:12 pm »
Spent all day again today trying to get rid of the error from "demo2'

Code: Pascal  [Select][+][-]
  1. project1.lpr(16,1) Error: Internal error 200603061

But all my attempts are unsuccessful

Does anyone have any idea?
Sorry for my english, google translation!

Red_prig

  • Full Member
  • ***
  • Posts: 143
Re: Undefined symbol: atexit
« Reply #7 on: January 24, 2022, 02:41:39 pm »
that is compiler bug, use version FPC 3.3.1 or higher

RDL

  • Jr. Member
  • **
  • Posts: 71
Re: Undefined symbol: atexit
« Reply #8 on: January 24, 2022, 03:04:22 pm »
@Red_prig
I updated FPC to version 3.3.1
My demo project "demo2" compiled successfully.
In addition, my real project is also successfully compiled and works great.
Thanks a lot to all the participants. :)
Sorry for my english, google translation!

 

TinyPortal © 2005-2018