Comments (10)
用cmake的话注意一下https://github.com/Tencent/flare/blob/master/flare/base/compression/BUILD#L55 link_all_symbols,对应于-Wl,--whole-archive
不然链接器可能会把自动注册的这些文件丢掉
https://stackoverflow.com/questions/805555/ld-linker-question-the-whole-archive-option
from flare.
没太理解,是说编译以后直接运行compression_test gzip
失败了吗,但是这个compression_test感觉接受不了参数啊🤔
from flare.
第1个用例SetUp()
函数会读取参数的。第2个用例是正常的,作为参照。
from flare.
我还是没理解是怎么从命令行读到的gzip,要么cout一下看看是不是真的读到了?
from flare.
./compression_test gzip
这里的gzip
是输入参数,看这个用例代码应该是需要入参的
std::string Compress(
std::function<bool(Compressor*, CompressionOutputStream* out)> f) {
if (!with_test_output_stream_) {
NoncontiguousBufferBuilder builder;
NoncontiguousBufferCompressionOutputStream out(&builder);
// Setup()函数解析后,这里method_为入参值gzip
auto&& c = MakeCompressor(method_); // 调试这里一直返回nullptr
EXPECT_TRUE(c);
这是第一个用例的问题。
第二个用例是直接代码里写的MakeCompressor(“gzip”)
,能正常得到Compressor
。
两个用例同样是MakeCompressor(“gzip”)
,结果第一个用例在 EXPECT_TRUE(c);
失败了。
from flare.
你的执行方式是
~/flare/build64_release/flare/base/compression_test.runfiles]% LD_LIBRARY_PATH=. ../compression_test gzip
这样吗
我这样执行看起来命令行参数gzip
被忽略了,跟直接执行LD_LIBRARY_PATH=. ../compression_test
效果是一样的
你也可以试试把method_
打出来看看是不是符合预期的内容
from flare.
你看的是第二个用例,这个是对的。我说的是第一个用例,method_
打印是符合我预期的。
from flare.
你运行的是master代码生成的flare/base/compression/compression_test
吗?
我试了下不管不传命令行参数或者传命令行参数gzip
,输出是一样的。而且根据我的理解,gtest也不会因为命令行传入了一个不以-
开头的参数就改变行为。
from flare.
确实是master
分支代码,不过我自己用cmake
管理的。那就奇怪了,感觉像是auto&& c = MakeCompressor(method_);
早于全局变量FLARE_COMPRESSION_REGISTER_COMPRESSOR("gzip", GzipCompressor);
的初始化,只有这种情况才会出错,但是用例2
却正常运行。。。
from flare.
谢谢,原来如此。
from flare.
Related Issues (20)
- Http header data structure HOT 13
- Rpc: Http parse HOT 5
- 针对K8s容器环境是否有需要注意的优化配置呢 HOT 2
- clang-format HOT 15
- update blade HOT 9
- logging HOT 11
- if have any plan to support bazel HOT 1
- bazel build ... 失败 HOT 6
- 请问有合适的源码阅读顺序吗 HOT 5
- 对GetFreeCount的取值比较困惑 HOT 5
- Does the server example in the flare example support 1 thread start? HOT 4
- clang-17 asan/tsan fiber coredump
- 关于Function类的疑问 HOT 2
- 关于调度参数的疑问 HOT 1
- 编译时间太长 HOT 4
- 调试相关 HOT 3
- Fiber scheduling takes too long HOT 3
- Can it support machines with large cores HOT 4
- 使用`getaddrinfo`会不会更好一点 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flare.