I can’t see a way to attach code, so I will paste a .cpp and a makefile at the bottom. They are based heavily on the provided examples so should be simple enough to run. The issue appears to be related to hooks which are called when an SSL context is destroyed. The versions I have are curl 8.8.0-1 and ssl 3.2.2-1.
example.cpp
#include
#include <curl/curl.h>
#include “Aspose.Cells.h”
using namespace Aspose::Cells;
int main()
{
CURL* curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
///// The below line causes a segfault! /////
///// But only if we have linked with Aspose.Cells /////
curl_easy_cleanup(curl);
}
std::cout << "Done Curling!" << std::endl;
Aspose::Cells::Startup();
License lic;
lic.SetLicense(u"Aspose.Cells.lic");
Workbook workbook(FileFormatType::Xlsx);
Worksheet sheet = workbook.GetWorksheets().Get(0);
Cells cells = sheet.GetCells();
cells.Get(u"A1").PutValue(u"Hello World");
cells.Get(0, 1).PutValue(u"Income");
cells.Get(1, 0).PutValue(u"Company A");
cells.Get(2, 0).PutValue(u"Company B");
cells.Get(3, 0).PutValue(u"Company C");
cells.SetColumnWidth(0, 20);
cells.Get(1, 1).PutValue(10000);
cells.Get(2, 1).PutValue(20000);
cells.Get(3, 1).PutValue(30000);
int chartIndex = sheet.GetCharts().Add(ChartType::Column, 9, 9, 21, 15);
Chart chart = sheet.GetCharts().Get(chartIndex);
chart.GetNSeries().Add(u"B2:B4", true);
chart.GetNSeries().SetCategoryData(u"A2:A4");
Series aSeries = chart.GetNSeries().Get(0);
aSeries.SetName(u"=B1");
chart.SetShowLegend(true);
chart.GetTitle().SetText(u"Income Analysis");
ImageOrPrintOptions options;
options.SetHorizontalResolution(300);
options.SetVerticalResolution(300);
chart.ToImage(u"output.png", options);
workbook.Save(u"output.xlsx");
workbook.Save(u"output.pdf");
std::cout << "Hello World" << std::endl;
Aspose::Cells::Cleanup();
}
CMakeLists.txt
cmake_minimum_required (VERSION 3.8)
cmake_policy(SET CMP0074 NEW)
cmake_policy(SET CMP0110 NEW)
include(GenerateExportHeader)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_EXPORT_COMPILE_COMMANDS 1)
set (CMAKE_CXX_STANDARD 23)
project(“example”)
if( NOT DEFINED BUILD_DEPS )
set(BUILD_DEPS “/path/to/folder/with/libcurl”)
endif()
set(CMAKE_APPBUNDLE_PATH “${BUILD_DEPS}/lib/cmake” “${BUILD_DEPS}/share/cmake” “${BUILD_DEPS}/cmake”)
link_directories(“${BUILD_DEPS}/lib”)
include_directories(“${BUILD_DEPS}/include”)
include(FindCURL)
find_package(CURL 8.5.0 REQUIRED)
find_package(Aspose.Cells REQUIRED CONFIG PATHS ${CMAKE_CURRENT_SOURCE_DIR}/… NO_DEFAULT_PATH)
set(SRC_ROOT “${CMAKE_CURRENT_SOURCE_DIR}”)
include_directories(“${SRC_ROOT}/src”)
file(GLOB_RECURSE SOURCE “${SRC_ROOT}/src/*.cpp”)
add_executable(${PROJECT_NAME} ${SOURCE})
target_link_libraries(${PROJECT_NAME} Aspose.Cells CURL::libcurl)