facebook / wangle

Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
Apache License 2.0
3.04k stars 536 forks source link

undefined reference to `folly::init(int*, char***, bool) #122

Open TaoTaoFu opened 6 years ago

TaoTaoFu commented 6 years ago

Hi,everyone!

I plan to install fbthrift , but i need to install wangle before ,I don't know why make this mistake ; I had been update the "FindFolly.cmake"

#  Copyright (c) 2014, Facebook, Inc.
#  All rights reserved.
#
#  This source code is licensed under the BSD-style license found in the
#  LICENSE file in the root directory of this source tree. An additional grant
#  of patent rights can be found in the PATENTS file in the same directory.
#
# - Try to find folly
# This will define
# FOLLY_FOUND
# FOLLY_INCLUDE_DIR
# FOLLY_LIBRARIES

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7 FATAL_ERROR)

INCLUDE(FindPackageHandleStandardArgs)

FIND_LIBRARY(FOLLY_LIBRARY folly PATHS ${FOLLY_LIBRARYDIR})
FIND_PATH(FOLLY_INCLUDE_DIR "folly/String.h" PATHS ${FOLLY_INCLUDEDIR})

SET(FOLLY_LIBRARIES ${FOLLY_LIBRARY})

FIND_PACKAGE_HANDLE_STANDARD_ARGS(Folly
  REQUIRED_ARGS FOLLY_INCLUDE_DIR `FOLLY_LIBRARIES)

but the problem is still existed ,I don‘t how to solve it, please help me! thanks in advance!

tao@tao:~/Documents/wangle-2017.07.10.00/wangle$ cmake .
-- The C compiler identification is GNU 4.9.4
-- The CXX compiler identification is GNU 4.9.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Folly: /usr/local/include  
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   system
--   thread
--   filesystem
--   regex
--   context
--   chrono
--   date_time
--   atomic
-- Found OpenSSL: /usr/local/lib/libssl.so;/usr/local/lib/libcrypto.so (found version "1.1.1") 
-- Found glog: /usr/lib/x86_64-linux-gnu/libglog.so  
-- Found gflags: /usr/lib/x86_64-linux-gnu/libgflags.so  
-- Found libevent: /usr/lib/x86_64-linux-gnu/libevent.so  
-- Found double_conversion: /usr/local/lib/libdouble-conversion.a  
-- Found libdl: /usr/lib/x86_64-linux-gnu/libdl.so  
-- Found librt: /usr/lib/x86_64-linux-gnu/librt.so  
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/tao/Documents/wangle-2017.07.10.00/wangle
tao@tao:~/Documents/wangle-2017.07.10.00/wangle$ make
Scanning dependencies of target wangle
[  1%] Building CXX object CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o
[  2%] Building CXX object CMakeFiles/wangle.dir/acceptor/AcceptorHandshakeManager.cpp.o
[  2%] Building CXX object CMakeFiles/wangle.dir/acceptor/ConnectionManager.cpp.o
[  3%] Building CXX object CMakeFiles/wangle.dir/acceptor/LoadShedConfiguration.cpp.o
[  4%] Building CXX object CMakeFiles/wangle.dir/acceptor/ManagedConnection.cpp.o
[  5%] Building CXX object CMakeFiles/wangle.dir/acceptor/SecureTransportType.cpp.o
[  6%] Building CXX object CMakeFiles/wangle.dir/acceptor/SocketOptions.cpp.o
[  7%] Building CXX object CMakeFiles/wangle.dir/acceptor/SSLAcceptorHandshakeHelper.cpp.o
[  8%] Building CXX object CMakeFiles/wangle.dir/acceptor/TLSPlaintextPeekingCallback.cpp.o
[  9%] Building CXX object CMakeFiles/wangle.dir/acceptor/TransportInfo.cpp.o
[ 10%] Building CXX object CMakeFiles/wangle.dir/bootstrap/ServerBootstrap.cpp.o
[ 11%] Building CXX object CMakeFiles/wangle.dir/channel/FileRegion.cpp.o
[ 12%] Building CXX object CMakeFiles/wangle.dir/channel/Pipeline.cpp.o
[ 13%] Building CXX object CMakeFiles/wangle.dir/codec/LengthFieldBasedFrameDecoder.cpp.o
[ 14%] Building CXX object CMakeFiles/wangle.dir/codec/LengthFieldPrepender.cpp.o
[ 15%] Building CXX object CMakeFiles/wangle.dir/codec/LineBasedFrameDecoder.cpp.o
[ 16%] Building CXX object CMakeFiles/wangle.dir/concurrent/ThreadedExecutor.cpp.o
[ 16%] Building CXX object CMakeFiles/wangle.dir/concurrent/CPUThreadPoolExecutor.cpp.o
[ 17%] Building CXX object CMakeFiles/wangle.dir/concurrent/Codel.cpp.o
[ 18%] Building CXX object CMakeFiles/wangle.dir/concurrent/GlobalExecutor.cpp.o
[ 19%] Building CXX object CMakeFiles/wangle.dir/concurrent/IOThreadPoolExecutor.cpp.o
[ 20%] Building CXX object CMakeFiles/wangle.dir/concurrent/SerialExecutor.cpp.o
[ 21%] Building CXX object CMakeFiles/wangle.dir/concurrent/ThreadPoolExecutor.cpp.o
[ 22%] Building CXX object CMakeFiles/wangle.dir/deprecated/rx/Dummy.cpp.o
[ 23%] Building CXX object CMakeFiles/wangle.dir/ssl/PasswordInFile.cpp.o
[ 24%] Building CXX object CMakeFiles/wangle.dir/ssl/ServerSSLContext.cpp.o
[ 25%] Building CXX object CMakeFiles/wangle.dir/ssl/SSLContextManager.cpp.o
[ 26%] Building CXX object CMakeFiles/wangle.dir/ssl/SSLSessionCacheManager.cpp.o
[ 27%] Building CXX object CMakeFiles/wangle.dir/ssl/SSLUtil.cpp.o
[ 28%] Building CXX object CMakeFiles/wangle.dir/ssl/TLSTicketKeyManager.cpp.o
/home/tao/Documents/wangle-2017.07.10.00/wangle/ssl/TLSTicketKeyManager.cpp: In member function ‘int wangle::TLSTicketKeyManager::processTicket(SSL*, unsigned char*, unsigned char*, EVP_CIPHER_CTX*, HMAC_CTX*, int)’:
/home/tao/Documents/wangle-2017.07.10.00/wangle/ssl/TLSTicketKeyManager.cpp:88:5: warning: ‘int RAND_pseudo_bytes(unsigned char*, int)’ is deprecated (declared at /usr/local/include/openssl/rand.h:44) [-Wdeprecated-declarations]
     RAND_pseudo_bytes(salt, (int)sizeof(salt));
     ^
/home/tao/Documents/wangle-2017.07.10.00/wangle/ssl/TLSTicketKeyManager.cpp:88:46: warning: ‘int RAND_pseudo_bytes(unsigned char*, int)’ is deprecated (declared at /usr/local/include/openssl/rand.h:44) [-Wdeprecated-declarations]
     RAND_pseudo_bytes(salt, (int)sizeof(salt));
                                              ^
/home/tao/Documents/wangle-2017.07.10.00/wangle/ssl/TLSTicketKeyManager.cpp:100:5: warning: ‘int RAND_pseudo_bytes(unsigned char*, int)’ is deprecated (declared at /usr/local/include/openssl/rand.h:44) [-Wdeprecated-declarations]
     RAND_pseudo_bytes(iv, AES_BLOCK_SIZE);
     ^
/home/tao/Documents/wangle-2017.07.10.00/wangle/ssl/TLSTicketKeyManager.cpp:100:41: warning: ‘int RAND_pseudo_bytes(unsigned char*, int)’ is deprecated (declared at /usr/local/include/openssl/rand.h:44) [-Wdeprecated-declarations]
     RAND_pseudo_bytes(iv, AES_BLOCK_SIZE);
                                         ^
[ 29%] Building CXX object CMakeFiles/wangle.dir/ssl/TLSCredProcessor.cpp.o
[ 30%] Building CXX object CMakeFiles/wangle.dir/util/FilePoller.cpp.o
[ 31%] Linking CXX static library lib/libwangle.a
[ 31%] Built target wangle
Scanning dependencies of target gtest
[ 32%] Creating directories for 'gtest'
[ 33%] Performing download step (git clone) for 'gtest'
-- gtest download command succeeded.  See also /home/tao/Documents/wangle-2017.07.10.00/wangle/gtest/src/gtest-stamp/gtest-download-*.log
[ 34%] No patch step for 'gtest'
[ 35%] Performing update step for 'gtest'
-- gtest update command succeeded.  See also /home/tao/Documents/wangle-2017.07.10.00/wangle/gtest/src/gtest-stamp/gtest-update-*.log
[ 36%] Performing configure step for 'gtest'
-- gtest configure command succeeded.  See also /home/tao/Documents/wangle-2017.07.10.00/wangle/gtest/src/gtest-stamp/gtest-configure-*.log
[ 37%] Performing build step for 'gtest'
-- gtest build command succeeded.  See also /home/tao/Documents/wangle-2017.07.10.00/wangle/gtest/src/gtest-stamp/gtest-build-*.log
[ 38%] No install step for 'gtest'
[ 39%] Completed 'gtest'
[ 39%] Built target gtest
Scanning dependencies of target FilePollerTest
[ 40%] Building CXX object CMakeFiles/FilePollerTest.dir/util/test/FilePollerTest.cpp.o
[ 41%] Building CXX object CMakeFiles/FilePollerTest.dir/test/TestMain.cpp.o
[ 42%] Linking CXX executable bin/FilePollerTest
**CMakeFiles/FilePollerTest.dir/test/TestMain.cpp.o: In function `main':
TestMain.cpp:(.text+0x36): undefined reference to `folly::init(int*, char***, bool)'**
lib/libwangle.a(FilePoller.cpp.o): In function `wangle::FilePoller::stop()':
FilePoller.cpp:(.text+0x742): undefined reference to `folly::FunctionScheduler::cancelFunctionAndWait(folly::Range<char const*>)'
lib/libwangle.a(FilePoller.cpp.o): In function `void folly::TLRefCount::useGlobal<std::array<folly::TLRefCount*, 1ul> >(std::array<folly::TLRefCount*, 1ul> const&)':
FilePoller.cpp:(.text._ZN5folly10TLRefCount9useGlobalISt5arrayIPS0_Lm1EEEEvRKT_[_ZN5folly10TLRefCount9useGlobalISt5arrayIPS0_Lm1EEEEvRKT_]+0xb8): undefined reference to `folly::asymmetricHeavyBarrier(folly::AMBFlags)'
lib/libwangle.a(FilePoller.cpp.o): In function `folly::SingletonVault* folly::detail::createGlobal<folly::SingletonVault, folly::detail::DefaultTag>()::{lambda()#1}::operator()() const':
FilePoller.cpp:(.text._ZZN5folly6detail12createGlobalINS_14SingletonVaultENS0_10DefaultTagEEEPT_vENKUlvE_clEv[_ZZN5folly6detail12createGlobalINS_14SingletonVaultENS0_10DefaultTagEEEPT_vENKUlvE_clEv]+0x10): undefined reference to `folly::SingletonVault::defaultVaultType()'
lib/libwangle.a(FilePoller.cpp.o): In function `folly::threadlocal_detail::StaticMeta<folly::TLRefCount, void>::StaticMeta()':
FilePoller.cpp:(.text._ZN5folly18threadlocal_detail10StaticMetaINS_10TLRefCountEvEC2Ev[_ZN5folly18threadlocal_detail10StaticMetaINS_10TLRefCountEvEC5Ev]+0x3b): undefined reference to `folly::threadlocal_detail::StaticMetaBase::StaticMetaBase(folly::threadlocal_detail::ThreadEntry* (*)(), bool)'
lib/libwangle.a(FilePoller.cpp.o): In function `folly::threadlocal_detail::StaticMeta<void, void>::StaticMeta()':
FilePoller.cpp:(.text._ZN5folly18threadlocal_detail10StaticMetaIvvEC2Ev[_ZN5folly18threadlocal_detail10StaticMetaIvvEC5Ev]+0x3b): undefined reference to `folly::threadlocal_detail::StaticMetaBase::StaticMetaBase(folly::threadlocal_detail::ThreadEntry* (*)(), bool)'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/FilePollerTest] Error 1
make[1]: *** [CMakeFiles/FilePollerTest.dir/all] Error 2
make: *** [all] Error 2
maichm commented 6 years ago

+1

shreyshrivastava4799 commented 5 years ago

Did anyone find the solution to this problem ?