data61 / MP-SPDZ

Versatile framework for multi-party computation
Other
951 stars 279 forks source link

`g++: error: +=: linker input file not found: No such file or directory` when trying to install various VMs #729

Closed Mikerah closed 2 years ago

Mikerah commented 2 years ago

I'm trying to reproduce the MP-SPDZ installation process in order to write some instructions down and I'm encountering the following errors when I run make tldr, make mascot, make shamir and make real-bmr-party.x:

make[1]: Entering directory '/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ'
g++ -o Machines/mascot-party.o Machines/mascot-party.cpp -march=native -I./local/include -I./local/include -I./local/include -I./local/include -DINSECUREMY_CFLAGS += -I./local/include -I./local/include -I./local/include -I./local/include -g -Wextra -Wall -O3 -I. -I./deps -pthread    -DUSE_GF2N_LONG '-DPREP_DIR="Player-Data/"' '-DSSL_DIR="Player-Data/"'  -std=c++11 -Werror -std=c++17 -fPIC -MMD -MP -c
g++: warning: +=: linker input file unused because linking not done
g++: error: +=: linker input file not found: No such file or directory
make[1]: *** [Makefile:68: Machines/mascot-party.o] Error 1
make[1]: Leaving directory '/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ'
make: *** [Makefile:108: tldr] Error 2
(okg_env) [mikerah@fedora MP-SPDZ]$ make shamir
g++ -o Machines/shamir-party.o Machines/shamir-party.cpp -march=native -I./local/include -I./local/include -I./local/include -I./local/include -DINSECUREMY_CFLAGS += -I./local/include -I./local/include -I./local/include -I./local/include -g -Wextra -Wall -O3 -I. -I./deps -pthread    -DUSE_GF2N_LONG '-DPREP_DIR="Player-Data/"' '-DSSL_DIR="Player-Data/"'  -std=c++11 -Werror -std=c++17 -fPIC -MMD -MP -c
g++: warning: +=: linker input file unused because linking not done
g++: error: +=: linker input file not found: No such file or directory
make: *** [Makefile:68: Machines/shamir-party.o] Error 1

I was able to successfully install MP-SPDZ in the past so these are new errors for me. I've checked my paths and I don't think that's the problem. Any hints as to what might be causing this?

mkskeller commented 2 years ago

I'm suspicious about -DINSECUREMY_CFLAGS in the command line. Maybe you accidentally deleted a line break in CONFIG.mine?

mkskeller commented 2 years ago

The other possibility is that CONFIG.mine doesn't end in a line break when the compilation script tries add further lines.

Mikerah commented 2 years ago

Here is what my CONFIG looks like:

ROOT = .

OPTIM= -O3
#PROF = -pg
#DEBUG = -DDEBUG
GDEBUG = -g

# set this to your preferred local storage directory
PREP_DIR = '-DPREP_DIR="Player-Data/"'

# directory to store SSL keys
SSL_DIR = '-DSSL_DIR="Player-Data/"'

# set for SHE preprocessing (SPDZ and Overdrive)
USE_NTL = 0

# set for using GF(2^128)
# unset for GF(2^40)
USE_GF2N_LONG = 1

# set to -march=<architecture> for optimization
# SSE4.2 is required homomorphic encryption in GF(2^n) when compiling with clang
# AES-NI and PCLMUL are not required
# AVX is required for oblivious transfer (OT)
# AVX2 support (Haswell or later) is used to optimize OT
# AVX/AVX2 is required for replicated binary secret sharing
# BMI2 is used to optimize multiplication modulo a prime
# ADX is used to optimize big integer additions
# delete the second line to compile for a platform that supports everything
ARCH = -mtune=native -msse4.1 -msse4.2 -maes -mpclmul -mavx -mavx2 -mbmi2 -madx
ARCH = -march=native

MACHINE := $(shell uname -m)
ARM := $(shell uname -m | grep x86; echo $$?)
OS := $(shell uname -s)
ifeq ($(MACHINE), x86_64)
ifeq ($(OS), Linux)
AVX_OT = 1
else
AVX_OT = 0
endif
else
ARCH =
AVX_OT = 0
endif

USE_KOS = 0

# allow to set compiler in CONFIG.mine
CXX = g++

# use CONFIG.mine to overwrite DIR settings
-include CONFIG.mine

ifeq ($(USE_GF2N_LONG),1)
GF2N_LONG = -DUSE_GF2N_LONG
endif

ifeq ($(AVX_OT), 0)
CFLAGS += -DNO_AVX_OT
endif

# MAX_MOD_SZ (for FHE) must be least and GFP_MOD_SZ (for computation)
# must be exactly ceil(len(p)/len(word)) for the relevant prime p
# GFP_MOD_SZ only needs to be set for primes of bit length more that 256.
# Default for MAX_MOD_SZ is 10, which suffices for all Overdrive protocols
# MOD = -DMAX_MOD_SZ=10 -DGFP_MOD_SZ=5

LDLIBS = -lmpirxx -lmpir -lsodium $(MY_LDLIBS)
LDLIBS += -lboost_system -lssl -lcrypto

ifeq ($(USE_NTL),1)
CFLAGS += -DUSE_NTL
LDLIBS := -lntl $(LDLIBS)
endif

ifeq ($(OS), Linux)
LDLIBS += -lrt
endif

ifeq ($(OS), Darwin)
BOOST = -lboost_thread-mt $(MY_BOOST)
else
BOOST = -lboost_thread $(MY_BOOST)
endif

CFLAGS += $(ARCH) $(MY_CFLAGS) $(GDEBUG) -Wextra -Wall $(OPTIM) -I$(ROOT) -I$(ROOT)/deps -pthread $(PROF) $(DEBUG) $(MOD) $(GF2N_LONG) $(PREP_DIR) $(SSL_DIR) $(SECURE) -std=c++11 -Werror
CPPFLAGS = $(CFLAGS)
LD = $(CXX)

ifeq ($(OS), Darwin)
# for boost with OpenSSL 3
CFLAGS += -Wno-error=deprecated-declarations
ifeq ($(USE_NTL),1)
CFLAGS += -Wno-error=unused-parameter -Wno-error=deprecated-copy
endif
endif

ifeq ($(USE_KOS),1)
CFLAGS += -DUSE_KOS
else
CFLAGS += -std=c++17
LDLIBS += -llibOTe -lcryptoTools
endif

and my CONFIG.mine:

MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -DINSECUREMY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/libMY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib

These are just the defaults that I git cloned from this repo

mkskeller commented 2 years ago

The issue is on this line: MY_CFLAGS += -DINSECUREMY_CFLAGS += -I./local/include. There should be a line break after -DINSECURE.

Mikerah commented 2 years ago

Since this is being automatically generated, do you know what line of the make file needs to be changed?

mkskeller commented 2 years ago

None of the material in the repository adds MY_CFLAGS += -DINSECURE, so if you do that, you need to add a line break as well.

Mikerah commented 2 years ago

Now, I'm getting the following error:

/usr/local/bin/ld: cannot find +=: No such file or directory
/usr/local/bin/ld: cannot find +=: No such file or directory
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:128: libSPDZ.so] Error 1
make[1]: Leaving directory '/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ'
make: *** [Makefile:108: tldr] Error 2
mkskeller commented 2 years ago

I cannot comment on this without the configuration.

Mikerah commented 2 years ago

It's the same as above

mkskeller commented 2 years ago

As said before, there needs to be a line break after -DINSECURE.

Mikerah commented 2 years ago

I made that change and still got the most recent error posted

Mikerah commented 2 years ago

This is what it looks like now

MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -DINSECURE
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/libMY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/libMY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
MY_CFLAGS += -I./local/include
MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib
mkskeller commented 2 years ago

There are similar issues with two lines saying MY_LDLIBS += -Wl,-rpath -Wl,/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/lib -L/home/mikerah/Documents/HashCloak/Projects/okg_experiments/oram/MP-SPDZ/local/libMY_CFLAGS += -I./local/include

mkskeller commented 2 years ago

Also note that there is no point in having these repeated lines, and whenever you edit CONFIG.mine make sure it ends in a line break.

Mikerah commented 2 years ago

I should note that this is the auto generated config.mine file and not one I modified myself

Mikerah commented 2 years ago

Just realized that I was looking at the wrong CONFIG and CONFIG.mine files in my IDE. I now get a different error. I will open up another issue if I can't debug this within a reasonable time. Closing this issue...