From 550af686831272187ec38453f88b4cd85d4017b2 Mon Sep 17 00:00:00 2001 From: theorphiceye Date: Tue, 20 Jan 2026 10:18:46 -0600 Subject: [PATCH] Resolve Linux/Mac compilation errors - Fix name collision: renamed curl_write_callback to anu_curl_write_callback to avoid conflict with libcurl typedef - Add missing include in common/sampling.cpp for strcmp - Fix unused parameter warning in llama_sample_dist - Guard ANU_API_HOST_W with #ifdef _WIN32 to fix unused variable warning --- common/sampling.cpp | 1 + src/anu-qrng-client.cpp | 6 ++++-- src/llama-sampling.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/sampling.cpp b/common/sampling.cpp index e4ceb827f..c47e3718b 100644 --- a/common/sampling.cpp +++ b/common/sampling.cpp @@ -5,6 +5,7 @@ #include "../src/llama-sampling.h" #include +#include #include #include diff --git a/src/anu-qrng-client.cpp b/src/anu-qrng-client.cpp index de73d7647..2353295fe 100644 --- a/src/anu-qrng-client.cpp +++ b/src/anu-qrng-client.cpp @@ -29,7 +29,9 @@ // ANU QRNG API endpoint static const char* ANU_API_HOST = "api.quantumnumbers.anu.edu.au"; +#ifdef _WIN32 static const wchar_t* ANU_API_HOST_W = L"api.quantumnumbers.anu.edu.au"; +#endif ANUQRNGClient::ANUQRNGClient(const Config& config) : config(config), stats(), initialized(false) { @@ -374,7 +376,7 @@ int ANUQRNGClient::http_request_hex16(std::vector& uint8_values) { #else // Linux/Mac implementation using libcurl -static size_t curl_write_callback(void* contents, size_t size, size_t nmemb, void* userp) { +static size_t anu_curl_write_callback(void* contents, size_t size, size_t nmemb, void* userp) { size_t total_size = size * nmemb; std::vector* vec = static_cast*>(userp); const uint8_t* data = static_cast(contents); @@ -406,7 +408,7 @@ int ANUQRNGClient::http_request_hex16(std::vector& uint8_values) { curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, curl_write_callback); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, anu_curl_write_callback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &json_response); curl_easy_setopt(curl, CURLOPT_TIMEOUT_MS, config.timeout_ms); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); diff --git a/src/llama-sampling.cpp b/src/llama-sampling.cpp index cdfa1b9d3..6d2a2a62d 100644 --- a/src/llama-sampling.cpp +++ b/src/llama-sampling.cpp @@ -212,7 +212,7 @@ static void llama_token_data_array_partial_sort_inplace(llama_token_data_array * cur_p->sorted = true; } -static int llama_sample_dist(llama_token_data_array * cur_p, std::mt19937 & rng) { +static int llama_sample_dist(llama_token_data_array * cur_p, std::mt19937 & /*rng*/) { double chance; // Get quantum random value (fresh API call each time)