• notice
  • Congratulations on the launch of the Sought Tech site

Ubuntu22.04 compiles the linux kernel with multiple definition of `yylloc' problem solving

Recently upgraded to Ubuntu22.04, there will be multiple definition of `yylloc' error when compiling the linux kernel

/usr/bin/ld: scripts/dtc/dtc-parser.tab.o:(.bss+0x10): multiple definition of `yylloc'; scripts/dtc/dtc-lexer.lex.o:(.bss+0x0): first defined herecollect2: error: ld returned 1 exit statusmake-4.1[3]: *** [scripts/dtc/dtc] Error 1scripts/Makefile.host:99: recipe for target 'scripts/dtc/dtc' failedscripts/Makefile.build:544: recipe for target 'scripts/dtc' failedmake-4.1[2]: *** [scripts/dtc] Error 2

When I checked the solution on the Internet, I found that the error occurred because of the use of gcc 10.0 and above, so I checked the gcc version, the gcc version of Ubuntu22.04 is 11.2.0, so I plan to use gcc-9 on ubuntu22.04 Version

608ae568d1f34dc98722e08f9bb8a690.png

solution

  1. Download gcc-9 and g++-9

    sudo apt install gcc-9 g++-9
  2.  Switch the gcc g++ version to 9

    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 100sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 100
  3. Check the gcc version again, you can see that the version has become 9.4.0

    1bd8798867f54894a1cf3f9187c44cf6.png

  4.  At this time, the problem of multiple definition of `yylloc' will not appear when compiling the linux kernel again.




Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+