md.jamal
md.jamal

Reputation: 4567

qtwebengine: undefined reference to std::basic_streambuf

I am compiling qtwebengine 5.15.2 using Yocto on Ubuntu 18.04.

I am getting the below error:

[18991/20786] STAMP v8_snapshot/obj/v8/run_gen-regexp-special-case.stamp
[18992/20786] LINK v8_snapshot/torque
FAILED: v8_snapshot/torque
/home/aws-mjamal/test/build-am437x-evm-test/tmp/hosttools/g++ -pie -Wl,--fatal-warnings -Wl,--build-id=sha1 -fPIC -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-z,defs -Wl,--as-needed -m32 -pie -Wl,--disable-new-dtags -Wl,-O2 -Wl,--gc-sections -o "v8_snapshot/torque" -Wl,--start-group @"v8_snapshot/torque.rsp"  -Wl,--end-group  -ldl -lpthread -lrt
v8_snapshot/obj/v8/torque_base/torque_base_jumbo_3.o:(.data.rel.ro._ZTVN2v88internal6torque13NullStreambufE[_ZTVN2v88internal6torque13NullStreambufE]+0x18): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::seekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)'
collect2: error: ld returned 1 exit status
[18993/20786] CXX v8_snapshot/obj/v8/third_party/inspector_protocol/crdtp/crdtp_jumbo_1.o
[18994/20786] CXX v8_snapshot/obj/v8/src/inspector/inspector/inspector_jumbo_1.o
[18995/20786] CXX v8_snapshot/obj/v8/src/inspector/inspector/inspector_jumbo_3.o
[18996/20786] CXX v8_snapshot/obj/v8/src/inspector/inspector/inspector_jumbo_2.o
[18997/20786] CXX v8_snapshot/obj/v8/src/inspector/inspector/inspector_jumbo_4.o
ninja: build stopped: subcommand failed.

Upvotes: 1

Views: 363

Answers (1)

user3450148
user3450148

Reputation: 962

Well, to start with, seekoff is a virtual protected method.

https://en.cppreference.com/w/cpp/io/basic_streambuf

https://en.cppreference.com/w/cpp/io/basic_streambuf/pubseekoff

  1. Calls seekoff(off, dir, which) of the most derived class

  2. The base class version of this function has no effect. The derived classes may override this function to allow relative positioning of the position indicator.

So, your chosen configure answers opted to not build the source file where seekoff is actually implemented for that object.

Qt supports X11 with Ubuntu 18.04. https://doc.qt.io/qt-5/linux.html

Others have had issues trying to build qtwebengine on Ubuntu 18.04 due to a very old libopus being native on that platform.

https://askubuntu.com/questions/1355519/opus-1-3-1-on-ubuntu-18-04-w-preinstalled-opus-0-5-2

You didn't list your brand of board, but here are the instructions from one vendor.

https://developer.toradex.com/knowledge-base/how-to-set-up-qt-creator-to-cross-compile-for-embedded-linux#boot-to-qt-for-embedded-linux

Is this the only error you got?

Web engine is a beast. Everybody deletes it from embedded systems projects because of this. The error you are focusing on might have nothing to do with the real problem. Embedded systems builds of Qt notoriously run out of memory building WebEngine, especially if a person doesn't use -j1 to limit to a single processor. It can consume 8GB per process. If you didn't limit the number of jobs to 1 and have a 4-core machine then it tried to use 32GB and you probably didn't have that. Somewhere further back in the log you got an out of memory error and it didn't fatal out right there.

Do you actually need qtwebengine or are you just building it to build everything?

Almost every embedded system does what this one did. https://community.toradex.com/t/apalis-imx8qm-b2qt-qtwebengine-build-error/11441/3

It's a resource pig. Lots of embedded systems don't have enough under the hood to even think about running it.

So, one of the following should work for you:

  1. If you don't need webengine start a fresh build in a clean directory tree and remove it from the configuration.
  2. If you do really need it start a fresh build in a clean directory tree and use -j1 on the make/ninja command to limit to one CPU/thread so you don't exhaust memory.
  3. Odds are you won't be lucky enough to have torque_base_jumbo_3 directly use seekoff(). Qt likes to bury stuff like that in hidden private classes. You will have to identify what objects (if you can) that are derived from or contain something derived from std::basic_streambuf. With templates using templates sometimes that can be impossible. Use grep (or a grep-like tool) to go down the entire source tree identifying which source files made use of seekoff(). That should be a small number. Next, search your build log to see what happened to each of those files. Did they all build clean or are some of them not getting built at all?

https://blog.kitware.com/cmake-building-with-all-your-cores/

ninja does not require a –j flag like GNU make to perform a parallel build. It defaults to building cores +2 jobs at once

The only "quick fixes" for your problem is to take webengine out if you don't need it and limiting ninja to 1.

Oh! Also check the X11 link I posted for the minimum compiler version for Ubuntu 18.04. You could be getting bit by that.

Upvotes: 2

Related Questions