Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 3 months ago.
mbed-http compile fail
The mbed-http library https://os.mbed.com/teams/sandbox/code/mbed-http/ fails when I try to use HTTPS. Specifically, https_request.h
HttpsRequest(NetworkInterface* net_iface, const char* ssl_ca_pem, http_method method, const char* url, Callback<void(const char *at, uint32_t length)> body_callback = 0)
results in "Undefined symbol mbed_ctr_drbg_free".
Are there configuration items that I am missing? Is there another HTTP library that supports HTTPS that is recommended?
1 Answer
6 years, 3 months ago.
Hi Peter,
You may be missing a few configuration items. Are you using the Mbed CLI or the online compiler? If you are using the Mbed CLI you can follow the steps below to create a new Mbed HTTPS project and build successfully (the following is also adapted from the http-example here):
mbed new https-example
cd https-example
mbed add https://os.mbed.com/teams/sandbox/code/mbed-http/
mbed add https://github.com/ArmMbed/easy-connect/
- Create a
main.cpp
file in your root project directory - Create a
mbed_app.json
file in your root project directory for the Easy Connect library - Copy/paste the contents of the HTTPS example program into your
main.cpp
file: https://gist.github.com/yennster/ae97f2ebc14b836b4f531a2fc0470313 - Copy/paste the contents of the following file into your
mbed_app.json
file: https://gist.github.com/yennster/75933bef3fe94801917e6a3839faf31f - Within
mbed_app.json
under config > network-interface > value, replace "ETHERNET" with your board's network connectivity option - Now compile:
mbed compile -t <your toolchain> -m <your board>
in my case I used the following command:mbed compile -t gcc_arm -m k64f
- You should be able to compile successfully and now you can click and drag the created .bin file to your board
Then you can alter the main.cpp
for your purposes!
Please let me know if you have any questions!
- Jenny, team Mbed
If this solved your question, please make sure to click the "Thanks" link below!
I'm using the online compiler, but I followed the corresponding steps to create a new project. Still produces the same error.
posted by 05 Sep 2018Hi Peter, have you updated to the latest version of Mbed OS?
- Jenny, team Mbed
posted by 05 Sep 2018Which network interface are you using and which target board?
- Jenny, team Mbed
posted by 05 Sep 2018Hi, please try the following steps:
- Import the following example into your online compiler: https://os.mbed.com/teams/sandbox/code/http-example/
- Delete the easy-connect library from the http-example program and re-add it with the following URL:
https://github.com/ARMmbed/easy-connect/
- Right click on the mbed-os library and select "Update..."
- Change the network-interface in
mbed_app.json
to "CELLULAR_ONBOARD" - In the
source
folder openselect-demo.h
and change the#define DEMO
to#define DEMO DEMO_HTTPS
- Make sure you have selected the u-blox C027 target in the top right corner
- Then click "Compile" and you should successfully download the .bin file for the https example
Please let me know if this works for you!
- Jenny, team Mbed
posted by 05 Sep 2018The last set of instructions succeeds. How do I apply this to my code? I'm trying to use mbed-http without using easy-connect as I only want to use a cell modem and don't need all those other interfaces. I basically created my main.cpp by copying main-https.cpp from that same example project, then replaced
NetworkInterface* network = easy_connect(true);
with
network = CellularBase::get_default_instance();
Do I have to use easy-connect to make mbed-http work?
posted by 05 Sep 2018Hi again Peter,
Glad that succeeded for you. What I would recommend next is to investigate how the easy connect library implements the "CELLULAR_ONBOARD" connection present in the Mbed OS library. Specifically you'll want to implement the network connection code present in easy-connect.cpp
.
Please let me know if you have any questions!
- Jenny, team Mbed
posted by 05 Sep 2018I think that's what I did to figure out how to implement the cellular-only version in the first place. I'll examine that further, but two things to consider:
1. My code works perfectly fine if I use HttpRequest() from mbed-http. The compiler failure occurs with HttpsRequest(). 2. The error is a missing symbol which seems to be from tls_socket.h. There doesn't seem to be any relation with creating a cellular network instance.
posted by 05 Sep 2018