lpereira / lwan

Experimental, scalable, high performance HTTP server
https://lwan.ws
GNU General Public License v2.0
5.94k stars 548 forks source link

Centos编译报错 #342

Open fishfly123 opened 2 years ago

fishfly123 commented 2 years ago

lwan-request.c:(.text+0xe79): undefined reference to __builtin_expect_with_probability' lwan-request.c:(.text+0x12ad): undefined reference tobuiltin_expect_with_probability' lwan-request.c:(.text+0x1485): undefined reference to __builtin_expect_with_probability' lwan-request.c:(.text+0x19b8): undefined reference tobuiltin_expect_with_probability' lwan-request.c:(.text+0x1b7a): undefined reference to __builtin_expect_with_probability' ../../lib/liblwan.a(lwan-request.c.o):lwan-request.c:(.text+0x1d79): more undefined references to__builtin_expect_with_probability' follow collect2: error: ld returned 1 exit status make[2]: [src/bin/lwan/lwan] Error 1 make[1]: [src/bin/lwan/CMakeFiles/lwan.dir/all] Error 2 make: *** [all] Error 2

lpereira commented 2 years ago

Hi. Old compilers aren't well supported. It should be possible to build without this built-in, but there are probably other places where the code relies on things that aren't supported in old compilers.

Feel free to send a patch, though! I don't have the time to support Lwan on platforms, or with compilers that I don't use, but if someone fixes this, then I'll merge their patch just fine.

On Thu, Apr 28, 2022, at 9:25 PM, fishfly123 wrote:

lwan-request.c:(.text+0xe79): undefined reference to __builtin_expect_with_probability' lwan-request.c:(.text+0x12ad): undefined reference tobuiltin_expect_with_probability' lwan-request.c:(.text+0x1485): undefined reference to __builtin_expect_with_probability' lwan-request.c:(.text+0x19b8): undefined reference tobuiltin_expect_with_probability' lwan-request.c:(.text+0x1b7a): undefined reference to __builtin_expect_with_probability' ../../lib/liblwan.a(lwan-request.c.o):lwan-request.c:(.text+0x1d79): more undefined references to__builtin_expect_with_probability' follow collect2: error: ld returned 1 exit status make[2]: [src/bin/lwan/lwan] Error 1 make[1]: [src/bin/lwan/CMakeFiles/lwan.dir/all] Error 2 make: *** [all] Error 2

— Reply to this email directly, view it on GitHub https://github.com/lpereira/lwan/issues/342, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGKX5PQAGRLA3ZALEY3VHNJDZANCNFSM5UUOX6AA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

fishfly123 commented 2 years ago

你好。旧的编译器没有得到很好的支持。应该可以在没有这个内置的情况下进行构建,但可能在其他地方代码依赖于旧编译器不支持的东西。不过,请随意发送补丁!我没有时间在平台上支持 Lwan,或者使用我不使用的编译器,但如果有人修复了这个问题,那么我会合并他们的补丁就好了。 On Thu, Apr 28, 2022, at 9:25 PM, fishfly123 wrote: lwan-request.c:(.text+0xe79): undefined reference to __builtin_expect_with_probability' lwan-request.c:(.text+0x12ad): undefined reference tobuiltin_expect_with_probability' lwan-request.c:(.text+0x1485): undefined reference to __builtin_expect_with_probability' lwan-request.c:(.text+0x19b8): undefined reference tobuiltin_expect_with_probability' lwan-request.c:(.text+0x1b7a): undefined reference to __builtin_expect_with_probability' ../../lib/liblwan.a(lwan-request.c.o):lwan-request.c:(.text+0x1d79): more undefined references to__builtin_expect_with_probability' follow collect2: error: ld returned 1 exit status make[2]: [src/bin/lwan/lwan] Error 1 make[1]: [src/bin/lwan/CMakeFiles/lwan.dir/all] Error 2 make: [all] Error 2 — Reply to this email directly, view it on GitHub <#342>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADVGKX5PQAGRLA3ZALEY3VHNJDZANCNFSM5UUOX6AA. You are receiving this because you are subscribed to this thread.Message ID: @.>

非常感谢您的回复,我可以使用哪个版本的GCC进行正确编译呢?

kiwionly commented 2 years ago

@fishfly123

You could try as below:

  1. Install a package with repository for your system: On CentOS, install package centos-release-scl available in CentOS repository: $ sudo yum install centos-release-scl

  2. Install this collection, it come with GCC 9 $ sudo yum install devtoolset-9

  3. Start using software collections: $ scl enable devtoolset-9 bash

I was able to build with steps above in centos 7.9