Comments (46)
Please paste the exact error discriptions.
from evpp.
Linking CXX executable ../bin/evmc_test
../lib/libevpp_concurrentqueue.so.0.3.2.1: undefined reference to evpp::DNSResolver::OnResolved()' ../lib/libevpp_concurrentqueue.so.0.3.2.1: undefined reference to
evpp::DNSResolver::ClearTimer()'
from evpp.
centos 7
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-123.el7.x86_64", arch: "amd64", family: "unix"
from evpp.
lib directory
libevmc.so libevpp_boost.so libevpp_concurrentqueue.so libevpp.so
libevmc.so.0.3 libevpp_boost.so.0.3 libevpp_concurrentqueue.so.0.3 libevpp.so.0.3
libevmc.so.0.3.2.1 libevpp_boost.so.0.3.2.1 libevpp_concurrentqueue.so.0.3.2.1 libevpp.so.0.3.2.1
libevmc_static.a libevpp_boost_static.a libevpp_concurrentqueue_static.a libevpp_static.a
from evpp.
Do you use the compile script tools/debug-build.sh
or tools/release-build.sh
to build?
I cannot reproduce the problem.
My env is:
[weizili@dtrans3 ~/git/evpp/tools]$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[weizili@dtrans3 ~/git/evpp/tools]$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
from evpp.
I try to use tools/debug-build.sh,and it just set path
[ 60%] Building CXX object test/CMakeFiles/evpp_unittest.dir/__/3rdparty/gtest/src/gtest_main.cc.o
Linking CXX executable ../bin/evpp_unittest
../lib/libevpp.so.0.3.2.1: undefined reference to evpp::DNSResolver::OnResolved()' ../lib/libevpp.so.0.3.2.1: undefined reference to
evpp::DNSResolver::ClearTimer()'
from evpp.
Try to add link_directories(${LIBRARY_OUTPUT_PATH})
into CMakeLists.txt
of the root directory.
@@ -49,6 +49,8 @@ endif (CMAKE_BENCHMARK_TESTING)
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
+link_directories(${LIBRARY_OUTPUT_PATH})
+
#set (MACOSX_RPATH ${LIBRARY_OUTPUT_PATH})
set (CMAKE_MACOSX_RPATH 0)
from evpp.
if i alreay get libevmc_static.a libevpp_boost_static.a libevpp_concurrentqueue_static.a libevpp_static.a
and
g++ testserver.cpp -o server -levpp --std=c++11 to compile your demo code
from evpp.
use -L /the/path/to/library
for gcc
from evpp.
[root@localhost evpp-master]# g++ testserver.cpp -o server -L /home/project/evpp-master/lib -levpp -lglog --std=c++11
/home/project/evpp-master/lib/libevpp.so: undefined reference to evpp::DNSResolver::OnResolved()' /home/project/evpp-master/lib/libevpp.so: undefined reference to
evpp::DNSResolver::ClearTimer()'
from evpp.
Got it. Do you use libevent1.4?
Please pull the latest codes and try again.
from evpp.
2.0
from evpp.
OK.
- Please pull the latest codes and try again.
- Tell me the exact version of your libevent. My libevent version is 2.0.21
from evpp.
ok, i find “#if LIBEVENT_VERSION_NUMBER >= 0x02010500 ” in libevent_headers.h
so i confirm libevent version in my computer,libevent-2.0.so.5.0.1
the issue maybe the libevent version,and hope u fix the problem
from evpp.
Try this command rpm -qa|grep libevent
and paste the output.
from evpp.
ls -al /usr/local/lib | grep libevent
lrwxrwxrwx. 1 root root 21 Mar 24 09:59 libevent-2.0.so.5 -> libevent-2.0.so.5.0.1
-rwxr-xr-x. 1 root root 1106029 Mar 24 09:59 libevent-2.0.so.5.0.1
-rw-r--r--. 1 root root 603088 Apr 26 09:50 libevent.a
from evpp.
rpm -qa|grep libevent
i dont install libevent with yum ,just cmake and make && make install
from evpp.
Please try to use yum to install libevent sudo yum install libevent-devel
. Or use a higher version of libevent >= 2.0.15.
I don't have ENV to test if you can't show me the exact version of your libevent.
from evpp.
i reinstall libevet using 3rdparty/libevent-release-2.1.8-stable
cmake . and make
from evpp.
Does it work now?
from evpp.
std::cout.setf(std::ios_base::hex,std::ios_base::basefield);
std::cout << LIBEVENT_VERSION_NUMBER << std::endl;
2010800
still [ 53%] Built target evpp_static
Linking CXX executable ../bin/evpp_unittest
../lib/libevpp.so.0.3.2.1: undefined reference to evpp::DNSResolver::OnResolved()' ../lib/libevpp.so.0.3.2.1: undefined reference to
evpp::DNSResolver::ClearTimer()'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/evpp_unittest] Error 1
make[1]: *** [test/CMakeFiles/evpp_unittest.dir/all] Error 2
from evpp.
Do you pull the latest code?
$ git log
commit 02a40d0059c46861e01e8aa0fc6df003b1277f2e
Author: weizili <[email protected]>
Date: Tue Apr 25 19:42:24 2017 +0800
Fix issue https://github.com/Qihoo360/evpp/issues/39
from evpp.
Linking CXX executable ../bin/evmc_test
../lib/libevpp_concurrentqueue.so.0.3.2.2536: undefined reference to evhttp_connection_get_addr' ../lib/libevpp_concurrentqueue.so.0.3.2.2536: undefined reference to
evhttp_connection_set_timeout_tv'
collect2: error: ld returned 1 exit status
make[2]: *** [bin/evmc_test] Error 1
make[1]: *** [apps/CMakeFiles/evmc_test.dir/all] Error 2
commit 02a40d0
Author: weizili [email protected]
Date: Tue Apr 25 19:42:24 2017 +0800
from evpp.
Which version of libevent do you link aganst?
Please paste the output of ldd libevpp_concurrentqueue.so.0.3.2.2536
.
We strongly suggest you to use sudo yum install libevent-devel
to install libevent.
from evpp.
linux-vdso.so.1 => (0x00007fffa6ffe000)
libevent-2.0.so.5 => /usr/local/lib/libevent-2.0.so.5 (0x00007f160d276000)
libglog.so.0 => /usr/local/lib/libglog.so.0 (0x00007f160d046000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f160ce2a000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f160cb22000)
libm.so.6 => /lib64/libm.so.6 (0x00007f160c820000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f160c609000)
libc.so.6 => /lib64/libc.so.6 (0x00007f160c247000)
/lib64/ld-linux-x86-64.so.2 (0x00007f160d72d000)
from evpp.
std::cout.setf(std::ios_base::hex,std::ios_base::basefield);
std::cout << LIBEVENT_VERSION_NUMBER << std::endl;
2010800
from evpp.
I commented code in CMakeLists.txt
#add_subdirectory (apps)
#add_subdirectory (test)
#add_subdirectory (examples)
#add_subdirectory (benchmark)
get result
[ 16%] Built target evpp
[ 33%] Built target evpp_boost
[ 50%] Built target evpp_boost_static
[ 66%] Built target evpp_concurrentqueue
[ 83%] Built target evpp_concurrentqueue_static
[100%] Built target evpp_static
so i just test echodemo on website
g++ echo.cpp -o echo --std=c++11 -levpp -lglog
/usr/local/lib/libevpp.so: undefined reference to evhttp_connection_get_addr' /usr/local/lib/libevpp.so: undefined reference to
evhttp_connection_set_timeout_tv'
why http?
from evpp.
evpp is library for TCP/UDP/HTTP protocols.
I guess that you use header files from libevent-2.1.8 when compiling, but link against a libevent.so from libevent-2.0.x.
Please paste the output of ldd /usr/local/lib/libevpp.so
from evpp.
linux-vdso.so.1 => (0x00007ffffc7fe000)
libevent-2.0.so.5 => /usr/local/lib/libevent-2.0.so.5 (0x00007f0389523000)
libglog.so.0 => /usr/local/lib/libglog.so.0 (0x00007f03892f3000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f03890d7000)
libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f0388dcf000)
libm.so.6 => /lib64/libm.so.6 (0x00007f0388acd000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f03888b6000)
libc.so.6 => /lib64/libc.so.6 (0x00007f03884f4000)
/lib64/ld-linux-x86-64.so.2 (0x00007f03899d6000)
libunwind.so.8 => /usr/local/lib/libunwind.so.8 (0x00007f03882db000)
from evpp.
/usr/local/lib/libevent-2.0.so.5
is compiled from libevent-2.1.8???
from evpp.
std::cout.setf(std::ios_base::hex,std::ios_base::basefield);
std::cout << LIBEVENT_VERSION_NUMBER << std::endl;
2010800
from evpp.
Paste the output of nm /usr/local/lib/libevent-2.0.so.5 | grep evhttp_connection_set_timeout
from evpp.
Paste the output of strings /usr/local/lib/libevent-2.0.so.5 | grep 2.
from evpp.
strings libevent-2.0.so.5 | grep evhttp_connection_set_timeout
evhttp_connection_set_timeout
evhttp_connection_set_timeout
evhttp_connection_set_timeout
2.0.10-stable?
from evpp.
Yes, that's the problem.
You said you have reinstalled libevet using 3rdparty/libevent-release-2.1.8-stable. But you linked against with libevent-2.0.10.
Your ENV massed up totally.
from evpp.
strings libevent.a | grep 2.
2.1.8-beta not stable
from evpp.
But you link against libevent.so not libevent.a
from evpp.
Please clean up your ENV, and use sudo yum install libevent-devel
to reinstall libevent
from evpp.
ok
from evpp.
why TCPClient has no send function
from evpp.
You will get a ConnectionCallback when TCPClient established a connection with the remote server, in which you can hold the TCPConn, and you can use TCPConn to send message.
from evpp.
#include <evpp/tcp_client.h>
#include <evpp/buffer.h>
#include <evpp/tcp_conn.h>
#include
int main() {
std::string addr = "127.0.0.1:9099";
evpp::EventLoop loop;
evpp::TCPClient client(&loop,addr,"demo");
client.SetConnectionCallback([](const evpp::TCPConnPtr& ptr) {
std::cout << "connect to server." << std::endl;
ptr->Send("hello,server.");
});
client.SetMessageCallback([](const evpp::TCPConnPtr& ptr,evpp::Buffer* buf) {
std::cout << buf->ToString() << std::endl;});
client.Connect();
}
from evpp.
All the operations are nonblocking, so you need to call loop.Run()
.
Please see : https://github.com/Qihoo360/evpp/blob/master/examples/tcp/tcp_client.cc
from evpp.
Thanks, I appreciate for ur patience
from evpp.
You are welcome.
from evpp.
请清理你的ENV,并使用
sudo yum install libevent-devel
重新安装libevent
clean up your ENV
how clean up my ENV
from evpp.
Related Issues (20)
- whether evpp::TCPConnPtr is thread safe or not?
- MFC程序下 eventloop直接报错
- 有实现SSL TCP通信的吗
- EventLoop.Run函数底层会创建很多线程嘛 HOT 1
- Evpp failed to build with error LNK1181 on MSVC
- is this project still active? HOT 1
- example_evpphttp_server, server not init HOT 1
- The echo UDP server example does not compile against package installed by vcpkg. HOT 3
- evpp支持同时监听ipv6和ipv4吗?支持的话如何开启?
- Potential memory leak in benchmark/throughput/libevent/client.c
- Potential memory leak in benchmark/throughput/libevent/server.c
- Potential memory leak in benchmark/http/libevent/libevent_http_bench.c
- Potential memory leak in benchmark/throughput/libevent/client.c
- Potential memory leak in benchmark/throughput/libevent/server.c
- Potential memory leak in benchmark/http/libevent/libevent_http_bench.c
- Potential memory leak in apps/evmc/extract_vbucket_conf.cc HOT 1
- Potential memory leak in test/evhttp_client_test.cc HOT 1
- ASan heap-use-after-free in tcpserver tests
- TCPServer 的 thread_num 有什么作用 ? ,为什么要建立多个 EventLoopThreadPool ? 1 和 4 有什么区别吗? HOT 2
- Potential Null pointer dereference in request.cc
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 evpp.