blockit
blockit copied to clipboard
Cannot compile on Ubuntu 20.04 (Focal)
Hello,
I get this error when compiling the current master (be185b4) on Ubuntu 20.04:
%sudo make install
cc blockit.c resources/gschema.c -o blockit.so -fPIC -shared `pkg-config --cflags webkit2gtk-4.0 webkit2gtk-web-extension-4.0 glib-2.0 gio-2.0`
blockit.c: In function ‘web_page_send_request’:
blockit.c:34:2: warning: implicit declaration of function ‘g_uri_split’ [-Wimplicit-function-declaration]
34 | g_uri_split(request_uri, G_URI_FLAGS_NONE, NULL, NULL, NULL, NULL, &path, NULL, NULL, NULL);
| ^~~~~~~~~~~
blockit.c:34:27: error: ‘G_URI_FLAGS_NONE’ undeclared (first use in this function); did you mean ‘G_RESOURCE_FLAGS_NONE’?
34 | g_uri_split(request_uri, G_URI_FLAGS_NONE, NULL, NULL, NULL, NULL, &path, NULL, NULL, NULL);
| ^~~~~~~~~~~~~~~~
| G_RESOURCE_FLAGS_NONE
blockit.c:34:27: note: each undeclared identifier is reported only once for each function it appears in
blockit.c: In function ‘console_message_sent_callback’:
blockit.c:118:25: error: ‘G_URI_FLAGS_NONE’ undeclared (first use in this function); did you mean ‘G_RESOURCE_FLAGS_NONE’?
118 | g_uri_split(page_uri, G_URI_FLAGS_NONE, NULL, NULL, &path, NULL, NULL, NULL, NULL, NULL);
| ^~~~~~~~~~~~~~~~
| G_RESOURCE_FLAGS_NONE
blockit.c: In function ‘document_loaded_callback’:
blockit.c:102:3: warning: ignoring return value of ‘jsc_context_evaluate’, declared with attribute warn_unused_result [-Wunused-result]
102 | jsc_context_evaluate(js_context, res->str, -1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
blockit.c: In function ‘pick_elem’:
blockit.c:160:2: warning: ignoring return value of ‘jsc_context_evaluate’, declared with attribute warn_unused_result [-Wunused-result]
160 | jsc_context_evaluate(js_context, zap_js, -1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
blockit.c: In function ‘block_elem’:
blockit.c:170:2: warning: ignoring return value of ‘jsc_context_evaluate’, declared with attribute warn_unused_result [-Wunused-result]
170 | jsc_context_evaluate(js_context, block_js, -1);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [Makefile:12: blockit.so] Error 1
Am I missing something?
Because of the g_uri_split function, blockit requires at least glib 2.66 to be installed. Sadly, Ubuntu 20.04 repositories contain the 2.64.6 version. Ubuntu 20.10 and up seem to support the required version. I should probably replace the function with something more "older glib friedly", but I don't have much time right now, sorry. I don't use Ubuntu, but this question might be helpful: https://askubuntu.com/questions/265111/install-a-single-specific-package-from-future-distribution.