Skip to content

Commit

Permalink
Fixed a bug where, when cross-building CURL, it doesn't set the defau…
Browse files Browse the repository at this point in the history
…lt CA bundle path. That ment that any requests going out to https servers with CURL would fail.
  • Loading branch information
tpanajott committed Jul 25, 2024
1 parent fab6a64 commit 33b410f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docker/MQTTManager/include/web_helper/WebHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ bool WebHelper::perform_request(std::string *url, std::string *response_data, st
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 5); // Wait max 5 seconds for an answer
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curl_error_buffer);
// During cross-compilation the default path for CA certificates is not set and therefore any
// request to an https endpoint (for example OpenMetoe weather service) fails.
curl_easy_setopt(curl, CURLOPT_CAINFO, "/etc/ssl/certs/ca-certificates.crt");

// Build header list
struct curl_slist *curl_headers = NULL;
Expand Down
8 changes: 8 additions & 0 deletions docker/docker-cross_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

if [ -z "$1 "]; then
echo "ERROR! You need to set a target architecture to build for."
exit 1
fi

docker buildx build --platform "$TARGETPLATFORM" -t nspanelmanager . && echo "Build successfull." || echo "Build failed!"

0 comments on commit 33b410f

Please sign in to comment.