Tencent / flare

Flare是广泛投产于腾讯广告后台的现代化C++开发框架,包含了基础库、RPC、各种客户端等。主要特点为易用性强、长尾延迟低。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compile fail

4kangjc opened this issue · comments

编译环境 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'

__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/gcc@gcc.gnu.org/msg96208.html 有一些讨论,不过实现起来看起来有些困难。

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

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

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

后面我改成这样试试看。

恩恩 好

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

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

后面我改成这样试试看。

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

./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());

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

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

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

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

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

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

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

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

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

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

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

# vscode clangd
/.cache
/compile_commands.json

吗?

Screenshot_20221209_182333
这个应该是GCC12的误报

Screenshot_20221209_182333 这个应该是GCC12的误报

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

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

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

opentracing的test关了吧