Git Product home page Git Product logo

Comments (46)

zieckey avatar zieckey commented on August 16, 2024

Please paste the exact error discriptions.

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

use -L /the/path/to/library for gcc

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

[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.

zieckey avatar zieckey commented on August 16, 2024

Got it. Do you use libevent1.4?

Please pull the latest codes and try again.

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

2.0

from evpp.

zieckey avatar zieckey commented on August 16, 2024

OK.

  1. Please pull the latest codes and try again.
  2. Tell me the exact version of your libevent. My libevent version is 2.0.21

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

Try this command rpm -qa|grep libevent and paste the output.

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

rpm -qa|grep libevent
i dont install libevent with yum ,just cmake and make && make install

from evpp.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

i reinstall libevet using 3rdparty/libevent-release-2.1.8-stable
cmake . and make

from evpp.

zieckey avatar zieckey commented on August 16, 2024

Does it work now?

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024
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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

std::cout.setf(std::ios_base::hex,std::ios_base::basefield);
std::cout << LIBEVENT_VERSION_NUMBER << std::endl;

2010800

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024
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.

zieckey avatar zieckey commented on August 16, 2024

/usr/local/lib/libevent-2.0.so.5 is compiled from libevent-2.1.8???

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

std::cout.setf(std::ios_base::hex,std::ios_base::basefield);
std::cout << LIBEVENT_VERSION_NUMBER << std::endl;

2010800

from evpp.

zieckey avatar zieckey commented on August 16, 2024

Paste the output of nm /usr/local/lib/libevent-2.0.so.5 | grep evhttp_connection_set_timeout

from evpp.

zieckey avatar zieckey commented on August 16, 2024

Paste the output of strings /usr/local/lib/libevent-2.0.so.5 | grep 2.

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

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.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

strings libevent.a | grep 2.
2.1.8-beta not stable

from evpp.

zieckey avatar zieckey commented on August 16, 2024

But you link against libevent.so not libevent.a

from evpp.

zieckey avatar zieckey commented on August 16, 2024

Please clean up your ENV, and use sudo yum install libevent-devel to reinstall libevent

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

ok

from evpp.

7zkeeper avatar 7zkeeper commented on August 16, 2024

why TCPClient has no send function

from evpp.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

#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.

zieckey avatar zieckey commented on August 16, 2024

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.

7zkeeper avatar 7zkeeper commented on August 16, 2024

Thanks, I appreciate for ur patience

from evpp.

zieckey avatar zieckey commented on August 16, 2024

You are welcome.

from evpp.

gocpplua avatar gocpplua commented on August 16, 2024

请清理你的ENV,并使用sudo yum install libevent-devel重新安装libevent

clean up your ENV

how clean up my ENV

from evpp.

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.