macOS 10.13.2下编译错误
macOS下编译错误
- 连接问题
Packing libbrpc.a
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbrpc.a(atomicops_internals_x86_gcc.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbrpc.a(asan_invalid_access.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbrpc.a(baidu_naming_service.o) has no symbols
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: libbrpc.a(giano_authenticator.o) has no symbols
Linking protoc-gen-mcpack
ld: unknown option: -(
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [protoc-gen-mcpack] Error 1
- 编译步骤:
- brew install gun-getopt
- echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
- source ~/.zshrc
- brew install coreutils
- brew install openssl
- brew install gflags
- brew install leveldb
- sh config_brpc.sh --headers=/usr/local/Cellar --libs=/usr/local/Cellar
- make
mac版还在适配中
跨平台应该是个重要的feature, 持续关注
Mac已经支持了 @bitcwb @yjhjstz
安装步骤是不是要更新一下,按照文档安装是失败的。https://github.com/brpc/brpc/blob/master/docs/cn/getting_started.md#macos @zyearn
@smartczy 具体什么错?
文档里mac依赖的一些包没有写,比如:gnu-getopt和coreutils。 目前我在mac上的安装报错如下
-e Fail to find openssl/ssl.h from --headers
config_brpc.sh: line 157: export: `STATICALLY_LINKED_/usr/local/lib=0': not a valid identifier
config_brpc.sh: line 157: export: `STATICALLY_LINKED_/usr/local/lib=0': not a valid identifier
config_brpc.sh: line 169: [: -e: binary operator expected
grep: namespace [_A-Za-z0-9]\+ {: No such file or directory
-e Fail to grep namespace of gflags source -e /usr/local/include//gflags/gflags_declare.h
openssl已安装 @zyearn
把-cxx=clang++换成 -cxx clang++就好了,我更新下文档 @smartczy
@zyearn 编译问题
- master分支
- "darwin"条件下的"ECHO=echo -e"。sh config_brpc.sh报错。
config_brpc.sh: line 158: export: `STATICALLY_LINKED_/usr/local/Cellar/gflags/2.2.1/lib=0': not a valid identifier
config_brpc.sh: line 158: export: `STATICALLY_LINKED_/usr/local/Cellar/protobuf/3.3.0/lib=0': not a valid identifier
config_brpc.sh: line 171: [: -e: binary operator expected
grep: namespace [_A-Za-z0-9]\+ {: No such file or directory
-e Fail to grep namespace of gflags source -e /usr/local/Cellar/gflags/2.2.1/include//gflags/gflags_declare.h
- tag0.9.0
- "darwin"条件下的"ECHO=echo"。sh config_brpc.sh不会报错。但是出现编译错误
In file included from src/bthread/bthread.cpp:22:
./src/bthread/task_group.h:131:29: error: expected ';' at end of declaration list
TaskMeta* current_task() const { return _cur_meta; }
^
;
In file included from src/bthread/bthread.cpp:22:
In file included from ./src/bthread/task_group.h:251:
src/bthread/task_group_inl.h:48:12: error: no member named 'is_current_pthread_task' in 'bthread::TaskGroup'
if (g->is_current_pthread_task()) {
~ ^
src/bthread/task_group_inl.h:49:19: error: no member named 'ready_to_run' in 'bthread::TaskGroup'
return g->ready_to_run(next_tid);
~ ^
src/bthread/task_group_inl.h:51:32: error: no member named 'current_tid' in 'bthread::TaskGroup'
ReadyToRunArgs args = { g->current_tid(), false };
~ ^
src/bthread/bthread.cpp:224:26: error: no member named 'is_current_main_task' in 'bthread::TaskGroup'
if (g != NULL && !g->is_current_main_task()/*note*/) {
~ ^
src/bthread/bthread.cpp:225:19: error: no member named 'current_tid' in 'bthread::TaskGroup'
return g->current_tid();
~ ^
src/bthread/bthread.cpp:236:26: error: no member named 'is_current_main_task' in 'bthread::TaskGroup'
if (g != NULL && !g->is_current_main_task()) {
~ ^
src/bthread/bthread.cpp:357:26: error: no member named 'is_current_pthread_task' in 'bthread::TaskGroup'
if (NULL != g && !g->is_current_pthread_task()) {
~ ^
src/bthread/bthread.cpp:365:26: error: no member named 'is_current_pthread_task' in 'bthread::TaskGroup'
if (NULL != g && !g->is_current_pthread_task()) {
~ ^
9 errors generated.
make: *** [src/bthread/bthread.o] Error 1
@bitcwb
- 已经fix了
- tag0.9.0不支持mac,拉下最新代码
@zyearn
- config_brpc.sh中的279行,取得版本号错误{print $5}改为{print $4}
- 版本号取得失败导致了macOS 10.13版本添加了宏NO_CLOCK_GETTIME_IN_MAC导致编译错误
./src/butil/time.h:30:10: warning: 'CLOCK_MONOTONIC' macro redefined [-Wmacro-redefined]
# define CLOCK_MONOTONIC SYSTEM_CLOCK
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:156:9: note: previous definition is here
#define CLOCK_MONOTONIC _CLOCK_MONOTONIC
^
In file included from src/mcpack2pb/generator.cpp:25:
In file included from ./src/butil/file_util.h:28:
In file included from ./src/butil/files/file.h:21:
In file included from ./src/butil/files/scoped_file.h:11:
In file included from ./src/butil/logging.h:31:
./src/butil/time.h:32:13: error: typedef redefinition with different types ('int' vs 'enum clockid_t')
typedef int clockid_t;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:171:3: note: previous definition is here
} clockid_t;
^
In file included from src/mcpack2pb/generator.cpp:25:
In file included from ./src/butil/file_util.h:28:
In file included from ./src/butil/files/file.h:21:
In file included from ./src/butil/files/scoped_file.h:11:
In file included from ./src/butil/logging.h:31:
./src/butil/time.h:102:5: error: no matching function for call to 'clock_gettime'
clock_gettime(CLOCK_REALTIME, &time);
^~~~~~~~~~~~~
./src/butil/time.h:35:5: note: candidate function not viable: no known conversion from 'int' to 'clockid_t' for 1st argument
int clock_gettime(clockid_t id, timespec* time);
^
./src/butil/time.h:120:5: error: no matching function for call to 'clock_gettime'
clock_gettime(CLOCK_REALTIME, &time);
^~~~~~~~~~~~~
./src/butil/time.h:35:5: note: candidate function not viable: no known conversion from 'int' to 'clockid_t' for 1st argument
int clock_gettime(clockid_t id, timespec* time);
^
2 warnings and 3 errors generated.
make: *** [src/mcpack2pb/generator.o] Error 1
This issue has been automatically marked as stale because it's inactive for a long time. It will be closed if no further activity occurs, reopen if you have further ideas. Thank you for your contributions! 由于很久没有活跃,此Issue已被自动标记为过期。之后几天仍无变化的话将会被关闭,若你有新想法则可重新打开。感谢你的贡献!
依然报错,而且这个版本貌似没法按照bitcwb的方法修正 In file included from src/bthread/bthread.cpp:22: ./src/bthread/task_group.h:131:29: error: expected ';' at end of declaration list TaskMeta* current_task() const { return _cur_meta; } ^ ; In file included from src/bthread/bthread.cpp:22: In file included from ./src/bthread/task_group.h:251: src/bthread/task_group_inl.h:48:12: error: no member named 'is_current_pthread_task' in 'bthread::TaskGroup' if (g->is_current_pthread_task()) { ~ ^ src/bthread/task_group_inl.h:49:19: error: no member named 'ready_to_run' in 'bthread::TaskGroup' return g->ready_to_run(next_tid); ~ ^ src/bthread/task_group_inl.h:51:32: error: no member named 'current_tid' in 'bthread::TaskGroup' ReadyToRunArgs args = { g->current_tid(), false }; ~ ^ src/bthread/bthread.cpp:224:26: error: no member named 'is_current_main_task' in 'bthread::TaskGroup' if (g != NULL && !g->is_current_main_task()/note/) { ~ ^ src/bthread/bthread.cpp:225:19: error: no member named 'current_tid' in 'bthread::TaskGroup' return g->current_tid(); ~ ^ src/bthread/bthread.cpp:236:26: error: no member named 'is_current_main_task' in 'bthread::TaskGroup' if (g != NULL && !g->is_current_main_task()) { ~ ^ src/bthread/bthread.cpp:357:26: error: no member named 'is_current_pthread_task' in 'bthread::TaskGroup' if (NULL != g && !g->is_current_pthread_task()) { ~ ^ src/bthread/bthread.cpp:365:26: error: no member named 'is_current_pthread_task' in 'bthread::TaskGroup' if (NULL != g && !g->is_current_pthread_task()) { ~ ^ 9 errors generated.