Code Monkey home page Code Monkey logo

Comments (11)

vsreekanti avatar vsreekanti commented on June 20, 2024

Hi @authwork. At the moment, we haven't yet supported compiling with gcc/g++. I don't have a ton of experience with g++, so this is not something I'd be able to address quickly, but if you or anyone else would like to look into what would be necessary to support both gcc and clang, we'd love your contributions. Thanks!

from fluent.

vsreekanti avatar vsreekanti commented on June 20, 2024

Hi @authwork, as of #23, you should be able to compile with g++. This has been tested with both GCC 4.8 and 5.4 (the default versions installed on Amazon Linux and on Ubuntu 16.04). Please let me know if you run into any issues.

Closing this.

from fluent.

authwork avatar authwork commented on June 20, 2024

Hi @vsreekanti
Many thanks for your efficient work.
I encounter the same problem~(i.e., I used to directly add the path of dependent libs to the CMake configuration files, and replace clang++ with g++ but failed.)
I am using Ubuntu 18.04 and g++ (Ubuntu 7.3.0-16ubuntu3) 7.3.0
Protobuf is 3.5.1,
The command I use, like following:

install dependencies compiled via g++

./scripts/install-dependencies.sh g++

build all

export COMPILER=/usr/bin/g++ && ./scripts/build-all.sh

The problems are:

[ 69%] Linking CXX executable flkvs
CMakeFiles/flkvs.dir/server.cpp.o: In function run(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)': server.cpp:(.text+0x4d5c): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void ()(void))'
server.cpp:(.text+0x4d93): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' server.cpp:(.text+0x4db3): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
server.cpp:(.text+0x51b2): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))' server.cpp:(.text+0x51ea): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
server.cpp:(.text+0x580b): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))' server.cpp:(.text+0x5842): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
server.cpp:(.text+0x5866): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' server.cpp:(.text+0x5c90): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void ()(void))'
server.cpp:(.text+0x5cc7): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' server.cpp:(.text+0x6257): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void ()(void))'
server.cpp:(.text+0x628e): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' server.cpp:(.text+0x62b2): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
server.cpp:(.text+0x6d64): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const' server.cpp:(.text+0x707e): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'
server.cpp:(.text+0x7097): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const' server.cpp:(.text+0x70b0): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'
server.cpp:(.text+0x70c9): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const' CMakeFiles/flkvs.dir/server.cpp.o: In function EBSSerializer::put(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, unsigned int const&)':
...
[ 70%] Linking CXX executable flmonitor
../../../libflproto.a(requests.pb.cc.o): In function protobuf_requests_2eproto::protobuf_RegisterTypes(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': requests.pb.cc:(.text+0xb86): undefined reference to google::protobuf::internal::RegisterAllTypes(google::protobuf::Metadata const*, int)'
../../../libflproto.a(requests.pb.cc.o): In function protobuf_requests_2eproto::protobuf_AssignDescriptors()': requests.pb.cc:(.text+0x17ff): undefined reference to google::protobuf::internal::AssignDescriptors(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, google::protobuf::internal::MigrationSchema const*, google::protobuf::Message const* const*, unsigned int const*, google::protobuf::MessageFactory*, google::protobuf::Metadata*, google::protobuf::EnumDescriptor const**, google::protobuf::ServiceDescriptor const**)'
../../../libflproto.a(requests.pb.cc.o): In function KeyTuple::~KeyTuple()': requests.pb.cc:(.text+0x1893): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
requests.pb.cc:(.text+0x18c2): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' ../../../libflproto.a(requests.pb.cc.o): In function KeyAddressRequest::~KeyAddressRequest()':
requests.pb.cc:(.text+0x19c3): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' requests.pb.cc:(.text+0x19f2): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
...
replication_helpers.cpp:(.text+0x10d3): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' replication_helpers.cpp:(.text+0x1166): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void ()(void))'
replication_helpers.cpp:(.text+0x130e): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))' replication_helpers.cpp:(.text+0x32c9): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'
replication_helpers.cpp:(.text+0x32e2): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const' ../hash_ring/libflkvs-ring.a(hash_ring.cpp.o): In function HashRingUtilInterface::issue_replication_factor_request(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&, HashRing&, HashRing&, SocketCache&, unsigned int&)':
hash_ring.cpp:(.text+0x224b): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' hash_ring.cpp:(.text+0x232e): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void ()(void))'
hash_ring.cpp:(.text+0x2368): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]' hash_ring.cpp:(.text+0x2742): undefined reference to google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'
../hash_ring/libflkvs-ring.a(hash_ring.cpp.o): In function HashRingUtilInterface::get_address_from_routing(UserThread&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, zmq::socket_t&, zmq::socket_t&, bool&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned int&, unsigned int&)': hash_ring.cpp:(.text+0x3d4a): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
hash_ring.cpp:(.text+0x3e55): undefined reference to google::protobuf::internal::ArenaImpl::AllocateAlignedAndAddCleanup(unsigned long, void (*)(void*))' hash_ring.cpp:(.text+0x41f3): undefined reference to google::protobuf::internal::fixed_address_empty_string[abi:cxx11]'
hash_ring.cpp:(.text+0x47e2): undefined reference to `google::protobuf::Arena::OnArenaAllocation(std::type_info const*, unsigned long) const'
collect2: error: ld returned 1 exit status
kvs/src/monitor/CMakeFiles/flmonitor.dir/build.make:358: recipe for target 'kvs/src/monitor/flmonitor' failed
make[2]: *** [kvs/src/monitor/flmonitor] Error 1
CMakeFiles/Makefile2:805: recipe for target 'kvs/src/monitor/CMakeFiles/flmonitor.dir/all' failed
make[1]: *** [kvs/src/monitor/CMakeFiles/flmonitor.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
==========================end===================================
These are the same with my former experience.
I search it and some persons think it was caused by the fact that I compiled the protobuf library with GNU's libstdc++, but in the application I was using Clang's libc++, and the two don't work together.

Many thanks

from fluent.

vsreekanti avatar vsreekanti commented on June 20, 2024

Hi @authwork, when you run the build-all.sh script, please pass in the -g flag (i.e., ./scripts/build-all.sh -g. That will make the compilation use g++ instead of clang++, which I believe should fix this problem.

from fluent.

authwork avatar authwork commented on June 20, 2024

Hi @vsreekanti ,
In my command: export COMPILER=/usr/bin/g++ && ./scripts/build-all.sh
I have configured COMPILER to be /usr/bin/g++, which has similar function with '-g' flag.
i.e.,
g )
COMPILER="/usr/bin/g++" # this is what I set as an environment variable
RUN_FORMAT=""
echo "Compiler set to GNU g++..."
;;
? )

I also try the command : ./scripts/build-all.sh -g
And it output the same error message.

I will try it on Ubuntu 16.04 later. (But I still hope it can work on 18.04 since our cluster has upgraded the OS to 18.04 recently)

Many thanks

from fluent.

vsreekanti avatar vsreekanti commented on June 20, 2024

Hm. The reason I suggested setting -g was because that removes the -stdlib=libc++ flag from the compilation (see here), which seemed to be the issue you were referring to above. I don't have access to an Ubuntu 18.04 machine at the moment, but I'll see if I can get my hands on one on Monday and let you know if I'm able to find a fix.

Thanks for working with me on this!

from fluent.

authwork avatar authwork commented on June 20, 2024

Oh, that's my fault to forget mention this place,
I have tried the modified version of this repo but also failed with same issue.
In the modification, I pay attention to that this flag has been updated.

But I guess I may find the problem:
I forget to configure protobuf with CXXFLAGS='-std=c++11 -O3 -g'

from fluent.

vsreekanti avatar vsreekanti commented on June 20, 2024

I see. Yes, the latest version of this repository changes all configurations based on the underlying compiler, including for the yaml-cpp dependency. We are not supporting https://github.com/ucbrise/anna -- that's a snapshot of a previous version of the project.

from fluent.

authwork avatar authwork commented on June 20, 2024

Hi, @vsreekanti ,
Yes, of course. I just search some solutions from the Internet.
I have tried Ubuntu 16.04 and it can be successfully built. Cheers! :)

However, I try to reconfigure protobuf with CXXFLAGS='-std=c++11 -O3 -g' on Ubuntu 18.04 but still failed.

Many thanks

from fluent.

authwork avatar authwork commented on June 20, 2024

Hm. The reason I suggested setting -g was because that removes the -stdlib=libc++ flag from the compilation (see here), which seemed to be the issue you were referring to above. I don't have access to an Ubuntu 18.04 machine at the moment, but I'll see if I can get my hands on one on Monday and let you know if I'm able to find a fix.

Thanks for working with me on this!

I carefully read the scripts again, I still think:
'export COMPILER=/usr/bin/g++ && ./scripts/build-all.sh' has the same function with './scripts/build-all.sh -g'
As we can see, -g flag is only used to set COMPILER="/usr/bin/g++" , which I set as an environment variable.
And it is passed to the flag of cmake,
i,e,. cmake -std=c++11 "-GUnix Makefiles" -DCMAKE_BUILD_TYPE=$TYPE -DCMAKE_CXX_COMPILER=$COMPILER $TEST ..

and MAKE_CXX_COMPILER="/usr/bin/g++" will remove the -stdlib=libc++ flag from the compilation.

(SOLVED)
Hi, @vsreekanti
I finally successfully compiled in Ubuntu 18.04,
the reason is still using protobuf without CXXFLAGS='-std=c++11 -O3 -g'
because:
After make install, protobuf is installed to /usr/local/bin, instead of /usr/bin
in Ubuntu 16.04, /usr/bin/protoc --version shows 2.6.1 (so I know it immediately)
However, in Ubuntu 18.04, /usr/bin/protoc --version shows 3.5.1. I think it is updated via 'make install' until I using 'ls -al /usr/bin/protoc' which shows a very old date.
How to solve:
apt-get remove libprotobuf-dev protobuf-compiler # to remove old protobuf
Then it can works

Many thanks

from fluent.

vsreekanti avatar vsreekanti commented on June 20, 2024

Hi @authwork, thanks for this information. Glad to hear you got everything working! Let us know if you have any questions with the system moving forward.

from fluent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.