请教个core编译的问题
-
今天下了gxb-core
make到
[ 81%] Linking CXX executable embed_genesis
的时候
提示-lgraphene_chain找不到这个链接
于是我看了下,clone的代码里有个gxb-core/libraries/chain/lib/libgraphene_chain.tar.gz
解压后提示部分函数找不到实现。我大概看了下,gxb-core/libraries/chain/
这里是没有编译的,也没有用来生成lib的makefile
怎么样才能编译通过呢?
求各位大大解惑
-
编译使用了gxb-core/libraries/chain/lib/libgraphene_chain.dylib这个动态库,先尝试更新一下这个库,如果还是不行,请提供下编译环境,clang版本、操作系统等详细信息
-
这个不是苹果的库么?我用的是ubuntu16.04
li@li-TM1613:~/code/gxb-core$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.1-2ubuntu1~16.04' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.1 20160904 (Ubuntu 5.4.1-2ubuntu1~16.04)cmake的时候,所有的预装库都找齐了的
-
你再更新一下dev_master分支的代码,重新make试试看。
如果还有报错,麻烦帖一下报错的输出
-
这是具体的报错
[ 81%] Linking CXX executable embed_genesis
/usr/bin/ld: 找不到 -lgraphene_chain
/usr/bin/ld: 找不到 -lgraphene_chain
collect2: error: ld returned 1 exit status
libraries/egenesis/CMakeFiles/embed_genesis.dir/build.make:130: recipe for target 'libraries/egenesis/embed_genesis' failed
make[2]: *** [libraries/egenesis/embed_genesis] Error 1
CMakeFiles/Makefile2:863: recipe for target 'libraries/egenesis/CMakeFiles/embed_genesis.dir/all' failed
make[1]: *** [libraries/egenesis/CMakeFiles/embed_genesis.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2明显是没有找到graphene_chain的库
然后我看了下报错的地方
gxb-core/libraries/egenesis/CMakeFiles/embed_genesis.dir/link.txt内容为
/usr/bin/c++ -std=c++11 -Wall -fPIC -fno-builtin-memcmp -O2 -g -DNDEBUG CMakeFiles/embed_genesis.dir/embed_genesis.cpp.o -o embed_genesis -L/home/li/code/gxb-core/libraries/chain/lib -rdynamic ../app/libgraphene_app.a libgraphene_egenesis_none.a -lgraphene_chain ../db/libgraphene_db.a ../fc/libfc.a ../plugins/market_history/libgraphene_market_history.a ../plugins/account_history/libgraphene_account_history.a ../plugins/debug_witness/libgraphene_debug_witness.a ../app/libgraphene_app.a ../plugins/market_history/libgraphene_market_history.a ../plugins/account_history/libgraphene_account_history.a ../plugins/debug_witness/libgraphene_debug_witness.a ../net/libgraphene_net.a ../utilities/libgraphene_utilities.a -lgraphene_chain ../db/libgraphene_db.a ../fc/libfc.a -L/usr/local/lib -Wl,-Bstatic -lboost_thread -lboost_date_time -lboost_system -lboost_filesystem -lboost_program_options -lboost_signals -lboost_serialization -lboost_chrono -lboost_unit_test_framework -lboost_context -lboost_locale -lboost_iostreams -lboost_coroutine -Wl,-Bdynamic -lpthread -Wl,-Bstatic -lssl -lcrypto -Wl,-Bdynamic -lz -lbz2 -ldl -lrt -lreadline -lcurses ../fc/vendor/secp256k1-zkp/src/project_secp256k1-build/.libs/libsecp256k1.a -Wl,-rpath,/home/li/code/gxb-core/libraries/chain/lib这里面用到了-lgraphene_chain且-L的目录 为gxb-core/libraries/chain/lib
然后我看了下chain这个文件夹中CMakelist的内容
link_directories("${PROJECT_SOURCE_DIR}/libraries/chain/lib")file(GLOB HEADERS "include/graphene/chain/.hpp")
file(GLOB PROTOCOL_HEADERS "include/graphene/chain/protocol/.hpp")if(APPLE)
file(GLOB GRAPHENE_CHAIN_LIB "lib/libgraphene_chain.dylib")
FILE (COPY ${GRAPHENE_CHAIN_LIB} DESTINATION ${CMAKE_BINARY_DIR}/libraries/chain)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
FILE (COPY lib/libgraphene_chain.tar.gz DESTINATION ${CMAKE_BINARY_DIR}/libraries/chain)
execute_process(
COMMAND ${CMAKE_COMMAND} -E tar zxvf libgraphene_chain.tar.gz
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/libraries/chain
)
endif()这里面只是把
lib/libgraphene_chain.tar.gz
拷贝到了上一层目录,然后解压缩
而上一层目录并没有在编译embed_genesis的时候被放到链接路径啊?不明白为什么,是写错了么?
而如果是linux系统的话
gxb-core/libraries/chain/lib
里面没有可用的.so或者.a也没有用于生成类似文件的makefile或者CMakelist
只有一个现成的dylib,这个是苹果的动态库,nm识别不了
而该目录下另外的一个文件libgraphene_chain.tar.gz我解压后是有so的,但是可能这个so年代太久远了,新写的一些函数没加进去重新编译,导致有些函数实现找不到~我在想是不是你们都用的苹果做的开发呢?实在不行,我也用mbp编译好了。。。
-
@霜之小刀
git pull更新一下dev_master的代码。
昨天晚上我更新了动态库,你再试一下,代码编译可以支持ubuntu和osx两种系统。
-
@albert
昨晚11点多我pull过了
主要是缺少libgraphene_chain.so这个东东,而这个没有加上去,还是只有原来的libgraphene_chain.dylib
我前面提交的问题就是pull之后的,我现在正在尝试苹果的编译
-
编译苹果的时候也遇到了问题,还是找不到链接库的问题,不过是另外一个链接库
[ 90%] Linking CXX executable member_enumerator
ld: library not found for -lgraphene_egenesis_brief
-
This post is deleted!
-
将libgraphene_chain.dylib放在/usr/local/lib/目录下试试看
-
@albert
现在是两个系统的问题
1、ubuntu下的时候
提示找不到 -lgraphene_chain这个库
而目录下有的这个libgraphene_chain.dylib是应该是苹果系统的库啊~所以没编译成功
由于你们给mac系统提供的是现成的库(不是本地编译生成的)所以我认为是linux最新的库没有上传。2、mac os下的时候
上面ubuntu的问题是没有了,所以那个地方没出问题,但是另外一个地方出问题了,就是我前面发的
[ 90%] Linking CXX executable member_enumerator
ld: library not found for -lgraphene_egenesis_brief
我找了下,没有找到生成这个graphene_egenesis_brief库的地方呢~
-
感谢公信宝开发团队的支持!mac版本的core终于编译通过了!
特别感谢selected在qq上的支持,据说是z神????
最新更新的代码已经可以直接编译通过了,不过这里有几个地方还想讨论下
1、github里面的这句
brew install openssl cmake git openssl autoconf automake doxygen autoreconfls libtool
里面有2个openssl应该去掉一个
autoreconfls我这里找不到这个东东
另外我觉得应该加上wget,用于boost的安装脚本。
2、boost安装脚本里面Mac os的没有加sudo
不过我就算加了sudo也没法用需要关闭csrutil才能写入usr目录
就算写进了usr目录,默认的安装路径还是找不到头文件,需要加-DBOOST_ROOT才行
这里,我觉得是不是可以吧prefix直接放到项目的libraries里,然后添加到includepath好些呢? 还可以保证boost版本一致,嘎嘎
3、虽然brew了openssl的库,但是直接是找不到的,cmake的时候千万要加对路径和库的配置,这里后来者希望少走点弯路。
4、有个悲伤的消息,ubuntu还是编译不过。。。不过既然公信宝的主要开发都用mac的话,我也用mac好了,免得徒增烦恼。
5、我mac做开发做的比较少,很多做法可能不对,各位见谅哈
-
@霜之小刀 said in 请教个core编译的问题:
感谢公信宝开发团队的支持!mac版本的core终于编译通过了!
特别感谢selected在qq上的支持,据说是z神????
最新更新的代码已经可以直接编译通过了,不过这里有几个地方还想讨论下
1、github里面的这句
brew install openssl cmake git openssl autoconf automake doxygen autoreconfls libtool
里面有2个openssl应该去掉一个
autoreconfls我这里找不到这个东东
另外我觉得应该加上wget,用于boost的安装脚本。
2、boost安装脚本里面Mac os的没有加sudo
不过我就算加了sudo也没法用需要关闭csrutil才能写入usr目录
就算写进了usr目录,默认的安装路径还是找不到头文件,需要加-DBOOST_ROOT才行
这里,我觉得是不是可以吧prefix直接放到项目的libraries里,然后添加到includepath好些呢? 还可以保证boost版本一致,嘎嘎
3、虽然brew了openssl的库,但是直接是找不到的,cmake的时候千万要加对路径和库的配置,这里后来者希望少走点弯路。
4、有个悲伤的消息,ubuntu还是编译不过。。。不过既然公信宝的主要开发都用mac的话,我也用mac好了,免得徒增烦恼。
5、我mac做开发做的比较少,很多做法可能不对,各位见谅哈
赞啊,老铁
-
赞~!
-
/:strong 多谢老铁的建议,我们马上更新一下github readme文档。
-
@霜之小刀 你提的建议很好,因为文档的缺陷给你造成的困难表示歉意,我们会持续改进
-
mac下安装boost:
chmod +x bootstrap.sh ./bootstrap.sh ./b2 --buildtype=complete install toolset=clang cxxflags="-arch x86_64" linkflags="-arch x86_64"
不需要使用sudo,默认会安装到/usr/local下面
ls /usr/local/lib/libboost* ls /usr/local/include/boost
-
ubuntu下的编译,你拉取最新的代码试试看
-
@albert
多谢哈,后面我会继续跟进代码~
等到有机会,当个公信宝的下游厂商也不错,我先了解下gxs整体代码的框架
-
@霜之小刀 said in 请教个core编译的问题:
发做的比较少,很多做法可能不对,各位
../chain/libgraphene_chain.a(proposal.cpp.o):proposal.cpp:(.text+0x977): more undefined references to `fc::log_message::log_message(fc::log_context, std::string, fc::variant_object)' follow
collect2: error: ld returned 1 exit status
libraries/egenesis/CMakeFiles/embed_genesis.dir/build.make:132: recipe for target 'libraries/egenesis/embed_genesis' failed
make[2]: *** [libraries/egenesis/embed_genesis] Error 1
CMakeFiles/Makefile2:863: recipe for target 'libraries/egenesis/CMakeFiles/embed_genesis.dir/all' failed
make[1]: *** [libraries/egenesis/CMakeFiles/embed_genesis.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
这个问题解决了吗?Ubuntu16.04