No rule to make target 'JavaScriptCore-4.1.gir', needed by 'WebKit2WebExtension-4.1.gir' when compiling webkitgtk-2.46.3

I’m now getting this strange error during the compilation and building of the latest stable release of libwebkit2gtk:

[100%] Building CXX object Source/WebKit/CMakeFiles/WebKit.dir/__/__    
/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-45.cpp.o

[100%] Building CXX object Source/WebKit/CMakeFiles/WebKit.dir/__/__    
/DerivedSources/WebKit/unified-sources/UnifiedSource-54928a2b-46.cpp.o
[100%] Linking CXX shared library ../../lib/[libwebkit2gtk-4.1.so](http:/
//libwebkit2gtk-4.1.so)
[100%] Built target WebKit
gmake[2]: *** No rule to make target 'JavaScriptCore-4.1.gir', needed by    
'WebKit2WebExtension-4.1.gir'. Stop.
gmake[1]: *** [CMakeFiles/Makefile2:1948: Source/WebKit/CMakeFiles   
/typelib-WebKit2WebExtension.dir/all] Error 2
gmake: *** [Makefile:156: all] Error 2

OS: Ubuntu 24.04

I’ve found that also in the past releases of webkitgtk some people had the same problem: 195251 – [GTK] No rule to make target 'JavaScriptCore-4.0.gir' . I tried the workarounds proposed, but none worked:

I also used this patched proposed: Attachment #363436 for bug #195251 but the compilation gave the same error

How to make it work?

Easiest way to build packages downstream is to see how downstream builds the package.

For Debian / Ubuntu (and it’s forks):

  1. Enable source repo in /etc/apt/sources.list file (or the file in /etc/apt/sources.list.d/ dir).

  2. Run "apt update" as root / sudo.

  3. Run "apt build-dep <package-name>" as root / sudo. This should install all needed build dependencies required to build <package-name>.

  4. Run "apt-get source -b <package-name>". This should download source .tar.gz for <package-name> and build it locally. In this step, you can see the actual build command used (e.g. meson setup ... etc) in the build output.

Note: One can also look into debian/ dir for build rules etc, but it’s easier this way, as there may be conditionals which complicate the build args.

Hi!

I’ve put in /sources.list.d/ folder this source repo:

raphy@raohy:/etc/apt/sources.list.d$ cat libjavascriptcoregtk.save 
http://archive.ubuntu.com/ubuntu/pool/main/w/webkit2gtk/libjavascriptcoregtk-    
4.1-0_2.44.0-2_amd64.deb

And in libjavascriptcoregtk-sources.list :

raphy@raohy:/etc/apt/sources.list.d$ cat libjavascriptcoregtk-sources.list 
deb-src http://archive.ubuntu.com/ubuntu/pool/main/w/webkit2gtk    
/libjavascriptcoregtk-4.1-0_2.44.0-2_amd64.deb noble main restricted  
universe multiverse

But I get in the build-dep step :

raphy@raohy:/etc/apt/sources.list.d$ sudo apt build-dep libjavascriptcoregtk

Reading package lists… Done
E: You must put some ‘deb-src’ URIs in your sources.list

Refer https://help.ubuntu.com/community/Repositories/CommandLine.

If you’re not comfortable with debugging the build system, I would try using ninja instead (cmake -GNinja) since that’s what almost everybody else is going to be using. Probably not many users are testing the build using the Makefile backend since it’s slower and worse.

Yes. May by I have to follow this path

After successfully doing the configuration:

raphy@raohy:~/Downloads/NEW/webkitgtk-2.46.3$ cmake -GNinja -B builddir -DPORT=GTK -DUSE_GSTREAMER_WEBRTC=TRUE -DENABLE_WEB_RTC=ON -DUSE_GTK4=OFF

-- Enabled features:
--  ENABLE_BUBBLEWRAP_SANDBOX ..................... ON
--  ENABLE_DOCUMENTATION                            ON
--  ENABLE_DRAG_SUPPORT ........................... ON
--  ENABLE_GAMEPAD                                  ON
--  ENABLE_INTROSPECTION .......................... ON
--  ENABLE_JOURNALD_LOG                             ON
--  ENABLE_MINIBROWSER ............................ ON
--  ENABLE_PDFJS                                    ON
--  ENABLE_QUARTZ_TARGET .......................... OFF
--  ENABLE_SPELLCHECK                               ON
--  ENABLE_TOUCH_EVENTS ........................... ON
--  ENABLE_VIDEO                                    ON
--  ENABLE_WAYLAND_TARGET ......................... ON
--  ENABLE_WEBDRIVER                                ON
--  ENABLE_WEB_AUDIO .............................. ON
--  ENABLE_X11_TARGET                               ON
--  USE_AVIF ...................................... ON
--  USE_GBM                                         ON
--  USE_GSTREAMER_TRANSCODER ...................... ON
--  USE_GSTREAMER_WEBRTC                            TRUE
--  USE_GTK4 ...................................... OFF
--  USE_JPEGXL                                      ON
--  USE_LCMS ...................................... ON
--  USE_LIBBACKTRACE                                ON
--  USE_LIBDRM .................................... ON
--  USE_LIBHYPHEN                                   ON
--  USE_LIBSECRET ................................. ON
--  USE_SOUP2                                       OFF
--  USE_SYSTEM_SYSPROF_CAPTURE .................... ON
--  USE_WOFF2                                       ON
-- Configuring done (13.8s)
-- Generating done (0.6s)

How to compile with Ninja ? :

raphy@raohy:~/Downloads/NEW/webkitgtk-2.46.3$ cmake --build -GNinja 
builddir
Unknown argument builddir

Run cmake --build builddir without -GNinja.

1 Like

@mcatanzaro

raphy@raohy:~/Downloads/NEW/webkitgtk-2.46.3$ cmake --build builddir/
[0/2] Re-checking globbed directories...
[3607/3623] Generating ../../../MiniBrowser/DerivedSo... ../../../MiniBrowser/DerivedSources/BrowserMarshal.h
INFO: Reading /home/raphy/Downloads/NEW/webkitgtk-2.46.3/Tools/MiniBrowser/gtk/browser-marshal.list...
INFO: Reading /home/raphy/Downloads/NEW/webkitgtk-2.46.3/Tools/MiniBrowser/gtk/browser-marshal.list...
[3622/3623] Generating documentation: WebKit2
/usr/lib/python3/dist-packages/typogrify/filters.py:46: SyntaxWarning: invalid escape sequence '\s'
  tag = match.group(1) if match.group(1) != '' else '[^\s.#<>]+'
/usr/lib/python3/dist-packages/typogrify/filters.py:140: SyntaxWarning: invalid escape sequence '\w'
  tag_pattern = '</?\w+((\s+\w+(\s*=\s*(?:".*?"|\'.*?\'|[^\'">\s]+))?)+\s*|\s*)/?>'
/usr/lib/python3/dist-packages/typogrify/packages/titlecase/__init__.py:18: SyntaxWarning: invalid escape sequence '\.'
  SMALL = 'a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\.?|via|vs\.?'
/usr/lib/python3/dist-packages/typogrify/filters.py:46: SyntaxWarning: invalid escape sequence '\s'
  tag = match.group(1) if match.group(1) != '' else '[^\s.#<>]+'
/usr/lib/python3/dist-packages/typogrify/filters.py:140: SyntaxWarning: invalid escape sequence '\w'
  tag_pattern = '</?\w+((\s+\w+(\s*=\s*(?:".*?"|\'.*?\'|[^\'">\s]+))?)+\s*|\s*)/?>'
/usr/lib/python3/dist-packages/typogrify/packages/titlecase/__init__.py:18: SyntaxWarning: invalid escape sequence '\.'
  SMALL = 'a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\.?|via|vs\.?'
/usr/lib/python3/dist-packages/smartypants.py:270: SyntaxWarning: invalid escape sequence '\S'
  if re.match("\S", prev_token_last_char):
/usr/lib/python3/dist-packages/smartypants.py:276: SyntaxWarning: invalid escape sequence '\S'
  if re.match("\S", prev_token_last_char):
[3623/3623] Generating documentation: WebKit2WebExtension
/usr/lib/python3/dist-packages/typogrify/filters.py:46: SyntaxWarning: invalid escape sequence '\s'
  tag = match.group(1) if match.group(1) != '' else '[^\s.#<>]+'
/usr/lib/python3/dist-packages/typogrify/filters.py:140: SyntaxWarning: invalid escape sequence '\w'
  tag_pattern = '</?\w+((\s+\w+(\s*=\s*(?:".*?"|\'.*?\'|[^\'">\s]+))?)+\s*|\s*)/?>'
/usr/lib/python3/dist-packages/typogrify/packages/titlecase/__init__.py:18: SyntaxWarning: invalid escape sequence '\.'
  SMALL = 'a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\.?|via|vs\.?'
/usr/lib/python3/dist-packages/typogrify/filters.py:46: SyntaxWarning: invalid escape sequence '\s'
  tag = match.group(1) if match.group(1) != '' else '[^\s.#<>]+'
/usr/lib/python3/dist-packages/typogrify/filters.py:140: SyntaxWarning: invalid escape sequence '\w'
  tag_pattern = '</?\w+((\s+\w+(\s*=\s*(?:".*?"|\'.*?\'|[^\'">\s]+))?)+\s*|\s*)/?>'
/usr/lib/python3/dist-packages/typogrify/packages/titlecase/__init__.py:18: SyntaxWarning: invalid escape sequence '\.'
  SMALL = 'a|an|and|as|at|but|by|en|for|if|in|of|on|or|the|to|v\.?|via|vs\.?'
/usr/lib/python3/dist-packages/smartypants.py:270: SyntaxWarning: invalid escape sequence '\S'
  if re.match("\S", prev_token_last_char):
/usr/lib/python3/dist-packages/smartypants.py:276: SyntaxWarning: invalid escape sequence '\S'
  if re.match("\S", prev_token_last_char):
raphy@raohy:~/Downloads/NEW/webkitgtk-2.46.3$

Why when executing MiniBrowser I get this error?

raphy@raohy:~/Downloads/NEW/webkitgtk-2.46.3/builddir/bin$ ./MiniBrowser 

** (WebKitWebProcess:31595): WARNING **: 08:53:26.537: Error loading the
 injected bundle (/usr/local/lib/webkit2gtk-4.1/injected-bundle  
/libwebkit2gtkinjectedbundle.so): /usr/local/lib/webkit2gtk-4.1/injected-bundle
/libwebkit2gtkinjectedbundle.so: cannot open shared object file: No such file or
 directory

Why does it look for webkit2gtk in /usr/local/lib ?

raphy@raohy:/usr/local/lib$ ls -lah | grep webkit2gtk
raphy@raohy:/usr/local/lib$ 

After copying libwebkit2gtkinjectedbundle.so into /usr/local/lib/webkit2gtk-4.1/injected-bundle :

raphy@raohy:/usr/local/lib/webkit2gtk-4.1/injected-bundle$ ls -lah
total 4,5M
drwxr-xr-x 2 root root 4,0K nov  7 09:31 .
drwxr-xr-x 3 root root 4,0K nov  7 09:28 ..
-rwxr-xr-x 1 root root 4,5M nov  7 09:31 libwebkit2gtkinjectedbundle.so
raphy@raohy:/usr/local/lib/webkit2gtk-4.1/injected-bundle$ 

the error disappeared, but still MiniBrowser does not properly work:

Why if I do export WEBKIT_DISABLE_COMPOSITING_MODE=1 before executing MiniBrowser, the webpage is correctly rendered?

(workaround found here: [bug] blank page with webkit2gtk 2.42 · Issue #7927 · tauri-apps/tauri · GitHub)

raphy@raohy:~/Downloads/NEW/webkitgtk-2.46.3/builddir/bin$ export 
WEBKIT_DISABLE_COMPOSITING_MODE=1
raphy@raohy:~/Downloads/NEW/webkitgtk-2.46.3/builddir/bin$ ./MiniBrowser 

How to avoid to do that, fixing the problem once for all?

Sorry @mcatanzaro Michael

I have another question:

is highlighting tool supported for the pdf?
What am I missing during compilation to make the highlighting tool available?

Because that’s the default install prefix and you didn’t change it.

You have to install it after building it. Use cmake --install.

Something is broken. You should create a bug report on WebKit Bugzilla.

I don’t think PDF.js has a highlighting tool.

1 Like

Thank you very much for your kind help

1 Like