Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C Compiler error #4

Closed
paulocoghi opened this issue Dec 2, 2021 · 16 comments · Fixed by #13
Closed

C Compiler error #4

paulocoghi opened this issue Dec 2, 2021 · 16 comments · Fixed by #13

Comments

@paulocoghi
Copy link

Environment
Ubuntu 20.04 64bit
Crystal 1.2.2 [6529d725a] (2021-11-10)

Installed pre-requisites
sudo apt install pkg-config build-essential libgtk-3-dev libwebkit2gtk-4.0-dev


To execute the first example on readme, on a void directory, I created both shard.yml and a crystal file url.cr with:

shard.yml

name: webview-test
version: 0.1.0
dependencies:
  webview:
    github: naqvis/webview

url.cr

require "webview"

wv = Webview.window(640, 480, Webview::SizeHints::NONE, "Hello WebView", "http://crystal-lang.org")
wv.run
wv.destroy

And shards install goes well:

Resolving dependencies
Fetching https://github.com/naqvis/webview.git
Installing webview (0.1.4)
Postinstall of webview: make
Writing shard.lock

The C compiler error

But when trying to run the example with crystal run url.cr, I get:

Final error

Error: execution of command failed with code: 1: `cc "${@}" -o /home/coghi/.cache/crystal/crystal-run-url.tmp  -rdynamic -L/usr/bin/../lib/crystal `command -v pkg-config > /dev/null && pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a -lstdc++ -lpcre -lm -lgc -lpthread -levent -lrt -ldl`

Long error:

Open here:

/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::gtk_webkit_engine(bool, void*)::{lambda(_WebKitUserContentManager*, _WebKitJavascriptResult*, void*)#2}::operator()(_WebKitUserContentManager*, _WebKitJavascriptResult*, void*) const':
webview.cc:(.text._ZZN7webview17gtk_webkit_engineC4EbPvENKUlP25_WebKitUserContentManagerP23_WebKitJavascriptResultS1_E0_clES3_S5_S1_[_ZZN7webview17gtk_webkit_engineC4EbPvENKUlP25_WebKitUserContentManagerP23_WebKitJavascriptResultS1_E0_clES3_S5_S1_]+0x3c): undefined reference to `webkit_javascript_result_get_js_value'
/usr/bin/ld: webview.cc:(.text._ZZN7webview17gtk_webkit_engineC4EbPvENKUlP25_WebKitUserContentManagerP23_WebKitJavascriptResultS1_E0_clES3_S5_S1_[_ZZN7webview17gtk_webkit_engineC4EbPvENKUlP25_WebKitUserContentManagerP23_WebKitJavascriptResultS1_E0_clES3_S5_S1_]+0x4c): undefined reference to `jsc_value_to_string'
/usr/bin/ld: webview.cc:(.text._ZZN7webview17gtk_webkit_engineC4EbPvENKUlP25_WebKitUserContentManagerP23_WebKitJavascriptResultS1_E0_clES3_S5_S1_[_ZZN7webview17gtk_webkit_engineC4EbPvENKUlP25_WebKitUserContentManagerP23_WebKitJavascriptResultS1_E0_clES3_S5_S1_]+0xb1): undefined reference to `g_free'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::gtk_webkit_engine(bool, void*)':
webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x4e): undefined reference to `gtk_init_check'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x71): undefined reference to `gtk_window_new'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x9d): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0xc2): undefined reference to `g_signal_connect_data'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0xc7): undefined reference to `webkit_web_view_new'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0xd4): undefined reference to `webkit_web_view_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0xea): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0xf2): undefined reference to `webkit_web_view_get_user_content_manager'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x12e): undefined reference to `g_signal_connect_data'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x141): undefined reference to `webkit_user_content_manager_register_script_message_handler'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x194): undefined reference to `gtk_widget_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x1aa): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x1b2): undefined reference to `gtk_container_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x1c8): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x1d3): undefined reference to `gtk_container_add'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x1d8): undefined reference to `gtk_widget_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x1ee): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x1f6): undefined reference to `gtk_widget_grab_focus'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x201): undefined reference to `webkit_web_view_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x217): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x21f): undefined reference to `webkit_web_view_get_settings'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x234): undefined reference to `webkit_settings_set_enable_write_console_messages_to_stdout'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x245): undefined reference to `webkit_settings_set_enable_developer_extras'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engineC2EbPv[_ZN7webview17gtk_webkit_engineC5EbPv]+0x255): undefined reference to `gtk_widget_show_all'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::run()':
webview.cc:(.text._ZN7webview17gtk_webkit_engine3runEv[_ZN7webview17gtk_webkit_engine3runEv]+0x11): undefined reference to `gtk_main'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::terminate()':
webview.cc:(.text._ZN7webview17gtk_webkit_engine9terminateEv[_ZN7webview17gtk_webkit_engine9terminateEv]+0x11): undefined reference to `gtk_main_quit'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::dispatch(std::function<void ()>)':
webview.cc:(.text._ZN7webview17gtk_webkit_engine8dispatchESt8functionIFvvEE[_ZN7webview17gtk_webkit_engine8dispatchESt8functionIFvvEE]+0x6c): undefined reference to `g_idle_add_full'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::set_title(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
webview.cc:(.text._ZN7webview17gtk_webkit_engine9set_titleENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine9set_titleENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x25): undefined reference to `gtk_window_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine9set_titleENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine9set_titleENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x3b): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine9set_titleENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine9set_titleENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x46): undefined reference to `gtk_window_set_title'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::set_size(int, int, int)':
webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0x34): undefined reference to `gtk_window_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0x4a): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0x54): undefined reference to `gtk_window_set_resizable'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0x5f): undefined reference to `gtk_window_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0x75): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0x88): undefined reference to `gtk_window_resize'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0xab): undefined reference to `gtk_widget_set_size_request'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0xdf): undefined reference to `gtk_window_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0xf5): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8set_sizeEiii[_ZN7webview17gtk_webkit_engine8set_sizeEiii]+0x10e): undefined reference to `gtk_window_set_geometry_hints'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::navigate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
webview.cc:(.text._ZN7webview17gtk_webkit_engine8navigateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine8navigateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x25): undefined reference to `webkit_web_view_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8navigateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine8navigateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x3b): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine8navigateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine8navigateENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x46): undefined reference to `webkit_web_view_load_uri'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::init(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
webview.cc:(.text._ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x15): undefined reference to `webkit_web_view_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x2b): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x33): undefined reference to `webkit_web_view_get_user_content_manager'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x60): undefined reference to `webkit_user_script_new'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4initENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x72): undefined reference to `webkit_user_content_manager_add_script'
/usr/bin/ld: /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a(webview.o): in function `webview::gtk_webkit_engine::eval(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
webview.cc:(.text._ZN7webview17gtk_webkit_engine4evalENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4evalENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x25): undefined reference to `webkit_web_view_get_type'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine4evalENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4evalENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x3b): undefined reference to `g_type_check_instance_cast'
/usr/bin/ld: webview.cc:(.text._ZN7webview17gtk_webkit_engine4evalENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE[_ZN7webview17gtk_webkit_engine4evalENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE]+0x56): undefined reference to `webkit_web_view_run_javascript'
collect2: error: ld returned 1 exit status
Error: execution of command failed with code: 1: `cc "${@}" -o /home/coghi/.cache/crystal/crystal-run-url.tmp  -rdynamic -L/usr/bin/../lib/crystal `command -v pkg-config > /dev/null && pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` /home/coghi/Projetos/webview-tests/lib/webview/src/../ext/libwebview.a -lstdc++ -lpcre -lm -lgc -lpthread -levent -lrt -ldl`

@naqvis
Copy link
Owner

naqvis commented Dec 3, 2021

Please make sure you have required libraries installed. Error indicates that its missing required libraries. Ensure you have libgtk-3-dev installed.

@paulocoghi
Copy link
Author

It is installed :(

sudo apt-get install libgtk-3-dev
...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libgtk-3-dev is already the newest version (3.24.20-0ubuntu1).
...

@paulocoghi
Copy link
Author

When using pkg-config to find the gtk+-3.0 library, it finds it:

$ pkg-config gtk+-3.0 --cflags-only-I | sed s/-I//g

/usr/include/gtk-3.0 /usr/include/at-spi2-atk/2.0 /usr/include/at-spi-2.0 /usr/include/dbus-1.0 /usr/lib/x86_64-linux-gnu/dbus-1.0/include /usr/include/gtk-3.0 /usr/include/gio-unix-2.0 /usr/include/cairo /usr/include/pango-1.0 /usr/include/fribidi /usr/include/harfbuzz /usr/include/atk-1.0 /usr/include/cairo /usr/include/pixman-1 /usr/include/uuid /usr/include/freetype2 /usr/include/libpng16 /usr/include/gdk-pixbuf-2.0 /usr/include/libmount /usr/include/blkid /usr/include/glib-2.0 /usr/lib/x86_64-linux-gnu/glib-2.0/include

@paulocoghi
Copy link
Author

paulocoghi commented Dec 3, 2021

But, I don't know if pkg-config find must also find libgtk-3-dev or gtk+-3.0-dev, because it doesn't:

$ pkg-config --cflags libgtk-3-dev

Package libgtk-3-dev was not found in the pkg-config search path.
Perhaps you should add the directory containing `libgtk-3-dev.pc' to the PKG_CONFIG_PATH environment variable
No package 'libgtk-3-dev' found

$ pkg-config --cflags gtk+-3.0-dev

Package gtk+-3.0-dev was not found in the pkg-config search path.
Perhaps you should add the directory containing `gtk+-3.0-dev.pc' to the PKG_CONFIG_PATH environment variable
No package 'gtk+-3.0-dev' found

@paulocoghi
Copy link
Author

paulocoghi commented Dec 3, 2021

The .pc files are present:

$ dpkg -L libgtk-3-dev | grep '\.pc'

/usr/lib/x86_64-linux-gnu/pkgconfig/gdk-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gdk-broadway-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gdk-wayland-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gdk-x11-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-broadway-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-unix-print-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-wayland-3.0.pc
/usr/lib/x86_64-linux-gnu/pkgconfig/gtk+-x11-3.0.pc

pkg-config is also finding the version of gtk+-3.0 with

$ pkg-config --modversion gtk+-3.0
3.24.20

@paulocoghi
Copy link
Author

paulocoghi commented Dec 3, 2021

Important update

I successfully compiled the original examples from github.com/webview/webview, with both Go, C++ and C examples.

Every example compiled and executed perfectly, which helps to conclude that my system is fine.

My only suspicion is that the Makefile may be wrong. I will try to recreate the bindings from the C library, to understand better how the things must be made.

@naqvis
Copy link
Owner

naqvis commented Dec 4, 2021

What is the output of command pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0 on your system? Also you can download the source code of this shard and just try to perform make on the root folder and see if it get raises any error. This shard has been tested on Mac, Linux and Windows.

@paulocoghi
Copy link
Author

The output is:

$ pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0

-pthread -I/usr/include/webkitgtk-4.0 -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/gio-unix-2.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/fribidi -I/usr/include/harfbuzz -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/uuid -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libsoup-2.4 -I/usr/include/libxml2 -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/webkitgtk-4.0 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lwebkit2gtk-4.0 -lgtk-3 -lgdk-3 -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

@paulocoghi
Copy link
Author

No errors when cloning your repo and running make on it:

$ make
g++ -c -o ext/webview.o -DWEBVIEW_GTK=1 `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` -std=c++11 ext/webview.cc
ar rcs ext/libwebview.a ext/webview.o

@naqvis
Copy link
Owner

naqvis commented Dec 5, 2021

I'm unable to reproduce error on Linux (Fedora). Maybe you can try changing the link annotation settings in lib.cr file and do some testing on your box.

@Ragmaanir
Copy link

FYI: I'm getting the same errors on Linux Mint 20.3 and 19.2 (64bit, crystal 1.3.2, libgtk-3-dev is installed)

@naqvis
Copy link
Owner

naqvis commented Mar 24, 2022

FYI: I'm getting the same errors on Linux Mint 20.3 and 19.2 (64bit, crystal 1.3.2, libgtk-3-dev is installed)

Are you getting same error when you separately run make on repo? I don't have access to Linux Mint, so unable to reproduce.

@Ragmaanir
Copy link

make in crystal webview runs without errors and prints:

g++ -c -o ext/webview.o -DWEBVIEW_GTK=1 `pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0` -std=c++11 ext/webview.cc
ar rcs ext/libwebview.a ext/webview.o

@pedromsilvapt
Copy link

I encountered the same issue, but the fix was quite stunning: I just switched the order of the @[Link] attributes for linux (don't know about other platforms) and it worked!

@[Link(ldflags: "`command -v pkg-config > /dev/null && pkg-config --cflags --libs gtk+-3.0 webkit2gtk-4.0`")]
@[Link(ldflags: "#{__DIR__}/../ext/libwebview.a -lstdc++")]

If someone else could validate this change doesn't break anything, it would be great. 😁

@paulocoghi
Copy link
Author

Thanks, @pedromsilvapt Pedro! I will try to validade this as soon as possible!

@Ragmaanir
Copy link

This worked for me! Thanks @pedromsilvapt !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants