WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED WONTFIX
187701
[GTK][BUILD] FAILED: lib/libwebkit2gtk-4.0.so.37.31.0 collect2: error: ld returned 1 exit status
https://bugs.webkit.org/show_bug.cgi?id=187701
Summary
[GTK][BUILD] FAILED: lib/libwebkit2gtk-4.0.so.37.31.0 collect2: error: ld ret...
karogyoker2+webkit
Reported
2018-07-16 10:05:09 PDT
Created
attachment 345097
[details]
console output Hello, I cannot build WebKit. This is what I've done: 1. I got a snapshot on June 30 (or 29) from the link mentioned here:
https://webkit.org/getting-the-code/
2. tar jxvf WebKit-SVN-source.tar.bz2 3. cd webkit 4. $ Tools/gtk/install-dependencies 5. $ Tools/Scripts/update-webkitgtk-libs 6. cd WebKitBuild 7. cmake .. -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="-march=native" -DCMAKE_CXX_FLAGS="-march=native" -DUSE_WOFF2=OFF -DENABLE_MINIBROWSER=ON -GNinja 8. ninja -j1 Output: [4/68] Linking CXX shared library lib/libwebkit2gtk-4.0.so.37.31.0 FAILED: lib/libwebkit2gtk-4.0.so.37.31.0 : && /usr/bin/c++ -fPIC -fdiagnostics-color=always -Wno-expansion-to-defined -Wno-attributes -Wno-noexcept-type -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wextra -Wall -march=native -fno-strict-aliasing -fno-exceptions -fno-rtti -std=c++17 -O2 -g -DNDEBUG -fuse-ld=gold -Wl,--disable-new-dtags -fuse-ld=gold -Wl,--disable-new-dtags -Wl,--version-script,/home/oldboi/Downloads/webkit/Source/WebKit/webkitglib-symbols.map -shared -Wl,-soname,libwebkit2gtk-4.0.so.37 -o lib/libwebkit2gtk-4.0.so.37.31.0 Source/WebKit/CMakeFiles/WebKit.dir/NetworkProcess/NetworkActivityTracker.cpp.o Source/WebKit/CMakeFiles/WebKit.dir/NetworkProcess/NetworkCORSPreflightChecker.cpp.o Source/WebKit/CMakeFiles/WebKit.dir/NetworkProcess/NetworkConnectionToWebProcess.cpp.o Source/WebKit/CMakeFiles/WebKit.dir/NetworkProcess/NetworkContentRuleListManager.cpp.o Source/WebKit/CMakeFiles/WebKit.dir . . . [TRUNCATED, see attachment] . . . /i386-linux-gnu/libXdamage.so /usr/lib/i386-linux-gnu/libXrender.so /usr/lib/i386-linux-gnu/libXt.so /usr/lib/i386-linux-gnu/libz.so -lwayland-server -lwayland-egl -lwayland-client && : collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. Is there any way to know more about why the linker failed?
Attachments
console output
(63.98 KB, text/plain)
2018-07-16 10:05 PDT
,
karogyoker2+webkit
no flags
Details
memory usage on host
(7.61 KB, image/png)
2018-07-18 23:03 PDT
,
karogyoker2+webkit
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Michael Catanzaro
Comment 1
2018-07-16 10:19:40 PDT
Could it be OOM? Builds on i386 are going to be more difficult due to resource limits. Try: -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -g1
karogyoker2+webkit
Comment 2
2018-07-16 20:48:55 PDT
Sorry, but where should I put these flags? Ninja doesn't recognize them. I have 10 gigs of swap, and it is not full when the build fails. During the build the peak was around 1GB RAM + 2-3GB swap.
Michael Catanzaro
Comment 3
2018-07-17 08:42:04 PDT
You would put them in CFLAGS and CXXFLAGS, but they're not going to help if you're not running out of memory. I don't know how we can help with this, since there's not any useful error message from the linker.
karogyoker2+webkit
Comment 4
2018-07-17 11:29:41 PDT
Can't we pass some arguments to something which will run the linker in verbose mode when it gets there?
Michael Catanzaro
Comment 5
2018-07-17 14:04:18 PDT
I don't know what.
karogyoker2+webkit
Comment 6
2018-07-17 22:32:29 PDT
Then I guess it just doesn't work. I might try to build it on other environment, on other machine (in VirtualBox with 32 bit Linux, setting march=pentium3). But before that, I have to ask something. Because the whole purpose of this build for me was to create a version of WebKit which doesn't require SSE2 to run. Is that even possible or in WebKit's source there are hardcoded SSE2 instructions (like in Firefox, Chrome or Basilisk)? All of these browsers explicitly states in their system requirements that SSE2 is a must. But I couldn't find the system requirements for WebKit. Can you help me on this? Slightly off topic, but since you are a master of WebKit, I guess you would know. Midori works for me, I think because it is using an older version of Webkit, but for example surf or Web (Epiphany-browser), both don't work.
Michael Catanzaro
Comment 7
2018-07-18 07:59:23 PDT
For WebKitGTK+, SSE2 instructions are forbidden (except when building for x86_64) because that's what our distributors require. But I doubt all developers are aware of this, and I also doubt anybody ever tests on such old hardware. So it might require some effort to audit the codebase for unwanted SSE2 instructions to make sure they're not there and fix them if so.
karogyoker2+webkit
Comment 8
2018-07-18 23:02:15 PDT
I created a Virtual Box VM on one of my other machines, it is a 4 core
i5@3.5GHz
with 8GB RAM. I gave the VM 4GB RAM. First I used this command: cmake .. -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="-march=pentium3" -DCMAKE_CXX_FLAGS="-march=pentium3" -DUSE_WOFF2=OFF -DENABLE_MINIBROWSER=ON -GNinja Then after ninja -j1 I got: [4/45] Linking CXX shared library lib/libwebkit2gtk-4.0.so.37.31.0 FAILED: lib/libwebkit2gtk-4.0.so.37.31.0 ... /usr/bin/i686-linux-gnu-ld.gold: fatal error: lib/libwebkit2gtk-4.0.so.37.31.0: mmap: failed to allocate 1895756280 bytes for output file: Cannot allocate memory collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. Which is strange since the VM didn't even use 1GB of RAM, reported by htop. Also the host still had plenty of RAM, see attachment. So then I used the command: cmake .. -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_FLAGS="-march=pentium3 -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -g1" -DCMAKE_CXX_FLAGS="-march=pentium3 -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -g1" -DUSE_WOFF2=OFF -DENABLE_MINIBROWSER=ON -GNinja Then I got: [148/2065] Linking CXX executable bin/LLIntOffsetsExtractor FAILED: bin/LLIntOffsetsExtractor : && /usr/bin/c++ -fdiagnostics-color=always -Wno-expansion-to-defined -Wno-attributes -Wno-noexcept-type -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -Wextra -Wall -march=pentium3 -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -g1 -fno-strict-aliasing -fno-exceptions -fno-rtti -std=c++17 -O2 -g -DNDEBUG -fuse-ld=gold -Wl,--disable-new-dtags -rdynamic Source/JavaScriptCore/CMakeFiles/LLIntOffsetsExtractor.dir/llint/LLIntOffsetsExtractor.cpp.o -o bin/LLIntOffsetsExtractor lib/libWTFGTK.a lib/libbmalloc.a -ldl -licudata -licui18n -licuuc -lpthread -lgio-2.0 -lgobject-2.0 -lglib-2.0 -lz && : /usr/bin/i686-linux-gnu-ld.gold: --reduce-memory-overheads: unknown option /usr/bin/i686-linux-gnu-ld.gold: use the --help option for usage information collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. I copied what you wrote, I don't know why -Wl is there two times, etc, I could do experiment with trial and error but it would take more time, easier to ask. So how to correctly use these parameters? Thanks. ld -v GNU ld (GNU Binutils for Ubuntu) 2.30 uname -a Linux oldboi-VirtualBox 4.15.0-23-generic #25-Ubuntu SMP Wed May 23 17:59:24 UTC 2018 i686 i686 i686 GNU/Linux
karogyoker2+webkit
Comment 9
2018-07-18 23:03:20 PDT
Created
attachment 345332
[details]
memory usage on host
Michael Catanzaro
Comment 10
2018-07-19 05:14:22 PDT
Ah, you need to also pass -DUSE_LD_GOLD=OFF to use -Wl,--reduce-memory-overheads. That's probably worth trying anyway, since it's the ld.gold linker that is failing. (You need it twice because once is for the C compiler, and once is for the C++ compiler.)
karogyoker2+webkit
Comment 11
2018-07-19 22:45:30 PDT
Hi, OK, now I got this: Linking CXX shared library lib/libwebkit2gtk-4.0.so.37.31.0 FAILED: lib/libwebkit2gtk-4.0.so.37.31.0 .. /usr/bin/i686-linux-gnu-ld: final link failed: Memory exhausted collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed. There were still more than 1.5GB space in the swap, also the host had 3GB physical free RAM too. Isn't this happening because on a 32 bit OS a process can use maximum 4GB memory? I could put 16GB extra RAM into this machine so I would have 24GB, but I think it might not help. Do I need to cross-compile then? Are there any instructions how to do it for WebKit?
Michael Catanzaro
Comment 12
2018-07-20 05:53:55 PDT
I don't know what to tell you... in Fedora we use -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -g1. Since that didn't work for you, I guess attempting to cross compile would be reasonable. There are some instructions for cross-compiling for ARM (not what you want to do) at the bottom of
https://trac.webkit.org/wiki/BuildingGtk
. Good luck.... You might want to look up how Gentoo handles this.
karogyoker2+webkit
Comment 13
2018-07-20 14:20:53 PDT
Just for the record, on the host I have 24GB RAM now, in the VM 17.8GB, the linking failed just like before, at that moment RAM utilization was around 3.8GB. So that's it, it is not possible to build 32 bit version of WebKit without cross-compile. Maybe I'll try with Fedora, but there shouldn't be a difference regarding this.
Michael Catanzaro
Comment 14
2018-07-20 17:57:50 PDT
I can assure you that all major Linux distributions are successfully building it without cross compiling, so you might want to investigate what they're doing.
karogyoker2+webkit
Comment 15
2018-07-21 06:09:05 PDT
I installed Fedora 28 32bit but its kernel is not PAE so RAM is maxed at 3.5GB and I couldn't find a PAE kernel for it. I installed Lubuntu 64 bit, and WebKit compiled OK. I got a 2GB large .so file. Is this normal? Then I downloaded and compiled surf, it is working fine.
Michael Catanzaro
Comment 16
2018-07-21 06:22:42 PDT
(In reply to karogyoker2+webkit from
comment #15
)
> I installed Fedora 28 32bit but its kernel is not PAE so RAM is maxed at > 3.5GB and I couldn't find a PAE kernel for it. > I installed Lubuntu 64 bit, and WebKit compiled OK. I got a 2GB large .so > file. Is this normal? Then I downloaded and compiled surf, it is working > fine.
Yes, that is normal. You can reduce it using -g1. Or -g0, if you're desperate. I don't think we have anything actionable here, so I'm going to close this.
karogyoker2+webkit
Comment 17
2018-07-22 10:23:41 PDT
OK, the problem was -DCMAKE_BUILD_TYPE=RelWithDebInfo. It should be -DCMAKE_BUILD_TYPE=Release This way it is possible to compile it on 32 bit systems. So the steps are: 1. Go to
https://webkitgtk.org/releases/
2. download the newest stable, extract, go into extracted folder 3. cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-march=pentium3 -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -g0 -Os" -DCMAKE_CXX_FLAGS="-march=pentium3 -Wl,--no-keep-memory -Wl,--reduce-memory-overheads -g0 -Os" -DUSE_WOFF2=OFF -DUSE_LD_GOLD=OFF -DENABLE_MINIBROWSER=OFF -DENABLE_JIT=OFF -GNinja 4. ninja 5. sudo make install Maybe it could work with GOLD too without the reduce memory overheads stuffs.
karogyoker2+webkit
Comment 18
2018-07-22 10:34:42 PDT
Just for the record, I forgot one step, it is between step #2 and step #3: ./Tools/gtk/install-dependencies
karogyoker2+webkit
Comment 19
2018-07-22 10:58:51 PDT
(In reply to Michael Catanzaro from
comment #16
)
> (In reply to karogyoker2+webkit from
comment #15
) > > I installed Fedora 28 32bit but its kernel is not PAE so RAM is maxed at > > 3.5GB and I couldn't find a PAE kernel for it. > > I installed Lubuntu 64 bit, and WebKit compiled OK. I got a 2GB large .so > > file. Is this normal? Then I downloaded and compiled surf, it is working > > fine. > > Yes, that is normal. You can reduce it using -g1. Or -g0, if you're > desperate. > > I don't think we have anything actionable here, so I'm going to close this.
Or it can be reduced to ~52MB by using -DCMAKE_BUILD_TYPE=Release instead of -DCMAKE_BUILD_TYPE=RelWithDebInfo Just if somebody finds this in the future.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug