0

This is slightly academic as I've resolved it (I think!), but curious if anyone knows why it's happened.

I'm working on a project that has been developed for a few years, we have a couple of libraries we depend on, for example:

myencryption.so
|
 ----- #include <openssl/sha.h>

mymainapp
|
----- LIBS += -lmyencryption -lssl -lcrypto

When it fails it fails with messages like this:

../../bin/libbcencryption.so: undefined reference to `SHA256_Update'
../../bin/libbcencryption.so: undefined reference to `SHA256_Final'
../../bin/libbcencryption.so: undefined reference to `SHA256_Init'

That used to work and build fine, now we're moving our platform forward and GCC 4.6 is the latest version available it causes significant build issues with linking the libraries in this way, but only when the library is linked against a binary. Now to get the build to work it's structured:

myencryption.so
|
 ----- #include <openssl/sha.h>
 ----- LIBS += -lssl -lcrypto

Which works fine. Other things like references to Qt libraries that were never needed in compilation before are also required.

I can't find any reference to something changing like this in the GCC release notes however so I'm definitely curious if anyone knows if it has changed or whether another factor might be involved, so it's a Qt based project that's move from a base platform of Ubuntu 11.04 to 12.10, and the GCC version has gone from 4.5.2 to 4.6.3. Nothing in the build process aside from whatever upgrades have come through in Ubuntu has changed.

EDIT: It looks like the answer referenced in the comments comes close to explaining the issue, with an update to ld causing the headache.

Nicholas Smith
  • 11,642
  • 6
  • 37
  • 55
  • 1
    Might be this: http://stackoverflow.com/questions/8725572/gcc-4-5-vs-4-4-linking-with-dependencies - but that was supposed to have appeared in 4.5. Not certain though, and Ubuntu might have had patches in. – Mat Mar 13 '13 at 11:18
  • That's pretty close actually, food for thought anyway but the recommendation of 'link both libraries' is slightly different from mine. Possibly down the same path though. – Nicholas Smith Mar 13 '13 at 11:30
  • Hard to say precisely what the issue is without having a more precise description of your issue (i.e. exact compiler/linker commands and error messages). – Mat Mar 13 '13 at 11:34
  • Good point, I'll add some more information. – Nicholas Smith Mar 13 '13 at 12:22

0 Answers0