-
Notifications
You must be signed in to change notification settings - Fork 652
Conversation
moved |
|
Should be fixed now. Their example code had the wrong case in the header filename. windows... |
|
Ok, finally got an osx vm up to debug this, and I don't get what's going on here at all. It works on every other platform, and I used an object inspector to make sure the symbol was there and it is.
It's just a struct, declared here: https://github.com/hunter-packages/libtomcrypt/blob/1.17-p1/src/misc/crypt/crypt_ltc_mp_descriptor.c and declared as extern here: https://github.com/hunter-packages/libtomcrypt/blob/1.17-p1/src/headers/tomcrypt_math.h#L416 Is there some weirdness on osx around extern structs? Do I need to do some equivalent of the windows style declspec dllimport crap? @ruslo any idea what's going on here, because I'm stumped :( |
Library source is C and you're using it in C++ example. I guess we need |
But the whole thing is only ever included through tomcrypt.h: https://github.com/hunter-packages/libtomcrypt/blob/1.17-hunter/src/headers/tomcrypt.h#L73 , which has an extern c wrapper: https://github.com/hunter-packages/libtomcrypt/blob/1.17-hunter/src/headers/tomcrypt.h#L15 |
Are we talking about tomcrypt or stormlib? :) In |
I'm not sure which package contains the problem :( Those files are getting the definition of the ltc_mp symbol from https://github.com/hunter-packages/StormLib/blob/v9.21_hunter/src/StormCommon.h#L49 and https://github.com/hunter-packages/StormLib/blob/v9.21_hunter/src/libtomcrypt/src/pk/rsa/rsa_verify_simple.c#L11 , so it should be picking up on the extern "C" from there, and indeed it works on linux and windows. |
Looks weird indeed. Add usage of |
oooook, so (hesistant to say this but), this looks like it might a linker bug? I added an extra symbol into that file, so: diff --git a/src/headers/tomcrypt_math.h b/src/headers/tomcrypt_math.h
index aee6105..ba60fba 100644
--- a/src/headers/tomcrypt_math.h
+++ b/src/headers/tomcrypt_math.h
@@ -414,6 +414,7 @@ typedef struct {
} ltc_math_descriptor;
extern ltc_math_descriptor ltc_mp;
+extern int testInt;
int ltc_init_multi(void **a, ...);
void ltc_deinit_multi(void *a, ...);
diff --git a/src/misc/crypt/crypt_ltc_mp_descriptor.c b/src/misc/crypt/crypt_ltc_mp_descriptor.c
index 0577d1d..f0c781f 100644
--- a/src/misc/crypt/crypt_ltc_mp_descriptor.c
+++ b/src/misc/crypt/crypt_ltc_mp_descriptor.c
@@ -11,3 +11,5 @@
#include "tomcrypt.h"
ltc_math_descriptor ltc_mp;
+
+int testInt = 500; ^Added testInt to the .c and the header. Then I made an example program: #include <tomcrypt.h>
int main(int argc, char** argv)
{
ltc_mp = ltm_desc;
printf("%d\n", testInt);
printf("%s\n", ltc_mp.name);
return 0;
} And this works just fine, links perfectly and prints:
As you might expect. But, if I comment out the first printf, the one using testInt, it fails to link. So, yeah, how should I proceed on this? Am I misunderstanding some subtlety of the osx linker? |
Might be. Try to create SSCCE and if linker will fail in this case you can open bugreport.
I don't think so. Code looks good, error is weird.
Up to you. You can exclude OSX from testing or if adding dummy |
Minimal example here: https://gist.github.com/wheybags/0cf9abe991d1c667e5218bf59ab24649 |
Makefile, really? :)
Latest Xcode 9 available on Travis. GitHub + Travis: |
Hey, it was either that or a shell script :p
Ok, I'll send a bug report to apple I guess, and in the meantime I'll add
some nasty hacky workarounds to the libtomcrypt and stormlib packages
Thanks!
…On Thu, Aug 3, 2017 at 2:31 PM, Ruslan Baratov ***@***.***> wrote:
Minimal example here
Makefile, really? :)
I'm using yosemite, if you have access to the newest version of osx/xcode,
would you mind verifying this?
Latest Xcode 9 available on Travis.
GitHub + Travis:
- https://github.com/forexample/osx-extern-struct-linker-error
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#877 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABCumnffuozoMrwu8ca67ZixnKpV0NMCks5sUcuUgaJpZM4OY_DU>
.
|
Ok, so updated with a workaround someone pointed out to me on IRC (forgot your name workaround guy, sorry :( ) |
@@ -108,11 +108,12 @@ hunter_config(SDL2 VERSION 2.0.4-p4) | |||
hunter_config(SDL_mixer VERSION 2.0.1-p1) | |||
hunter_config(SQLite3 VERSION autoconf-3080803) #R-Tree enabled | |||
hunter_config(Sober VERSION 0.1.3) | |||
hunter_config(stormlib VERSION 9.21-p1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please split these changes.
done: #971 |
Merged, please rebase. |
done |
Some toolchains failed, feel free to exclude them from testing. |
disabled analyze: ingenue#113 |
Still failed: |
Ok, updated again, should work now. |
Can be moved to a hunter-packages fork