Add static linking to witness generator.

This commit is contained in:
Alejandro Cabeza Romero 2025-08-26 18:45:42 +02:00
parent 8e3ed28ecf
commit cd86f86a39
No known key found for this signature in database
GPG Key ID: DA3D14AE478030FD
4 changed files with 29 additions and 5 deletions

View File

@ -0,0 +1,18 @@
CC=g++
CFLAGS=-std=c++11 -O3 -I.
LDFLAGS = -lgmp -static
DEPS_HPP = circom.hpp calcwit.hpp fr.hpp pol.cpp
DEPS_O = main.o calcwit.o fr.o pol.o
all: pol
%.o: %.cpp $(DEPS_HPP)
$(CC) -Wno-address-of-packed-member -c $< $(CFLAGS) -o $@
pol: $(DEPS_O)
$(CC) -o pol $(DEPS_O) $(LDFLAGS)
clean:
rm -f *.o pol

View File

@ -1,6 +1,7 @@
CC = g++
CFLAGS = -std=c++11 -O3 -I. -I/opt/homebrew/include -include gmp_patch.hpp
LDFLAGS = -L/opt/homebrew/lib -lgmp
CFLAGS = -std=c++11 -O3 -I. -I/opt/homebrew/include -include gmp_patch.hpp -Wno-address-of-packed-member
LDFLAGS = -Wl,-search_paths_first -Wl,-dead_strip -L/opt/homebrew/lib
LDLIBS = /opt/homebrew/lib/libgmp.a
DEPS_HPP = circom.hpp calcwit.hpp fr.hpp pol.cpp
DEPS_O = main.o calcwit.o fr.o pol.o
@ -8,10 +9,11 @@ DEPS_O = main.o calcwit.o fr.o pol.o
all: pol
%.o: %.cpp $(DEPS_HPP)
$(CC) -Wno-address-of-packed-member -c $< $(CFLAGS) -o $@
$(CC) $(CFLAGS) -c $< -o $@
pol: $(DEPS_O)
$(CC) -o pol $(DEPS_O) $(LDFLAGS)
$(CC) -o $@ $(DEPS_O) $(LDFLAGS) $(LDLIBS)
clean:
rm -f *.o pol

View File

@ -1,6 +1,6 @@
CC = g++
CFLAGS = -std=c++11 -O3 -I. -I/include -Duint="unsigned int"
LDFLAGS = -L/lib -lgmp -lmman
LDFLAGS = -L/lib -lgmp -lmman -static
DEPS_HPP = circom.hpp calcwit.hpp fr.hpp pol.cpp
DEPS_O = main.o calcwit.o fr.o pol.o

View File

@ -94,6 +94,10 @@ jobs:
working-directory: repo/circom_circuits/Mantle
run: circom --c --r1cs --no_asm --O2 pol.circom
- name: Replace Witness Generator Makefile # TODO: Make a fork generate the appropriate Linux Makefile
working-directory: repo
run: cp .github/resources/witness-generator/${{ env.OS }}.Makefile circom_circuits/Mantle/pol_cpp/Makefile
- name: Compile Witness Generator
working-directory: repo/circom_circuits/Mantle/pol_cpp
run: make pol