View topic - Upgrading to openssl1.1 on qnx7.0

Page 1 of 1

Upgrading to openssl1.1 on qnx7.0

PostPosted: Thu Jan 28, 2021 7:25 pm
by emilf
Hi,

I'm working on upgrading to openssl1.1 and I have some dynamic linking issues. On the system we are working on we are using qnx7.0 and openssl1.0 with dynamic linking. All works fine. When upgrading to openssl1.1 I am linking the new libs and I added the path to the openssl folder in the makefile, however I get this:

C:/qnx700//target/qnx7/aarch64le/usr/lib/libssl1_1.so: undefined reference to `_register_ioctl_handler'
C:/qnx700//target/qnx7/aarch64le/usr/lib/libssl1_1.so: undefined reference to `_unregister_ioctl_handler'

I've read about the ioctl_handler and what I found is that this should be part of the standard libc which I even tried to include explicitly before the ssl1_1 and crypto1_1. No luck. I tried the static linking and it seemed to work, but my requirement is to do dynamic linking.

Any idea?

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Fri Jan 29, 2021 9:51 pm
by Tim
It seems that the linker is still trying to resolve the symbols at link time rather than run time since you should not get that error.

If you google for 'gcc dynamic link library undefined reference' you'll find some answers to this that you can try. I suspect you may need something like --as-needed on your link line.

Tim

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Sun Jan 31, 2021 2:38 pm
by emilf
Hi Tim,

Thank you for your reply. We were already using that flag.
set(CMAKE_EXE_LINKER_FLAGS "-pie")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--as-needed")

And since you mentioned it here I even tried to set it explicitly in the CMakeList:
set_target_properties("module_name" PROPERTIES LINK_FLAGS "-Wl,--as-needed")

And from the build I see it is set(twice after setting it explicitly):

cmd.exe /C "cd . && C:\qnx700\host\win64\x86_64\usr\bin\q++.exe -V5.4.0,gcc_ntoaarch64le -lang-c++ -O3 -DNDEBUG -O3 -DNDEBUG -pie,-Wl,--as-needed -Wl,--as-needed ....

Emil

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Mon Feb 01, 2021 4:08 pm
by Tim
Hi Emil,

I see from your link line you are compiling C++ code (-lang-c++). I bet the library you are trying to link against was compiled in C and not C++ and you are running into a C++ name mangling issue. I assume you compiled the libraries yourself? Are you sure openssl1.1 is meant to be compiled in C++ over C?

Here's the typical solution for mixing C/C++ code in shared libraries:
https://www.linuxquestions.org/question ... ry-767877/

Tim

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Mon Feb 01, 2021 4:29 pm
by emilf
Hi Tim,

We downloaded the lib from the QNX website (com.qnx.sdp.target.net.openssl1_1_7.0.5857.S202004282126.qpkg). Didn't compile it ourselves. I hope you are right, because I tried a lot of things and failed so many times. Thanks again for your reply, I'll see what is to be done in our system and if it works.

Thanks,
Emil

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Mon Feb 01, 2021 6:26 pm
by Tim
That link doesn't open anything for me. It just complains it can't find that site. Are you logged in to the QNX S/W center when you are doing it (I'm working from home right now)?

I'd try removing the -lang-c++ part and recompiling and linking everything again.

Tim

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Mon Feb 01, 2021 7:26 pm
by emilf
Sorry Tim, that wasn't a link, it was the name of the archive. The person that downloaded it, has an account. I don't think you can take it directly.

EDIT: By the way, the ssl lib is linked to several other files implemented in C++. If I remove the -lang-c++ I'm not sure I will be able to build the rest.

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Tue Feb 02, 2021 3:43 pm
by Tim
If there are other files implemented in C++ then you'll have no choice other than to try the suggested solution of

extern "C" {
#include "vl/sift.h"
}

around all the include files that reference the SSL lib and see if that works.

Tim

Re: Upgrading to openssl1.1 on qnx7.0

PostPosted: Tue Feb 02, 2021 4:01 pm
by emilf
Hi Tim,

Thanks a lot for all your help. We found out that this openssl lib required a newer version of qnx (7.0.4). After upgrading, the problem went away. (huge facepalm)
It was a stupid thing, but at least we fixed the issue and I learned quite a few things. Thanks again for all your suggestions.

Emil