2

I'm building my qt application and on a linking stage I'm getting the following problem:

/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/../../../../lib/libQt5Network.so: undefined reference to `EC_curve_nist2nid'
collect2: error: ld returned 1 exit status

I was not getting this problem before and I have a feeling that it is in some way related to system update (though nor qt nor openssl packages were updated).

My system is Arch Linux Qt 5.5.1 openssl 1.0.2.f-1

And btw the symbol is present in libcrypto:

nm /usr/lib/libcrypto.so -C |grep EC_curve_nist2nid
00000000000e6bb0 T EC_curve_nist2nid

In case it would be helpful:

stvad@stvadpc apps %ldd /usr/lib/libQt5Network.so  
...
        libssl.so.1.0.0 => /usr/lib/libssl.so.1.0.0 (0x00007fcb68e0c000)
        libcrypto.so.1.0.0 => /usr/lib/libcrypto.so.1.0.0 (0x00007fcb68994000)
...
Stvad
  • 360
  • 2
  • 17
  • Since the symbol is present in `libcrypto.so`, it begs the questions... Are you linking against `libcrypto.so`, and is it the version you expect? – jww Feb 25 '16 at 13:43
  • I have only one version of libcrypto in the system. I don't have direct dependencies on it, but I've tried adding -lcrypto to g++ command - it didn't help. – Stvad Feb 25 '16 at 13:54
  • Well, since you seem to be including it, the last thing I can think of is: order matters... `libcrypto` must follow `libqtnetwork` (or `libqtnetwork` must proceed `libcrypto`). That is, the order on the command line must be `... -lqtnetwork -lcrypto...` because LD is a single pass linker. – jww Feb 25 '16 at 14:05
  • Just tried again both ways - getting the same error :( – Stvad Feb 25 '16 at 14:14
  • The next to last thing I would try is delete the soft links and recreate them. The *last* thing I would try is to drop ***`-L`*** and ***`-lcrypto`***, and use ***`/usr/lib/libcrypto.a`*** directly. That is, use the static archive, and not the shared object. Specify ***`/usr/lib/libcrypto.a`*** on the command line like you would any other object file. An archive is just a collection of object files.. If you're in an IDE, then look for somewhere to specify additional *object* files. For example, [How to add object files to a project in Qt](http://stackoverflow.com/q/4644643). – jww Feb 25 '16 at 14:23
  • Thank you for your help, though it eventually turned out to be some build environment quirk - creating a clean environment, getting dependencies and code from the repo and rebuilding everything helped. – Stvad Feb 26 '16 at 14:01

0 Answers0