Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error building CurlClient #80

Closed
shivamsingh262 opened this issue Jan 28, 2016 · 3 comments
Closed

Error building CurlClient #80

shivamsingh262 opened this issue Jan 28, 2016 · 3 comments

Comments

@shivamsingh262
Copy link

I am trying to create a HTTPClient, but get a error building CurlClient provided in samples.

shivam@shivam-PC:~/proxygen/proxygen/httpclient/samples/curl$ g++ -std=c++11 -o my_echo CurlClient.cpp CurlClientMain.cpp -lproxygenhttpserver -lfolly -lglog -lgflags -pthread
/tmp/cc4U1LxS.o: In function CurlService::CurlClient::connectSuccess(proxygen::HTTPUpstreamSession*)': CurlClient.cpp:(.text+0x6cc): undefined reference toproxygen::HTTPUpstreamSession::newTransaction(proxygen::HTTPTransactionHandler_)'
/tmp/cc7ZOsgn.o: In function main': CurlClientMain.cpp:(.text+0x41e): undefined reference toproxygen::HTTPConnector::HTTPConnector(proxygen::HTTPConnector::Callback_, folly::HHWheelTimer_)'
CurlClientMain.cpp:(.text+0x5b4): undefined reference to proxygen::HTTPConnector::connectSSL(folly::EventBase_, folly::SocketAddress const&, std::shared_ptrfolly::SSLContext const&, ssl_session_st_, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::less<folly::AsyncSocket::OptionKey>, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&, std::string const&)' CurlClientMain.cpp:(.text+0x60e): undefined reference to proxygen::HTTPConnector::connect(folly::EventBase_, folly::SocketAddress const&, std::chrono::duration<long, std::ratio<1l, 1000l> >, std::map<folly::AsyncSocket::OptionKey, int, std::lessfolly::AsyncSocket::OptionKey, std::allocator<std::pair<folly::AsyncSocket::OptionKey const, int> > > const&, folly::SocketAddress const&)'
CurlClientMain.cpp:(.text+0x631): undefined reference to proxygen::HTTPConnector::~HTTPConnector()' CurlClientMain.cpp:(.text+0x842): undefined reference toproxygen::HTTPConnector::~HTTPConnector()'
collect2: error: ld returned 1 exit status

@w-o-o
Copy link
Contributor

w-o-o commented Jan 28, 2016

this is a link error. did you try the make file under proxygen/proxygen/httpclient/samples/curl

@shivamsingh262
Copy link
Author

I tried make file

shivam@shivam-PC:~/Documents/proxygen/proxygen/httpclient/samples/curl$ make
Making all in .
make[1]: Entering directory /home/shivam/Documents/proxygen/proxygen/httpclient/samples/curl' make[1]: Nothing to be done forall-am'.
make[1]: Leaving directory `/home/shivam/Documents/proxygen/proxygen/httpclient/samples/curl'

I even did 'make clean' followed by 'make'

shivam@shivam-PC:~/Documents/proxygen/proxygen/httpclient/samples/curl$ make
Making all in .
make[1]: Entering directory /home/shivam/Documents/proxygen/proxygen/httpclient/samples/curl' depbase=echo CurlClient.o | sed 's|[^/]$|.deps/&|;s|.o$||';\ g++ -DHAVE_CONFIG_H -I../../../.. -I../../../lib/test/gmock-1.7.0/include -I../../../lib/test/gmock-1.7.0/gtest/include -I/usr/include -DLIBMC_FBTRACE_DISABLE -Wno-missing-field-initializers -Wno-deprecated -O3 -g -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -std=gnu++0x -g -O2 -MT CurlClient.o -MD -MP -MF $depbase.Tpo -c -o CurlClient.o CurlClient.cpp &&\ mv -f $depbase.Tpo $depbase.Po depbase=echo CurlClientMain.o | sed 's|[^/]$|.deps/&amp;|;s|.o$||';\ g++ -DHAVE_CONFIG_H -I../../../.. -I../../../lib/test/gmock-1.7.0/include -I../../../lib/test/gmock-1.7.0/gtest/include -I/usr/include -DLIBMC_FBTRACE_DISABLE -Wno-missing-field-initializers -Wno-deprecated -O3 -g -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -std=gnu++0x -g -O2 -MT CurlClientMain.o -MD -MP -MF $depbase.Tpo -c -o CurlClientMain.o CurlClientMain.cpp &&\ mv -f $depbase.Tpo $depbase.Po /bin/bash ../../../libtool --tag=CXX --mode=link g++ -DLIBMC_FBTRACE_DISABLE -Wno-missing-field-initializers -Wno-deprecated -O3 -g -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -std=gnu++0x -g -O2 -o curl CurlClient.o CurlClientMain.o ../../../lib/libproxygenlib.la -lwangle -lfolly -lz -lssl -lcrypto -lcap -levent -lgflags -lglog -L/usr/lib64 -lpthread -pthread -lfolly -lglog -ldouble-conversion -lboost_system -lboost_thread libtool: link: g++ -DLIBMC_FBTRACE_DISABLE -Wno-missing-field-initializers -Wno-deprecated -O3 -g -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -std=gnu++0x -g -O2 -o curl CurlClient.o CurlClientMain.o -pthread ../../../lib/.libs/libproxygenlib.a -L/usr/lib64 /usr/local/lib/libfolly.so -lboost_context -lboost_program_options -lboost_filesystem -lboost_regex -lboost_chrono -llzma -lsnappy -llz4 -liberty -ljemalloc -lwangle -lz -lssl -lcrypto -lcap -levent -lgflags -lpthread -lfolly -lglog -ldouble-conversion -lboost_system -lboost_thread -pthread make[1]: Leaving directory/home/shivam/Documents/proxygen/proxygen/httpclient/samples/curl'

But I still have the same issue.

@shivamsingh262
Copy link
Author

I was able to resolve this by copying 'HTTPConnector.o' from /lib/http/ directory and 'HTTPUpstreamSession.o' from /lib/http/session/ directory into the /httpclient/samples/curl directory.

Now when I run,

shivam@shivam-PC:~/proxygen/proxygen/httpclient/samples/curl$ g++ -std=c++11 -o my_echo CurlClient.cpp CurlClientMain.cpp HTTPUpstreamSession.o HTTPConnector.o -lproxygenhttpserver -lfolly -lglog -lgflags -pthread

This fixes the linker error, and the client works. There should be a better way though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants