czimaginginstitute / AreTomo2

BSD 3-Clause "New" or "Revised" License
41 stars 6 forks source link

Compilation error #20

Open builab opened 3 months ago

builab commented 3 months ago

In Ubuntu 22.04, CUDA 12.3.

...
PatchAlign/GCommonArea.cu has been compiled.
PatchAlign/GGenXcfImage.cu has been compiled.
PatchAlign/GPartialCopy.cu has been compiled.
PatchAlign/GNormByStd2D.cu has been compiled.
/usr/bin/ld: /storage/software/AreTomo2/LibSrc/Lib/libmrcfile.a(CLoadExtHeader.o): relocation R_X86_64_32 against symbol `__gxx_personality_v0@@CXXABI_1.3' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
make: *** [makefile11:183: exe] Error 1

Solutions: I modified the makefile11 to add the -no-pie option. And then it work

exe: $(OBJS)
    @g++ -g -pthread -m64 $(OBJS) \
    $(PRJLIB)/libmrcfile.a \
    $(PRJLIB)/libutil.a \
    -L$(CUDALIB) -L/usr/lib64 \
    -lcufft -lcudart -lcuda -lc -lm -lpthread -no-pie \
    -o AreTomo2
    @echo AreTomo2 has been generated.

%.o: %.cu
    @$(NVCC) -c $(CUFLAG) -I$(PRJINC) -I$(CUDAINC) $< -o $@
    @echo $< has been compiled.

%.o: %.cpp
    @$(CC) $(CFLAG) -I$(PRJINC) -I$(CUDAINC) -no-pie \
        $< -o $@
    @echo $< has been compiled.