astroidmail / astroid

A graphical threads-with-tags style, lightweight and fast, e-mail client for Notmuch
http://astroidmail.github.io
Other
613 stars 65 forks source link

cmake creates build files that can't link on macOS #658

Open serverhiccups opened 5 years ago

serverhiccups commented 5 years ago

Hi there, When trying to build astroid on macOS I get an error

[11/108] Linking C executable gir_main
FAILED: gir_main
: && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names  CMakeFiles/gir_main.dir/src/plugin/astroid_activatable.c.o CMakeFiles/gir_main.dir/src/plugin/thread_view_activatable.c.o CMakeFiles/gir_main.dir/src/plugin/thread_index_activatable.c.o CMakeFiles/gir_main.dir/src/plugin/gir_main.c.o  -o gir_main  -L/usr/local/Cellar/webkitgtk/2.22.7/lib -L/usr/local/Cellar/gtk+3/3.24.10/lib -L/usr/local/Cellar/pango/1.44.3/lib -L/usr/local/Cellar/harfbuzz/2.5.3/lib -L/usr/local/Cellar/atk/2.32.0_1/lib -L/usr/local/Cellar/cairo/1.16.0_2/lib -L/usr/local/Cellar/gdk-pixbuf/2.38.1_1/lib -L/usr/local/Cellar/libsoup/2.66.2_1/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/Cellar/webkitgtk/2.22.7/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/opt/gettext/lib -lwebkit2gtk-4.0 -lgtk-3 -lgdk-3 -framework -lCocoa -framework -lCarbon -framework -lCoreGraphics -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lsoup-2.4 -lgio-2.0 -ljavascriptcoregtk-4.0 -lgobject-2.0 -lglib-2.0 -lintl -L/usr/local/Cellar/gtkmm3/3.24.1_1/lib -L/usr/local/Cellar/atkmm/2.28.0_1/lib -L/usr/local/Cellar/gtkmm3/3.24.1_1/lib -L/usr/local/Cellar/glibmm/2.60.0_1/lib -L/usr/local/Cellar/pangomm/2.42.0_1/lib -L/usr/local/Cellar/glibmm/2.60.0_1/lib -L/usr/local/Cellar/gtk+3/3.24.10/lib -L/usr/local/Cellar/pango/1.44.3/lib -L/usr/local/Cellar/harfbuzz/2.5.3/lib -L/usr/local/Cellar/atk/2.32.0_1/lib -L/usr/local/Cellar/cairo/1.16.0_2/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/Cellar/cairomm/1.12.2/lib -L/usr/local/Cellar/cairo/1.16.0_2/lib -L/usr/local/Cellar/libsigc++/2.10.2/lib -L/usr/local/Cellar/gdk-pixbuf/2.38.1_1/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/opt/gettext/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -framework -lCocoa -framework -lCarbon -framework -lCoreGraphics -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -L/usr/local/Cellar/libpeas/1.22.0_3/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/Cellar/gobject-introspection/1.60.2_1/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/opt/gettext/lib -lpeas-1.0 -lgmodule-2.0 -lgio-2.0 -lgirepository-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lgtk-3 -lgdk-3 -framework -lCocoa -lCarbon -lCoreGraphics -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lsoup-2.4 -lgio-2.0 -ljavascriptcoregtk-4.0 -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lpeas-1.0 -lgmodule-2.0 -lgirepository-1.0 && :
ld: framework not found -lCocoa
clang: error: linker command failed with exit code 1 (use -v to see invocation)

After doing some digging it turns out that I have to replace -lCocoa with -framework Cocoa, -lCarbon with -framework Carbon and -lCoreGraphics with -framework CoreGraphics. This is due to the way that macOS handles dynamic libs. With these changes astroid builds to completion.

I think that this would likely be a quick change in the cmake file, but I haven't used cmake before, and it seems a little daunting. This doc page might help. I am using macOS 10.14.6, cmake 3.15.2 from brew and clang Apple LLVM version 10.0.1 (clang-1001.0.46.4)

gauteh commented 5 years ago

Hi, would be happy to review a PR, I don't think I will be able to look into this atm.

ons. 4. sep. 2019, 07:31 skrev serverhiccups notifications@github.com:

Hi there, When trying to build astroid on macOS I get an error

[11/108] Linking C executable gir_main FAILED: gir_main : && /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/gir_main.dir/src/plugin/astroid_activatable.c.o CMakeFiles/gir_main.dir/src/plugin/thread_view_activatable.c.o CMakeFiles/gir_main.dir/src/plugin/thread_index_activatable.c.o CMakeFiles/gir_main.dir/src/plugin/gir_main.c.o -o gir_main -L/usr/local/Cellar/webkitgtk/2.22.7/lib -L/usr/local/Cellar/gtk+3/3.24.10/lib -L/usr/local/Cellar/pango/1.44.3/lib -L/usr/local/Cellar/harfbuzz/2.5.3/lib -L/usr/local/Cellar/atk/2.32.0_1/lib -L/usr/local/Cellar/cairo/1.16.0_2/lib -L/usr/local/Cellar/gdk-pixbuf/2.38.1_1/lib -L/usr/local/Cellar/libsoup/2.66.2_1/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/Cellar/webkitgtk/2.22.7/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/opt/gettext/lib -lwebkit2gtk-4.0 -lgtk-3 -lgdk-3 -framework -lCocoa -framework -lCarbon -framework -lCoreGraphics -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lsoup-2.4 -lgio-2.0 -ljavascriptcoregtk-4.0 -lgobject-2.0 -lglib-2.0 -lintl -L/usr/local/Cellar/gtkmm3/3.24.1_1/lib -L/usr/local/Cellar/atkmm/2.28.0_1/lib -L/usr/local/Cellar/gtkmm3/3.24.1_1/lib -L/usr/local/Cellar/glibmm/2.60.0_1/lib -L/usr/local/Cellar/pangomm/2.42.0_1/lib -L/usr/local/Cellar/glibmm/2.60.0_1/lib -L/usr/local/Cellar/gtk+3/3.24.10/lib -L/usr/local/Cellar/pango/1.44.3/lib -L/usr/local/Cellar/harfbuzz/2.5.3/lib -L/usr/local/Cellar/atk/2.32.0_1/lib -L/usr/local/Cellar/cairo/1.16.0_2/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/Cellar/cairomm/1.12.2/lib -L/usr/local/Cellar/cairo/1.16.0_2/lib -L/usr/local/Cellar/libsigc++/2.10.2/lib -L/usr/local/Cellar/gdk-pixbuf/2.38.1_1/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/opt/gettext/lib -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lgtk-3 -lgdk-3 -framework -lCocoa -framework -lCarbon -framework -lCoreGraphics -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lgio-2.0 -lcairomm-1.0 -lcairo -lsigc-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lintl -L/usr/local/Cellar/libpeas/1.22.0_3/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/Cellar/gobject-introspection/1.60.2_1/lib -L/usr/local/Cellar/glib/2.60.6/lib -L/usr/local/opt/gettext/lib -lpeas-1.0 -lgmodule-2.0 -lgio-2.0 -lgirepository-1.0 -lgobject-2.0 -lglib-2.0 -lintl -lgtk-3 -lgdk-3 -framework -lCocoa -lCarbon -lCoreGraphics -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lsoup-2.4 -lgio-2.0 -ljavascriptcoregtk-4.0 -lgtkmm-3.0 -latkmm-1.6 -lgdkmm-3.0 -lgiomm-2.4 -lpangomm-1.4 -lglibmm-2.4 -lcairomm-1.0 -lsigc-2.0 -lpeas-1.0 -lgmodule-2.0 -lgirepository-1.0 && : ld: framework not found -lCocoa clang: error: linker command failed with exit code 1 (use -v to see invocation)

After doing some digging it turns out that I have to replace -lCocoa with -framework Cocoa, -lCarbon with -framework Carbon and -lCoreGraphics with -framework CoreGraphics. This is due to the way that macOS handles dynamic libs. With these changes astroid builds to completion.

I think that this would likely be a quick change in the cmake file, but I haven't used cmake before, and it seems a little daunting. This doc page https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/platform_dependent_issues/HowToUseExistingOSXFrameworks might help. I am using macOS 10.14.6, cmake 3.15.2 from brew and clang Apple LLVM version 10.0.1 (clang-1001.0.46.4)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/astroidmail/astroid/issues/658?email_source=notifications&email_token=AAAN364M5KUGQ2TUXBCINSDQH5B37A5CNFSM4ITNR5HKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HJEY2EA, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAN36YGRB3Y5CGSKLMSP33QH5B37ANCNFSM4ITNR5HA .