From 64c820a29518db4158976feda349b1e551dec5c9 Mon Sep 17 00:00:00 2001
From: Gerald Klinkl <gerald.klinkl@ctbto.org>
Date: Mon, 7 Nov 2016 11:58:25 +0000
Subject: [PATCH] Fix "relocation truncated to fit:" errors

Fix "relocation truncated to fit:" errors when compiling flexpart with
gfortran and medium memory model
---
 flexpart_code/fpmetbinary_mod.F90       | 8 ++++----
 flexpart_code/makefile.general.gfortran | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/flexpart_code/fpmetbinary_mod.F90 b/flexpart_code/fpmetbinary_mod.F90
index c2e69062..ce08967d 100644
--- a/flexpart_code/fpmetbinary_mod.F90
+++ b/flexpart_code/fpmetbinary_mod.F90
@@ -437,11 +437,11 @@ CONTAINS
 &                                        TRIM(PREPROC_FORMAT_VERSION_STR)) THEN
                 CONTINUE
             ELSE
-                PRINT *, ''
+                ! PRINT *, ''  GK: causes relocation truncated to fit: R_X86_64_32
                 PRINT *, 'Inconsistent preprocessing format version'
                 PRINT *, 'Expected Version: ', PREPROC_FORMAT_VERSION_STR
                 PRINT *, 'Detected Version: ', temp_preproc_format_version_str
-                PRINT *, ''
+                ! PRINT *, ''
                 STOP
             END IF
 
@@ -460,14 +460,14 @@ CONTAINS
                 CONTINUE
             ELSE
                 PRINT *, 'Incompatible dimensions between fp file and current FLEXPART!'
-                PRINT *, ''
+                ! PRINT *, ''
                 PRINT *, '                  FP file     Compiled FP'
                 PRINT *, 'nxmax:     ', temp_nxmax, '    ', nxmax 
                 PRINT *, 'nymax:     ', temp_nymax, '    ', nymax 
                 PRINT *, 'nzmax:     ', temp_nzmax, '    ', nzmax 
                 PRINT *, 'nuvzmax:     ', temp_nuvzmax, '    ', nuvzmax 
                 PRINT *, 'nwzmax:     ', temp_nwzmax, '    ', nwzmax 
-                PRINT *, ''
+                ! PRINT *, ''
                 STOP
             END IF
 
diff --git a/flexpart_code/makefile.general.gfortran b/flexpart_code/makefile.general.gfortran
index 7b97b90d..e5cb028e 100644
--- a/flexpart_code/makefile.general.gfortran
+++ b/flexpart_code/makefile.general.gfortran
@@ -22,7 +22,7 @@ LIBPATH2 = /usr/lib/x86_64-linux-gnu
 #LIBPATH1 = /opt/grib-api/lib
 #LIBPATH2 = /usr/lib/x86_64-linux-gnu
 
-FFLAGS   =   -O2 -m64 -mcmodel=large -fconvert=little-endian -frecord-marker=4 -I$(INCPATH) 
+FFLAGS   =   -O2 -m64 -mcmodel=medium -fconvert=little-endian -frecord-marker=4 -I$(INCPATH) 
 
 LDFLAGS  = $(FFLAGS) -L$(LIBPATH2) -L$(LIBPATH1) -lgrib_api_f90 -lgrib_api -lm -ljasper
 
-- 
GitLab