Closed andrepibo closed 5 years ago
Thank you very much for the report, I appreciate the feedback! I build and run in Linux, so hopefully it will be easy to resolve. I'll take a look after work today and hopefully have a fix.
I found the bug, which only seems to surface when using the library linked, but not in the unit-tests. The cause was that the S2BooleanOperation.Options struct has some of its members initialized with dynamically allocated initializers. Given that certain members should be freshly allocated for each instance, it make more sense to convert it to a static final class.
I created a new patch release version, v0.2.1 which contains the fix.
Try running dub upgrade s2geometry-d
and then rebuild your project, let me know if there's any more issues.
Thank you @vnayar for your quick reply and fix! Version 0.2.1 links correctly on Linux.
Out of curiosity, have you figured out why it was working for Mac but not for Linux?
Unfortunately I haven't. I do not have a Mac to test with. I am still not 100% sure why it wasn't working before, but a few searches through the DLang forums revealed that others have experienced similar problems. I'm still thinking about what the best solution is for a struct that should have dynamically allocated members upon creation. A factory method could work, but it seems strange to treat some structs as special cases.
But I wanted to get a fix out as soon as possible as well, and thinking about the best general practice is not a prerequisite to finding a working solution.
On Tue, Jun 4, 2019 at 10:22 AM André Pinheiro Borba < notifications@github.com> wrote:
Out of curiosity, have you figured out why it was working for Mac but not for Linux?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/vnayar/s2geometry-d/issues/3?email_source=notifications&email_token=AAKGNHDQTUXIUWRT26KXOILPYYQ45A5CNFSM4HSG7U22YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW3Z35A#issuecomment-498572788, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKGNHCQCSX3J6NNSFMZM5TPYYQ45ANCNFSM4HSG7U2Q .
First of all, I'd like to thank you for porting this library to D!
The issue I am encountering is an linking error, as shown below:
/home/ubuntu/.dub/packages/s2geometry-d-0.2.0/s2geometry-d/src/s2/s2polygon.d:671: error: undefined reference to 'internal' /home/ubuntu/.dub/packages/s2geometry-d-0.2.0/s2geometry-d/src/s2/s2polygon.d:671: error: undefined reference to 'internal' /home/ubuntu/.dub/packages/s2geometry-d-0.2.0/s2geometry-d/src/s2/s2polygon.d:701: error: undefined reference to 'internal' /home/ubuntu/.dub/packages/s2geometry-d-0.2.0/s2geometry-d/src/s2/s2polygon.d:701: error: undefined reference to 'internal'
This issue, however, is happening on linux but not on mac.
The compiler/linker versions on Mac are:
DMD64 D Compiler v2.083.1
And on Linux:
DMD64 D Compiler v2.083.1
And the following is the piece of code that's using s2geometry-d: