March 13, 2021
On Friday, 12 March 2021 at 00:12:37 UTC, Guillaume Piolat wrote:
>
> Create a exports.lst file with:
>
> _addDD_D
>
>
> as the only line there.
> Build with:
>
> "lflags-osx-ldc": [ "-exported_symbols_list", "exports.lst", "-dead_strip" ],

Thx that's really helpful.

I've hit a snag with LDC. After serveral hours of searching and reading I think it's coming down to sandboxing and needing to deploy libraries in a place that excel can find them.

The library DMD creates just references /usr/lib/libSystem.B.dylib and Excel can load my dylib.

LDC on the other hand additionally references:

@rpath/libphobos2-ldc-shared.95.dylib (compatibility version 95.0.0, current version 2.0.95)
@rpath/libdruntime-ldc-shared.95.dylib (compatibility version 95.0.0, current version 2.0.95)

So Excel complains that it can't load my library - presumably because libphobos2 and libdruntime are not in the sandbox.ly

Can anyone (either tell me how to fix this) or give me pointers pls? (I'm current reading up on DYLD_LIBRARY_PATH (shouldn't use that), sandboxing on Mac, and rpaths)

I suppose a solution that allows the additional libraries to be put in a subdirectory of my library would be idea as then I can deploy that within the sandbox.

Thx for the help
March 14, 2021
On Saturday, 13 March 2021 at 23:41:28 UTC, David wrote:
> So Excel complains that it can't load my library - presumably because libphobos2 and libdruntime are not in the sandbox.ly

You *might* be able to compile with --link-defaultlib-shared=false to use the static phobos+druntime... but with shared libs it prefers shared and might not allow this. Probably worth a try.

Otherwise I'd try to just add the phobos so to your sandbox somehow. or the rpath set to current directory and putting them in your correct directory may also work. I don't know how that works on Mac but on Linux it is passing... `-L-rpath -L.` or something like that when compiling... I can't find my notes on this but something like that.
March 14, 2021
On Thursday, 11 March 2021 at 22:10:04 UTC, David wrote:
> I wasn't aware that object files could be manipulated like the strip manual page - thx for the heads up.

With the caveats that the linked post is almost 14 years old, I can't try this command myself, and the ldc solution is probably preferable if you can get it to work - if you want to compile with dmd and use the strip command, this might help you (the OP answered his own question at the bottom):

https://forum.juce.com/t/how-to-build-dylib-exporting-only-wanted-symbols/2180

He suggests doing:

strip -u -r -s FILE_CONTAINING_EXPORTS_LIST MY_DYLIB.dylib
March 14, 2021
On Sunday, 14 March 2021 at 01:38:23 UTC, David Skluzacek wrote:
> On Thursday, 11 March 2021 at 22:10:04 UTC, David wrote:
>> I wasn't aware that object files could be manipulated like the strip manual page - thx for the heads up.
>
> With the caveats that the linked post is almost 14 years old, I can't try this command myself, and the ldc solution is probably preferable if you can get it to work - if you want to compile with dmd and use the strip command, this might help you (the OP answered his own question at the bottom):
>
> https://forum.juce.com/t/how-to-build-dylib-exporting-only-wanted-symbols/2180
>
> He suggests doing:
>
> strip -u -r -s FILE_CONTAINING_EXPORTS_LIST MY_DYLIB.dylib

It looks straight forward that way - thx
March 14, 2021
On Sunday, 14 March 2021 at 00:00:59 UTC, Adam D. Ruppe wrote:
> On Saturday, 13 March 2021 at 23:41:28 UTC, David wrote:
>> So Excel complains that it can't load my library - presumably because libphobos2 and libdruntime are not in the sandbox.ly
>
> You *might* be able to compile with --link-defaultlib-shared=false to use the static phobos+druntime... but with shared libs it prefers shared and might not allow this. Probably worth a try.
>
> Otherwise I'd try to just add the phobos so to your sandbox somehow. or the rpath set to current directory and putting them in your correct directory may also work. I don't know how that works on Mac but on Linux it is passing... `-L-rpath -L.` or something like that when compiling... I can't find my notes on this but something like that.

I think figuring out how to add phobos to the sandbox is probably the best option as I'm sure it won't be the last dylib I need to load.

Anyone else done this? Pointers welcome.
March 17, 2021
On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote:
>
> Anyone else done this? Pointers welcome.

Sorry for delay.

Just add "dflags-osx-ldc": ["-static"],
March 17, 2021
On Wednesday, 17 March 2021 at 13:52:48 UTC, Guillaume Piolat wrote:
> On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote:
>>
>> Anyone else done this? Pointers welcome.
>
> Sorry for delay.
>
> Just add "dflags-osx-ldc": ["-static"],

macOS doesn't support static linking.

--
/Jacob Carlborg
March 17, 2021
On Wednesday, 17 March 2021 at 15:16:36 UTC, Jacob Carlborg wrote:

> macOS doesn't support static linking.

The proper way to solve this is to bundle the dynamic libraries with the application. If it's a GUI application it can be located in the application bundle.  It seems like David already figured this out [1].

[1] https://forum.dlang.org/post/wsvlwdgzswxprtfjzqik@forum.dlang.org

--
/Jacob Carlborg

March 17, 2021
On Wednesday, 17 March 2021 at 15:16:36 UTC, Jacob Carlborg wrote:
> On Wednesday, 17 March 2021 at 13:52:48 UTC, Guillaume Piolat wrote:
>> On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote:
>>>
>>> Anyone else done this? Pointers welcome.
>>
>> Sorry for delay.
>>
>> Just add "dflags-osx-ldc": ["-static"],
>
> macOS doesn't support static linking.
>
> --
> /Jacob Carlborg

Ah that's really useful to know, thanks - this is my first bit of macOS dev (other than high level stuff like R, Python, kdb etc) and I'm having to learn more about internals than I really care to - ho hum.
1 2
Next ›   Last »