e5k / TephraProb

Set of Matlab functions for probabilistic hazard assessments of tephra accumulation
https://e5k.github.io/
GNU General Public License v3.0
7 stars 4 forks source link

Compiling Tephra2 in TephraProb Error (Linux Ubuntu 20.04) #2

Closed nico-czr closed 3 years ago

nico-czr commented 3 years ago

Hello Sébastien @e5k,

I have a problem running TephraProb (Linux Ubuntu 20.04), everything runs smoothly until I have to run Tephra2. I get a long error message at the moment of pressing the "run Tephra2" button and selecting the .mat file. Apparently it is an error regarding the compiling of Tephra2 in MATLAB.

A similar error has been talked on the Tephra2 repository https://github.com/geoscience-community-codes/tephra2/issues/1

I have installed the libgc-dev and libgc1c2 as Laura Connor said, but I'm still getting this error. I attached the error as a text file

Hopefully you can guide me on what could be the problem, sincerelly,

Nicolás

Compiling Tephra2... rm -fv *.o removed 'new_tephra.o' removed 'tephra2_calc.o'

cmd_out =

'which gcc -Wall -g -idirafter ../include -c new_tephra.c new_tephra.c: In function ‘main’: new_tephra.c:98:10: warning: unused variable ‘val’ [-Wunused-variable] 98 | double val, bin_width; | ^~~ new_tephra.c:97:19: warning: unused variable ‘bin’ [-Wunused-variable] 97 | int i, / j, / bin; | ^~~ new_tephra.c: In function ‘get_points’: new_tephra.c:432:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 432 | for (j=0; j<PART_STEPS; j++) | ^~~ new_tephra.c:434:8: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 434 | pts_read++; | ^~~~ which gcc -Wall -g -idirafter ../include -c ../common_src/tephra2_calc.c which gcc -Wall -g -idirafter ../include -o tephra2-2012 new_tephra.o tephra2_calc.o -lm ../lib64/libgc.a -ldl /usr/bin/ld: ../lib64/libgc.a(malloc.o): relocation R_X86_64_32S against symbol GC_obj_kinds' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(mallocx.o): relocation R_X86_64_32S against symbolGC_obj_kinds' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(alloc.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(reclaim.o): relocation R_X86_64_32S against symbolGC_leaked' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(allchblk.o): relocation R_X86_64_32S against symbol GC_hblkfreelist' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(misc.o): relocation R_X86_64_32S against symbolGC_arrays' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(os_dep.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(mark_rts.o): relocation R_X86_64_32S against symbolGC_arrays' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(headers.o): relocation R_X86_64_32S against symbol GC_arrays' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(mark.o): relocation R_X86_64_32 against.text' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(obj_map.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(blacklst.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(finalize.o): relocation R_X86_64_32S against .bss' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(new_hblk.o): relocation R_X86_64_32S against symbolGC_obj_kinds' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(dyn_load.o): relocation R_X86_64_32 against symbol dl_iterate_phdr@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: ../lib64/libgc.a(mach_dep.o): relocation R_X86_64_32 against symbolGC_push_current_stack' can not be used when making a PIE object; recompile with -fPIE collect2: error: ld returned 1 exit status make: *** [makefile:29: tephra2-2012] Error 1 '

runtephra2 error.txt

alexandermanevich commented 3 years ago

Try to add '-no-pie' in ../MODEL/forward_src/makefile I added '-no-pie' at line 29:

$(CC) -Wall -g -no-pie -idirafter ../include -o tephra2-2012 new_tephra.o tephra2_calc.o -lm $(LIB)/libgc.a -ldl

nico-czr commented 3 years ago

Try to add '-no-pie' in ../MODEL/forward_src/makefile I added '-no-pie' at line 29:

$(CC) -Wall -g -no-pie -idirafter ../include -o tephra2-2012 new_tephra.o tephra2_calc.o -lm $(LIB)/libgc.a -ldl

This solution worked at first try, thank you a lot!

e5k commented 3 years ago

Brilliant, thanks @alexandermanevich. @nico8888 shout if needed