Add comments to resources.

This commit is contained in:
Alejandro Cabeza Romero 2025-07-29 18:02:37 +02:00
parent 32fb3bc0ff
commit 2266632081
No known key found for this signature in database
GPG Key ID: DA3D14AE478030FD
6 changed files with 32 additions and 11 deletions

View File

@ -3,9 +3,13 @@
#Build targets
host:
rm -rf build_prover && mkdir build_prover && cd build_prover && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package && \
cmake .. \
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=../package && \
make -j$(nproc) -vvv && make install
# Copy of the original host target, with specific flags for Windows x86_64 to add patches, missing libraries and
# include paths
host_windows_x86_64:
rm -rf build_prover && mkdir build_prover && cd build_prover && \
cmake .. \

View File

@ -82,6 +82,8 @@ build_host()
mkdir "$BUILD_DIR"
cd "$BUILD_DIR"
# The following line is a workaround for the Windows build due to an existing incompatibility with current compiler
# when building GMP.
CFLAGS="-O2 -std=gnu17" CXXFLAGS="-O2 -std=gnu++17" \
../configure --prefix="$PACKAGE_DIR" --with-pic --disable-fft &&
make -j${NPROC} &&

View File

@ -1,3 +1,5 @@
// Workaround for Windows where some mman functions are not defined
#ifdef _WIN32
#include <cstddef>
inline int madvise(void*, size_t, int) { return 0; }

View File

@ -1,5 +1,7 @@
link_directories(/lib)
set(COMMON_LIBS /lib/libmman.a)
# Workaround for CMake on Windows to
# Added explicit linking (e.g., mman), which are otherwise resolved transitively on Linux and macOS.
find_library(MMAN_LIB mman PATHS /lib NO_DEFAULT_PATH REQUIRED)
link_libraries(${GMP_LIB})
@ -124,13 +126,19 @@ set_target_properties(rapidsnarkStaticFrFq PROPERTIES POSITION_INDEPENDENT_CODE
set_target_properties(rapidsnarkStaticFrFq PROPERTIES OUTPUT_NAME rapidsnark-fr-fq)
add_executable(prover main_prover.cpp)
target_link_libraries(prover rapidsnarkStatic fr fq ${COMMON_LIBS})
target_link_libraries(
prover rapidsnarkStatic
fr fq ${MMAN_LIB} # Explicit linking
)
add_executable(verifier main_verifier.cpp)
target_link_libraries(verifier rapidsnarkStatic fr fq ${COMMON_LIBS})
target_link_libraries(
verifier rapidsnarkStatic
fr fq ${MMAN_LIB} # Explicit linking
)
add_library(rapidsnark SHARED ${LIB_SOURCES})
target_link_libraries(rapidsnark ${COMMON_LIBS})
target_link_libraries(rapidsnark ${MMAN_LIB}) # Explicit linking
if((USE_LOGGER OR NOT USE_OPENMP) AND NOT TARGET_PLATFORM MATCHES "android")
target_link_libraries(prover pthread)
@ -146,7 +154,10 @@ option(BUILD_TESTS "Build the tests" ON)
if(BUILD_TESTS)
enable_testing()
add_executable(test_public_size test_public_size.c)
target_link_libraries(test_public_size rapidsnarkStaticFrFq pthread ${COMMON_LIBS})
target_link_libraries(
test_public_size rapidsnarkStaticFrFq pthread
${MMAN_LIB} # Explicit linking
)
add_test(NAME test_public_size COMMAND test_public_size circuit_final.zkey 86
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/testdata)
endif()

View File

@ -1,3 +1,5 @@
// Workaround for Windows UIO header, as it's not available by default
#ifndef SYS_UIO_H
#define SYS_UIO_H

View File

@ -1,13 +1,13 @@
// Workaround for a known macOS issue where certain GMP functions fail to compile
// due to strict type checking, despite uint64_t and mp_limb_t being the same size.
// These wrappers explicitly cast uint64_t parameters to mp_limb_t to resolve the mismatch.
#ifndef GMP_PATCH_CAST_HPP
#define GMP_PATCH_CAST_HPP
#include <gmp.h>
#include <cstdint>
// Workaround for a known macOS issue where certain GMP functions fail to compile
// due to strict type checking, despite uint64_t and mp_limb_t being the same size.
// These wrappers explicitly cast uint64_t parameters to mp_limb_t to resolve the mismatch.
// Arithmetic Wrappers
inline mp_limb_t gmp_add_n_cast(uint64_t* rp, const uint64_t* up, const uint64_t* vp, mp_size_t n) {
return mpn_add_n(reinterpret_cast<mp_limb_t*>(rp),