Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile fail #64

Closed
4kangjc opened this issue May 1, 2022 · 17 comments
Closed

compile fail #64

4kangjc opened this issue May 1, 2022 · 17 comments

Comments

@4kangjc
Copy link
Contributor

4kangjc commented May 1, 2022

编译环境 gcc 版本 11.2.0 (GCC)

flare2

这里缺少头文件, 加入头文件 optional 就行

flare

这个我暂时将/usr/include/sys/cdefs.h中的__glibc_has_attribute (const)删了,希望有更好的解决办法

flare3

在thirdparty/curl/BUILD的configure_options里加入'--without-librtmp'和'--without-libpsl'

@0x804d8000
Copy link
Collaborator

__const__那个有点麻烦,原意是为了解决gcc对访问errno的缓存问题(参考https://github.com/apache/incubator-brpc/blob/master/docs/cn/thread_local.md ),但是看起来这个workaround跟新版glibc冲突了。

其实这儿还有一些类似的问题,都是对tls的访问的缓存上(errno那个因为多了个函数调用,把问题变成了const这个attribute)。之前在开了tsan的情况下fiber_entity.h里面也出过问题,后来把一些inline干掉了绕过去了。

针对这些缓存问题https://www.mail-archive.com/[email protected]/msg96208.html 有一些讨论,不过实现起来看起来有些困难。

可以试试把几个BUILD里面的extra_cppflags = ['-D__const__=']换成extra_cppflags = ['-D__const__=hot'],可能可以作为一个workaround的workaround。

@0x804d8000
Copy link
Collaborator

另一种办法(preferably)是干脆不用errno了,单独提供一个独立函数int FiberSafeGetLastError();。然后把现在的errno都换成调用这个函数。

这个函数的实现({ return errno; })放在.cc里,这样编译器在call site就没法做CSE了,保证每次都会实际访问errno。感觉上这么搞也可以解决这个问题,然后就不用-D__const__=了。

后面我改成这样试试看。

@4kangjc
Copy link
Contributor Author

4kangjc commented May 4, 2022

恩恩 好

@4kangjc
Copy link
Contributor Author

4kangjc commented Nov 26, 2022

另一种办法(preferably)是干脆不用errno了,单独提供一个独立函数int FiberSafeGetLastError();。然后把现在的errno都换成调用这个函数。

这个函数的实现({ return errno; })放在.cc里,这样编译器在call site就没法做CSE了,保证每次都会实际访问errno。感觉上这么搞也可以解决这个问题,然后就不用-D__const__=了。

后面我改成这样试试看。

这个问题好像还是存在, gcc12

@4kangjc
Copy link
Contributor Author

4kangjc commented Nov 26, 2022

image

@4kangjc 4kangjc reopened this Nov 26, 2022
@4kangjc
Copy link
Contributor Author

4kangjc commented Nov 26, 2022

./flare/base/demangle.h: In function 'std::string flare::GetTypeName(T&&) [with T = const Message&]':
./flare/base/demangle.h:33:52: error: 'nonnull' argument 'o' compared to NULL [-Werror=nonnull-compare]
   33 |   return Demangle(typeid(std::forward<T>(o)).name());

@4kangjc
Copy link
Contributor Author

4kangjc commented Nov 27, 2022

Ubuntu-latest workflows will use Ubuntu-22.04
actions/runner-images#6399
Ubuntu-22.04 gcc version is gcc-11
flare可能会由于catch2的问题而导致编译失败

https://github.com/Tencent/flare/actions/runs/3556570315

@4kangjc
Copy link
Contributor Author

4kangjc commented Nov 27, 2022

Screenshot_20221127_121425
GCC11 除catch2的那个问题外,应该编译没啥问题了
GCC12 问题很大

@0x804d8000
Copy link
Collaborator

__const__之前应该是改漏了,#80 试着修了一下。

catch2那个似乎是opentracing跑去用clang编译了,回头看看能不能强制指定gcc试试。

@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

__const__之前应该是改漏了,#80 试着修了一下。

catch2那个似乎是opentracing跑去用clang编译了,回头看看能不能强制指定gcc试试。

嗯,__const__已经修好了。
catch2应该是这个问题 catchorg/Catch2#2178

@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

GCC12 有一个 protobuf的问题,好像是这个
protocolbuffers/protobuf#7140
Screenshot_20221209_142047

@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

GCC12 有一个 protobuf的问题,好像是这个 protocolbuffers/protobuf#7140 Screenshot_20221209_142047

或者加'-Wno-array-bounds''-Wno-stringop-overread'
Screenshot_20221209_143617

@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

@0x804d8000 我可以在.gitignore里加上

# vscode clangd
/.cache
/compile_commands.json

吗?

@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

Screenshot_20221209_182333
这个应该是GCC12的误报

@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

Screenshot_20221209_182333 这个应该是GCC12的误报

改成abs_path = std::string("/");就能编译通过

@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

Screenshot_20221209_184418

@4kangjc 4kangjc mentioned this issue Dec 9, 2022
@4kangjc
Copy link
Contributor Author

4kangjc commented Dec 9, 2022

__const__之前应该是改漏了,#80 试着修了一下。

catch2那个似乎是opentracing跑去用clang编译了,回头看看能不能强制指定gcc试试。

opentracing的test关了吧

@4kangjc 4kangjc closed this as completed Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants