digitalmars.D.learn - Linking to -framework on MacOS
- Andrew Edwards (29/29) Sep 04 2019 Hello,
- rikki cattermole (3/3) Sep 04 2019 Four years ago, I was linking against Cocoa via:
- Andrew Edwards (5/9) Sep 04 2019 Worked like a charm:
- Jacob Carlborg (5/8) Sep 05 2019 This probably not a good idea. It relies on how a framework is
- Andrew Edwards (4/10) Sep 06 2019 Thanks. That is the one I went with because it was not dependent
- Adam D. Ruppe (5/6) Sep 04 2019 You can also add `-L-framework -LCocoa` to dmd to pass the two
- Andrew Edwards (3/9) Sep 04 2019 That's perfect. Thanks.
- DanielG (6/6) Sep 05 2019 And depending on the version of macOS / which framework you're
- Andrew Edwards (3/10) Sep 06 2019 I am on 10.14 as well and Adam's solutions works well with the
Hello, I'm trying to link to "-framework OpenGL" on MacOS and finding any clues on how to accomplish this. If I pass that switch to clang and use clang to create the executable, it works perfectly but I would like to use dmd to create the executable. Here is the list of errors I'm trying to resolve: dmd dmain main.o imgui_impl_glfw.o imgui_impl_opengl3.o imgui.o imgui_demo.o imgui_draw.o imgui_widgets.o gl3w.o -L-lstdc++ -L-lglfw Undefined symbols for architecture x86_64: "_CFBundleCreate", referenced from: _open_libgl in gl3w.o "_CFBundleGetFunctionPointerForName", referenced from: _get_proc in gl3w.o "_CFRelease", referenced from: _close_libgl in gl3w.o _get_proc in gl3w.o "_CFStringCreateWithCString", referenced from: _get_proc in gl3w.o "_CFURLCreateWithFileSystemPath", referenced from: _open_libgl in gl3w.o "___CFConstantStringClassReference", referenced from: CFString in gl3w.o "_kCFAllocatorDefault", referenced from: _open_libgl in gl3w.o _get_proc in gl3w.o ld: symbol(s) not found for architecture x86_64 Could someone point me in the right direction please?
Sep 04 2019
Four years ago, I was linking against Cocoa via: "lflags-osx": ["/System/Library/Frameworks/Cocoa.framework/Cocoa"], I don't know if this will help you or not.
Sep 04 2019
On Wednesday, 4 September 2019 at 15:05:46 UTC, rikki cattermole wrote:Four years ago, I was linking against Cocoa via: "lflags-osx": ["/System/Library/Frameworks/Cocoa.framework/Cocoa"], I don't know if this will help you or not.Worked like a charm: -L/System/Library/Frameworks/Cocoa.framework/Cocoa Thank you so much.
Sep 04 2019
On 2019-09-04 17:12, Andrew Edwards wrote:Worked like a charm: -L/System/Library/Frameworks/Cocoa.framework/CocoaThis probably not a good idea. It relies on how a framework is structured internally. Adam's solution is the correct one. -- /Jacob Carlborg
Sep 05 2019
On Thursday, 5 September 2019 at 12:30:33 UTC, Jacob Carlborg wrote:On 2019-09-04 17:12, Andrew Edwards wrote:Thanks. That is the one I went with because it was not dependent on the file structure and it was quite a bit shorter.Worked like a charm: -L/System/Library/Frameworks/Cocoa.framework/CocoaThis probably not a good idea. It relies on how a framework is structured internally. Adam's solution is the correct one.
Sep 06 2019
On Wednesday, 4 September 2019 at 15:00:52 UTC, Andrew Edwards wrote:Could someone point me in the right direction please?You can also add `-L-framework -LCocoa` to dmd to pass the two arguments to the linker (they need to be separate -L things for the two pieces, which is kinda weird but it works)
Sep 04 2019
On Wednesday, 4 September 2019 at 15:22:51 UTC, Adam D. Ruppe wrote:On Wednesday, 4 September 2019 at 15:00:52 UTC, Andrew Edwards wrote:That's perfect. Thanks.Could someone point me in the right direction please?You can also add `-L-framework -LCocoa` to dmd to pass the two arguments to the linker (they need to be separate -L things for the two pieces, which is kinda weird but it works)
Sep 04 2019
And depending on the version of macOS / which framework you're linking to, you might need to specify a search path as well (-F): lflags "-framework" "SomeFramework" "-framework" "AnotherFramework" "-F/Library/Frameworks" IIRC I didn't need that -F parameter on 10.9, but now I do with 10.14. But it's for my own frameworks, not system ones.
Sep 05 2019
On Thursday, 5 September 2019 at 18:26:41 UTC, DanielG wrote:And depending on the version of macOS / which framework you're linking to, you might need to specify a search path as well (-F): lflags "-framework" "SomeFramework" "-framework" "AnotherFramework" "-F/Library/Frameworks" IIRC I didn't need that -F parameter on 10.9, but now I do with 10.14. But it's for my own frameworks, not system ones.I am on 10.14 as well and Adam's solutions works well with the system provided frameworks. Thanks.
Sep 06 2019