Lazarus

Programming => General => Topic started by: RDL on January 23, 2022, 10:51:59 am

Title: Undefined symbol: atexit
Post by: RDL 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.
Title: Re: Undefined symbol: atexit
Post by: marcov 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.
Title: Re: Undefined symbol: atexit
Post by: RDL 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.
Title: Re: Undefined symbol: atexit
Post by: RDL 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?
Title: Re: Undefined symbol: atexit
Post by: Thaddy 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.
Title: Re: Undefined symbol: atexit
Post by: RDL on January 23, 2022, 04:48:24 pm
@Thaddy
I am currently trying to work with openssl 1.0.2
Title: Re: Undefined symbol: atexit
Post by: RDL 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?
Title: Re: Undefined symbol: atexit
Post by: Red_prig on January 24, 2022, 02:41:39 pm
that is compiler bug, use version FPC 3.3.1 or higher
Title: Re: Undefined symbol: atexit
Post by: RDL 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. :)
TinyPortal © 2005-2018