Closed ghost closed 3 years ago
Hi, I couldn't reproduce this on my end. IIRC, that error code represents SSL error. Have you linked openssl development package? What OS+distro/version are you on? Did you run the tests? Could you share the output?
@bhumitattarde sorry for replying so late .
The OS I am using $ uname -a Linux an 5.10.0-kali3-amd64 #1 SMP Debian 5.10.13-1kali1 (2021-02-08) x86_64 GNU/Linux
the makefile that I am using to generate the example1 which is an executable
default_target: all
.PHONY : default_target
.NOTPARALLEL:
.SUFFIXES:
% : %,v
% : RCS/%
% : RCS/%,v
% : SCCS/s.%
% : s.%
.SUFFIXES: .hpux_make_needs_suffix_list
$(VERBOSE)MAKESILENT = -s
$(VERBOSE).SILENT:
cmake_force:
.PHONY : cmake_force
SHELL = /bin/sh
CMAKE_COMMAND = /usr/bin/cmake
RM = /usr/bin/cmake -E rm -f
EQUALS = =
CMAKE_SOURCE_DIR = /home/devpar/Documents/cppkiteconnect/rema2
CMAKE_BINARY_DIR = /home/devpar/Documents/cppkiteconnect/rema2
rebuild_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..." /usr/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) .PHONY : rebuild_cache
rebuild_cache/fast: rebuild_cache
.PHONY : rebuild_cache/fast
edit_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." /usr/bin/cmake -E echo No\ interactive\ CMake\ dialog\ available. .PHONY : edit_cache
edit_cache/fast: edit_cache
.PHONY : edit_cache/fast
all: cmake_check_build_system $(CMAKE_COMMAND) -E cmake_progress_start /home/devpar/Documents/cppkiteconnect/rema2/CMakeFiles /home/devpar/Documents/cppkiteconnect/rema2//CMakeFiles/progress.marks $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 all $(CMAKE_COMMAND) -E cmake_progress_start /home/devpar/Documents/cppkiteconnect/rema2/CMakeFiles 0 .PHONY : all
clean: $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 clean .PHONY : clean
clean/fast: clean
.PHONY : clean/fast
preinstall: all $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall .PHONY : preinstall
preinstall/fast: $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 preinstall .PHONY : preinstall/fast
depend: $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 .PHONY : depend
example1: cmake_check_build_system $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 example1 .PHONY : example1
example1/fast: $(MAKE) $(MAKESILENT) -f CMakeFiles/example1.dir/build.make CMakeFiles/example1.dir/build .PHONY : example1/fast
example1.o: $(MAKE) $(MAKESILENT) -f CMakeFiles/example1.dir/build.make CMakeFiles/example1.dir/example1.o .PHONY : example1.o
example1.i: $(MAKE) $(MAKESILENT) -f CMakeFiles/example1.dir/build.make CMakeFiles/example1.dir/example1.i .PHONY : example1.i
example1.s: $(MAKE) $(MAKESILENT) -f CMakeFiles/example1.dir/build.make CMakeFiles/example1.dir/example1.s .PHONY : example1.s
help: @echo "The following are some of the valid targets for this Makefile:" @echo "... all (the default if no target is provided)" @echo "... clean" @echo "... depend" @echo "... edit_cache" @echo "... rebuild_cache" @echo "... example1" @echo "... example1.o" @echo "... example1.i" @echo "... example1.s" .PHONY : help
cmake_check_build_system: $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 .PHONY : cmake_check_build_system
My working directory
CMakeCache.txt CMakeFiles cmake_install.cmake CMakeLists.txt cpp-httplib example1 example1.cpp fmt kitepp kitepp.hpp Makefile PicoSHA2 rapidjson
I have not run the tests.
Output when I run
└─$ ./example1
Running..
Login URL: https://kite.zerodha.com/connect/login?v=3&api_key=please_enter_ur_key
Login with this URL and obtain the request token.
Enter obtained request token: the request token
Failed to send http/https request (enum code: 10)
Try running tests.
I see you are on Kali. Kali usually has very different firewall settings than most other distros designed for daily use. I'd suggest you to double check your firewall and update the packages to the latest.
If you have Ubuntu (Debian based like Kali)/Fedora, could you try on there and report back? This will help us ascertain if the problem is with cppkiteconnect or with your OS settings.
Additionally, make sure your date and time settings are right. Wrong OS datetimes are known to cause SSL verification errors.
thanks @bhumitattarde for you support I will try to solve the problem in Kali If still I fail then I will use cppkiteconnect on Ubuntu.
Closing this, open again if you face the same issue on Ubuntu.Fedora.
Facing the same issue in ubuntu. Were you able to solve this?
@khushsharma2910 are you on kali too?
I am using MacOS.
Did you run the tests?
kushsharma@Kushs-MacBook-Air build % ./kiteTest Running main() from /Users/kushsharma/Desktop/Work/cppkiteconnect/deps/deps/googletest-release-1.10.0/googletest/src/gtest_main.cc [==========] Running 40 tests from 1 test suite. [----------] Global test environment set-up. [----------] 40 tests from kiteTest [ RUN ] kiteTest.constructorTest [ OK ] kiteTest.constructorTest (1 ms) [ RUN ] kiteTest.loginURLTest [ OK ] kiteTest.loginURLTest (0 ms) [ RUN ] kiteTest.generateSessionTest [ OK ] kiteTest.generateSessionTest (2 ms) [ RUN ] kiteTest.invalidateSessionTest [ OK ] kiteTest.invalidateSessionTest (0 ms) [ RUN ] kiteTest.profile [ OK ] kiteTest.profile (2 ms) [ RUN ] kiteTest.getMarginsTest1 [ OK ] kiteTest.getMarginsTest1 (2 ms) [ RUN ] kiteTest.getMarginsTest2 [ OK ] kiteTest.getMarginsTest2 (2 ms) [ RUN ] kiteTest.placeOrderTest [ OK ] kiteTest.placeOrderTest (2 ms) [ RUN ] kiteTest.modifyOrderTest [ OK ] kiteTest.modifyOrderTest (0 ms) [ RUN ] kiteTest.cancelOrderTest [ OK ] kiteTest.cancelOrderTest (0 ms) [ RUN ] kiteTest.exitOrderTest [ OK ] kiteTest.exitOrderTest (1 ms) [ RUN ] kiteTest.ordersTest [ OK ] kiteTest.ordersTest (3 ms) [ RUN ] kiteTest.orderHistoryTest [ OK ] kiteTest.orderHistoryTest (2 ms) [ RUN ] kiteTest.tradesTest [ OK ] kiteTest.tradesTest (2 ms) [ RUN ] kiteTest.orderTradesTest [ OK ] kiteTest.orderTradesTest (1 ms) [ RUN ] kiteTest.placeGTTTest [ OK ] kiteTest.placeGTTTest (1 ms) [ RUN ] kiteTest.getGTTsTest [ OK ] kiteTest.getGTTsTest (2 ms) [ RUN ] kiteTest.getGTTTest [ OK ] kiteTest.getGTTTest (3 ms) [ RUN ] kiteTest.modifyGTTTest [ OK ] kiteTest.modifyGTTTest (4 ms) [ RUN ] kiteTest.deleteGTTTest [ OK ] kiteTest.deleteGTTTest (1 ms) [ RUN ] kiteTest.holdingsTest [ OK ] kiteTest.holdingsTest (3 ms) [ RUN ] kiteTest.getPositionsTest [ OK ] kiteTest.getPositionsTest (3 ms) [ RUN ] kiteTest.convertPositionTest [ OK ] kiteTest.convertPositionTest (2 ms) [ RUN ] kiteTest.getQuoteTest [ OK ] kiteTest.getQuoteTest (3 ms) [ RUN ] kiteTest.getOHLCTest [ OK ] kiteTest.getOHLCTest (1 ms) [ RUN ] kiteTest.getLTPTest [ OK ] kiteTest.getLTPTest (2 ms) [ RUN ] kiteTest.getHistoricalDataTest [ OK ] kiteTest.getHistoricalDataTest (2 ms) [ RUN ] kiteTest.placeMFOrderTest [ OK ] kiteTest.placeMFOrderTest (2 ms) [ RUN ] kiteTest.cancelMFOrderTest [ OK ] kiteTest.cancelMFOrderTest (2 ms) [ RUN ] kiteTest.getMFOrdersTest [ OK ] kiteTest.getMFOrdersTest (2 ms) [ RUN ] kiteTest.getMFOrderTest [ OK ] kiteTest.getMFOrderTest (2 ms) [ RUN ] kiteTest.getMFHoldingsTest [ OK ] kiteTest.getMFHoldingsTest (2 ms) [ RUN ] kiteTest.placeMFSIPTest [ OK ] kiteTest.placeMFSIPTest (0 ms) [ RUN ] kiteTest.modifyMFSIPTest [ OK ] kiteTest.modifyMFSIPTest (0 ms) [ RUN ] kiteTest.cancelMFSIPTest [ OK ] kiteTest.cancelMFSIPTest (1 ms) [ RUN ] kiteTest.getSIPsTest [ OK ] kiteTest.getSIPsTest (1 ms) [ RUN ] kiteTest.getSIPTest [ OK ] kiteTest.getSIPTest (2 ms) [ RUN ] kiteTest.getOrderMarginsTest [ OK ] kiteTest.getOrderMarginsTest (2 ms) [ RUN ] kiteTest.getInstrumentsTest [ OK ] kiteTest.getInstrumentsTest (3 ms) [ RUN ] kiteTest.getMFInstrumentsTest [ OK ] kiteTest.getMFInstrumentsTest (3 ms) [----------] 40 tests from kiteTest (71 ms total)
[----------] Global test environment tear-down [==========] 40 tests from 1 test suite ran. (71 ms total) [ PASSED ] 40 tests. kushsharma@Kushs-MacBook-Air build % ls CMakeCache.txt Makefile cmake_install.cmake kiteTest CMakeFiles RJTest kWSTest kushsharma@Kushs-MacBook-Air build % ./RJTest Running main() from /Users/kushsharma/Desktop/Work/cppkiteconnect/deps/deps/googletest-release-1.10.0/googletest/src/gtest_main.cc [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from RJTest [ RUN ] RJTest.parseTest [ OK ] RJTest.parseTest (0 ms) [----------] 1 test from RJTest (0 ms total)
[----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (0 ms total) [ PASSED ] 1 test. kushsharma@Kushs-MacBook-Air build % ./kWSTest Running main() from /Users/kushsharma/Desktop/Work/cppkiteconnect/deps/deps/googletest-release-1.10.0/googletest/src/gtest_main.cc [==========] Running 1 test from 1 test suite. [----------] Global test environment set-up. [----------] 1 test from kWSTest [ RUN ] kWSTest.binaryParsingTest [ OK ] kWSTest.binaryParsingTest (3 ms) [----------] 1 test from kWSTest (3 ms total)
[----------] Global test environment tear-down [==========] 1 test from 1 test suite ran. (3 ms total) [ PASSED ] 1 test.
@kushsharma2910 Next time use make && make test ARGS='-v'
.
Facing the same issue in ubuntu. Were you able to solve this? I am using MacOS.
I'm guessing you wrote Ubuntu accidentally?
I cannot reproduce this on my Ubuntu VM/Fedora machine. I also don't have access to a MacOS box to test this out. Have you checked your firewall settings? OS datetime? Can you try sending a HTTPS request using cpp-httplib? Use one of the examples in linked repository.
Tried it on ubuntu also, on first installation, it showed the same error but on reinstalling everything resolved it on ubuntu but I cannot resolve the same for macOS.
While development, have you tried to run it on macOS ? Maybe there is some installation problem. I have made sure it is not an issue of firewall.
It actually hasn't been tested on MacOS yet but it shouldn't be a problem, not one related to SSL definitely. I would have debugged this myself but I like I said, I don't have a mac box available. Also, What is your OpenSSL version?
@knadh @rhnvrm Would it be possible for you guys to test/debug this on MacOS?
@ajinasokan could you help with this?
Apart from this, maybe we can consider adding github actions to this repo (ref: https://github.com/zerodha/cppkiteconnect/pull/12#issuecomment-789710926 with gitlab build pipeline). I recently added support for github actions on gokiteconnect, you can refer the matrix implementation here: https://github.com/zerodha/gokiteconnect/blob/master/.github/workflows/go-test.yml#L17
@bhumitattarde I was trying to build in macOS. The included httplib doesn't seem to compile. It looks like a C++ version(c++11) issue and the code in yhirose/cpp-httplib also seem to different from the one included. And I'm able to compile that. I believe the one you embedded is not compatible with 11.
To setup I had to install uWS:
cd deps
cmake .
cd deps
tar -xvf uWebSocketsv-0.14.8.tar.gz
cd uWebSockets-0.14.8
make
make installDarwin
Install openssl, googletest and doxygen:
brew install openssl
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
brew install googletest
brew install doxygen
And then I encountered the C++11 errors.
@rhnvrm I'll look into it.
@ajinasokan Thank you for testing this. I'll update cpp-httplib. To confirm, you tested using cpp-httplib master, that is commit 676f1b5, correct?
Yes it was master latest commit
@kushsharma2910 Does #22 solve the issue for you?
@kushsharma2910 Does #22 solve the issue for you?
Hi @bhumitattarde , sorry for replying so late. This issue had something to do with the openssl version that was getting linked. I reinstalled openssl and:
For compilers to find openssl@3 I had to set: export LDFLAGS="-L/usr/local/opt/openssl@3/lib" export CPPFLAGS="-I/usr/local/opt/openssl@3/include"
On following the above steps, the issue got resolved. Thanks a lot for your support!
$ ./example1 Running.. Login URL: https://kite.zerodha.com/connect/login?v=3&api_key=uuuuuuuuuu Login with this URL and obtain the request token. Enter obtained request token: BHUBjVL4o5w5F4kZXfUU5D6q327JqmnG Failed to send http/https request (enum code: 10)
when trying to run example1 after successfully building it with the make it generates Failed to sent http/https request during runtime. I couldn't figure it out why is it happening and how to fix it.
I would be thankful if this problem is fixed.
Thanks in advance : )
example1.cpp
/*
include
include
include "kitepp.hpp"
namespace kc = kiteconnect;
int main() {
} catch (kc::kiteppException& e) {
} catch (kc::libException& e) {
} catch (std::exception& e) {
}; // clang-format on
};