Orient: Compilation Instructions

Main page:

General

About Numerical Recipes

From Anthony:

Do the following:

and then make won't try to update them.

has failed. Is so, it could be that md.F90 etc are empty. The original files will be present with the *.orig suffix. so make the necessary copies and re-make.

This can be fixed by editing sub.makefile and commenting out the lines

#virial_module.F90 md.F90: %.F90: %.strip
#  cd ${SRC}; ${BASE}/bin/patch_recipes.pl --recipes ${RECIPES} $@

#histograms.f90: %.f90: %.strip
#       cd ${SRC}; ${BASE}/bin/patch_recipes.pl --recipes ${RECIPES} $@

#recipes.f90:
#       cd ${SRC}; ${BASE}/bin/patch_recipes.pl --recipes ${RECIPES} $@

This seems to work. Anthony has already given us the correct versions of these files so no further processing is needed.

Do all 3 points!!!

Compile Withou OpenGL

Ubuntu

Issues with Ubuntu 13.10

Error message:

Inconsistency detected by ld.so: dl-version.c: 224: _dl_check_map_versions: Assertion `needed != ((void *)
0)' failed!

Found this at http://stackoverflow.com/questions/20007961/error-running-a-compiled-c-file-uses-opengl-error-inconsistency-detected

It looks that some thing has changed by some Ubuntu 13.10 sw updates. I had also code that has compiled an d run without problem and just one day I started to get same Assertion `needed != ((void *)0)' failed! err or but only if I compiled my code again with current gcc/lib versios.

After debugging I found out that the assert error comes from /lib/i386-linux-gnu/ld-2.17.so

It is said that this should never happen and it does not say what is needed but not found. Some gdb work a nd i found that it needs libpthread.so.0 . The good question is that why /usr/bin/ld linker linking applic ation and ld.so disagree about need of this library.

I did not intentionally use libpthread but from somewhere i got to my link map reference to pthread_key_ create@@GLIBC_2.0 I don't know where this comes but it may cause need of libpthread.so without adding NEED ED libpthread.so.0 as follows on objdump -p :

Dynamic Section:

I did not find a root cause of this problem but least workaround. You need link your code with -pthread op tion and have some dummy call to this library .

Define in you Makefile libs

 -lglut -lGLU -lGL -lm  -pthread

Then include some dummy function just refer some libpthread function to make linker link it and you get th e NEEDED libpthread.so.0 and then ld.so is hap.

#include <pthread.h>
void junk() {
  int i;
  i=pthread_getconcurrency();
};

This helped for me, i hope that it helps.

There is more analysis in Ubuntu launcpad https://bugs.launchpad.net/ubuntu/+source/nvidia-graphics-drivers-319/+bug/1248642?comments=all

Flags file

#  gfortran compiler

FC          := gfortran
OPENGL      := true
FFLAGS    := $(DEBUG) -DF2003 -DOPENGL

HOST        := $(shell hostname -s)

ifeq "${HOST}" "whirligig"
  #  The directories containing the Lapack and Blas libraries
  ATLAS       := -L/home/ajs1/ATLAS/ATLAS_x86_64/lib
  LIBS        := -l:liblapack.a -l:libf77blas.a -l:libcblas.a -l:libatlas.a

  # The directories containing the OpenGL libraries
  # OGLLIBDIR  := -L/usr/local/src/Mesa-6.2.1/lib64 -L/usr/lib64/
  OGLLIBDIR  := -L/usr/lib/x86_64-linux-gnu# -lglut -L/usr/lib/mesa

  # The directory containing the X11 libraries
  X11LIBDIR  := -L/usr/lib/x86_64-linux-gnu
endif

ifeq "${HOST}" "mmp12"
  #  The directories containing the Lapack and Blas libraries
  ATLAS       := -L/home/alston/lib/ATLAS/lib
  LIBS        := ${LIBS} -llapack -lf77blas -lcblas -latlas
  #ATLAS       := -L/home/alston/lib/GotoBLAS2
  #LIBS        := ${LIBS} -lgoto2
  X11LIBDIR   := -L/usr/lib64
endif
# The OpenGL libraries, including GLUT, GLU and OpenGL
# -pthread is needed for Ubuntu 13.10. This is likely due to
# a bug in the linker.
OGLLIB := -lglut -lGLU -lGL -pthread

# The X11 libraries
X11LIB     := -lXt -lXi -lXext -lX11 -lm

ifneq "${strip ${STATIC}}" ""
  #  STATIC non-null: use static libraries
  LDFLAGS := $(DEBUG) -static-libgfortran -static-libgcc
  LIBRARIES := ${OGLLIBDIR} ${X11LIBDIR} ${ATLAS} ${LIBRARIES}
  LIBS    := ${LIBS} -lpthread -lc ${OGLLIB} ${X11LIB}
else
  #  STATIC null or unset: use shared libraries for OpenGL and X11
  LDFLAGS  := $(DEBUG) -static-libgfortran -static-libgcc
  FFLAGS    := ${FFLAGS} -DOPENGL -DF2003
  LIBRARIES := ${OGLLIBDIR} ${X11LIBDIR} ${ATLAS} ${LIBRARIES}
  LIBS      := ${LIBS} -lpthread -lc ${OGLLIB} ${X11LIB}
endif

MOD         := mod

OSX

See modifications in osx/gfortran/Flags (provided below) made to get this to compile with GL.

Using GL libraries from XCode (I think!)

Index: osx/gfortran/Flags

--- osx/gfortran/Flags  (revision 22165)
+++ osx/gfortran/Flags  (working copy)
@@ -5,7 +5,7 @@


 #  The directories containing the Lapack and Blas libraries
-ATLAS       := -L/usr/local/ATLAS/OSX_CORE2SSE2/lib
+ATLAS       := -L/Users/alston/lib/ATLAS-i7/lib

 # the directories containing the OpenGL libraries, f90gl libraries, GLUT
 # libraries, and f90gl GLUT libraries
@@ -16,7 +16,7 @@
 # X11LIBDIR  := -L/usr/X11R6/lib

 # the system libraries for OpenGL, including GLUT, GLU and OpenGL
-OGLLIB := -Wl,-framework,OpenGL -Wl,-framework,GLUT
+OGLLIB := -Wl,-framework,OpenGL -Wl,-framework,GLUT

 # the X11 libraries
 # X11LIB     := -lXaw -lXt -lXmu -lXi -lXext -lX11 -lm -lXxf86vm
@@ -25,25 +25,30 @@
   #  Include OpenGL
   FFLAGS    := $(DEBUG) -DOPENGL -DF2003
   # -Wunused-module-vars -Wunused-vars -Wunset-vars -Wunused-label
-  LIBRARIES := ${ATLAS} ${OGLLIBDIR} ${X11LIBDIR} -L/usr/local/lib \
-                  -L/usr/local/gfortran-i686-linux/lib
-  LIBS      := /usr/local/ATLAS/OSX_CORE2SSE2/lib/liblapack.a \
-               /usr/local/ATLAS/OSX_CORE2SSE2/lib/libf77blas.a \
-               /usr/local/ATLAS/OSX_CORE2SSE2/lib/libcblas.a \
-               /usr/local/ATLAS/OSX_CORE2SSE2/lib/libatlas.a ${OGLLIB} ${X11LIB}
+ #LIBRARIES := ${ATLAS} ${OGLLIBDIR} ${X11LIBDIR} -L/usr/local/lib \
+ #                -L/usr/local/gfortran-i686-linux/lib
+  LIBRARIES := ${ATLAS}
+  LIBS      := -llapack -lcblas -lf77blas -latlas -lgfortran ${OGLLIB} ${X11LIB}
+ #LIBS      := -lf77blas -latlas -lcblas -lg2c -lpthread
+ #LIBS      := /usr/local/ATLAS/OSX_CORE2SSE2/lib/liblapack.a \
+ #             /usr/local/ATLAS/OSX_CORE2SSE2/lib/libf77blas.a \
+ #             /usr/local/ATLAS/OSX_CORE2SSE2/lib/libcblas.a \
+ #             /usr/local/ATLAS/OSX_CORE2SSE2/lib/libatlas.a ${OGLLIB} ${X11LIB}
 else
   #  No OpenGL
   FFLAGS    := $(DEBUG)
   LIBRARIES := ${ATLAS} -L/usr/local/lib \
                   -L/usr/local/gfortran-i686-linux/lib
-  LIBS      := -lf77blas -latlas -lcblas -lg2c -lpthread
+  LIBS      := -llapack -lcblas -lf77blas -latlas -lgfortran
+  #LIBS      := -lf77blas -latlas -lcblas -lg2c -lpthread
 endif
 ifeq "${strip ${STATIC}}" ""
   #  Use shared libraries
   LDFLAGS   := $(DEBUG)
 else
   #  Use static libraries
-  LDFLAGS   := $(DEBUG) -Wl,-Bstatic,--allow-multiple-definition
+  #LDFLAGS   := $(DEBUG) -Wl,-Bstatic,--allow-multiple-definition
+  LDFLAGS   := $(DEBUG) -Wl
 endif
 BLAS        := lapack.o
 MOD         := mod

Problems with patch_recipes.pl == touch src/md.F90 src/virial_module.F90 src/recipes.f90 src/histograms.f90 This stops make from trying to patch these files.

**See General Instructions above**

Flags file

Here's my osx/gfortran/Flags file:

#  gfortran compiler

FC          := gfortran
OPENGL      := true


#  The directories containing the Lapack and Blas libraries
ATLAS       := -L/Users/alston/lib/ATLAS-i7/lib

# the directories containing the OpenGL libraries, f90gl libraries, GLUT
# libraries, and f90gl GLUT libraries
# OGLLIBDIR  := -L/usr/lib/
# OGLLIBDIR  := /System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries

# the directory containing the X11 libraries
# X11LIBDIR  := -L/usr/X11R6/lib

# the system libraries for OpenGL, including GLUT, GLU and OpenGL
OGLLIB := -Wl,-framework,OpenGL -Wl,-framework,GLUT

# the X11 libraries
# X11LIB     := -lXaw -lXt -lXmu -lXi -lXext -lX11 -lm -lXxf86vm

ifneq "${strip ${OPENGL}}" ""
  #  Include OpenGL
  FFLAGS    := $(DEBUG) -DOPENGL -DF2003 -DOSX
  # -Wunused-module-vars -Wunused-vars -Wunset-vars -Wunused-label
 #LIBRARIES := ${ATLAS} ${OGLLIBDIR} ${X11LIBDIR} -L/usr/local/lib \
 #                -L/usr/local/gfortran-i686-linux/lib
  LIBRARIES := ${ATLAS}
  LIBS      := -llapack -lcblas -lf77blas -latlas -lgfortran \
            ${OGLLIB} ${X11LIB}
 #LIBS      := -lf77blas -latlas -lcblas -lg2c -lpthread
 #LIBS      := /usr/local/ATLAS/OSX_CORE2SSE2/lib/liblapack.a \
 #             /usr/local/ATLAS/OSX_CORE2SSE2/lib/libf77blas.a \
 #             /usr/local/ATLAS/OSX_CORE2SSE2/lib/libcblas.a \
 #             /usr/local/ATLAS/OSX_CORE2SSE2/lib/libatlas.a ${OGLLIB} ${X11LIB}
else
  #  No OpenGL
  FFLAGS    := $(DEBUG)
  LIBRARIES := ${ATLAS} -L/usr/local/lib \
                  -L/usr/local/gfortran/lib
  LIBS      := -llapack -lcblas -lf77blas -latlas -lgfortran
  #LIBS      := -lf77blas -latlas -lcblas -lg2c -lpthread
endif
ifeq "${strip ${STATIC}}" ""
  #  Use shared libraries
  LDFLAGS   := $(DEBUG)
else
  #  Use static libraries
  #LDFLAGS   := $(DEBUG) -Wl,-Bstatic,--allow-multiple-definition
  LDFLAGS   := $(DEBUG) -Wl
endif
BLAS        := lapack.o
MOD         := mod

Raspberry Pi

Orient can be installed on the Raspberry Pi.

sfns.F90

Split this into three parts:

sfns_1.F90

MODULE Sfns_1

!  S function information
!  MAXSFN is the maximum number of S functions listed altogether. Each
!  S function has an index in the range 1--MAXSFN.
!  SMAP finds the S function S(t,u,j), where t and u are the l\kappa
!  indices for the two sites. If t=l\kappa and u=l'\kappa', then the
!  index of S(t,u,j) is in SMAP(t,u,l+l'-j). (For the electrostatic S
!  functions, l+l'-j=0.) The first S function with a particular value
!  of l+l'-j has the index offset(l+l'-j)+1. maxixes(j) is the index of
!  the last electrostatic function with that value of j.

USE parameters, ONLY : sq
Use Sfns_2
Use Sfns_3

IMPLICIT NONE

! INTEGER :: maxsfn=4000
! INTEGER :: smap(sq,sq,0:10), offset(0:12), maxixes(-1:5)
! INTEGER, ALLOCATABLE :: t1s(:), t2s(:), js(:)
! LOGICAL, ALLOCATABLE :: absent(:)

PRIVATE
PUBLIC :: evals, sindex, t1s, t2s, js, offset, maxixes, smap

CONTAINS

SUBROUTINE evals(order,nstart)

...
...

END SUBROUTINE S50

END MODULE Sfns_1

sfns_2.F90

MODULE Sfns_2

!  S function information
!  MAXSFN is the maximum number of S functions listed altogether. Each
!  S function has an index in the range 1--MAXSFN.
!  SMAP finds the S function S(t,u,j), where t and u are the l\kappa
!  indices for the two sites. If t=l\kappa and u=l'\kappa', then the
!  index of S(t,u,j) is in SMAP(t,u,l+l'-j). (For the electrostatic S
!  functions, l+l'-j=0.) The first S function with a particular value
!  of l+l'-j has the index offset(l+l'-j)+1. maxixes(j) is the index of
!  the last electrostatic function with that value of j.

USE parameters, ONLY : sq
! Use Sfns_1
Use Sfns_3

IMPLICIT NONE

! INTEGER :: maxsfn=4000
! INTEGER :: smap(sq,sq,0:10), offset(0:12), maxixes(-1:5)
! INTEGER, ALLOCATABLE :: t1s(:), t2s(:), js(:)
! LOGICAL, ALLOCATABLE :: absent(:)

! PRIVATE
! PUBLIC :: evals, sindex, t1s, t2s, js, offset, maxixes, smap
PUBLIC

CONTAINS

!----------------------------------------------------------------------

SUBROUTINE Sm2(ix,level)

...
...
END SUBROUTINE Sm2

END MODULE Sfns_2

sfns_3.F90

MODULE Sfns_3

!  S function information
!  MAXSFN is the maximum number of S functions listed altogether. Each
!  S function has an index in the range 1--MAXSFN.
!  SMAP finds the S function S(t,u,j), where t and u are the l\kappa
!  indices for the two sites. If t=l\kappa and u=l'\kappa', then the
!  index of S(t,u,j) is in SMAP(t,u,l+l'-j). (For the electrostatic S
!  functions, l+l'-j=0.) The first S function with a particular value
!  of l+l'-j has the index offset(l+l'-j)+1. maxixes(j) is the index of
!  the last electrostatic function with that value of j.

USE parameters, ONLY : sq
! Use Sfns_1
! Use Sfns_2

IMPLICIT NONE

INTEGER :: maxsfn=4000
INTEGER :: smap(sq,sq,0:10), offset(0:12), maxixes(-1:5)
INTEGER, ALLOCATABLE :: t1s(:), t2s(:), js(:)
LOGICAL, ALLOCATABLE :: absent(:)

! PRIVATE
! PUBLIC :: evals, sindex, t1s, t2s, js, offset, maxixes, smap
PUBLIC

CONTAINS

!-----------------------------------------------------------------------

SUBROUTINE Sm4(ix,level)

...
...

END SUBROUTINE missing

!----------------------------------------------------------------------

END MODULE Sfns_3

Now create a new module called sfns_main.F90:

MODULE Sfns

!  S function information
!  MAXSFN is the maximum number of S functions listed altogether. Each
!  S function has an index in the range 1--MAXSFN.
!  SMAP finds the S function S(t,u,j), where t and u are the l\kappa
!  indices for the two sites. If t=l\kappa and u=l'\kappa', then the
!  index of S(t,u,j) is in SMAP(t,u,l+l'-j). (For the electrostatic S
!  functions, l+l'-j=0.) The first S function with a particular value
!  of l+l'-j has the index offset(l+l'-j)+1. maxixes(j) is the index of
!  the last electrostatic function with that value of j.

USE parameters, ONLY : sq
Use Sfns_1
Use Sfns_2
Use Sfns_3

End Module Sfns

Because the module name used here is Sfns, no other codes need to be modified as this one will collect all the subroutines under the original module name and make them available as before. Only now the compiler can compile each of the three parts of sfns.F90 individually and so use less memory.

And edit the file src/Module-list to include the new codes (and remove sfns.F90 from the list):

...
  sqrts.f90 \
  switches.f90 \
  sfns_3.F90 \
  sfns_2.F90 \
  sfns_1.F90 \
  sfns_main.F90 \
  types.f90 \
...

Make process

Create a new platform ARM by creating the following directories:

ARM/
ARM/gfortran
ARM/gfortran/exe
ARM/gfortran/debug

Create the ARM/gfortran/Flags file:

#  gfortran compiler

FC          := gfortran
OPENGL      :=
# FFLAGS    := $(DEBUG) -DF2003 -DOPENGL
FFLAGS    := $(DEBUG) -DF2003

HOST        := $(shell hostname -s)

ifeq "${HOST}" "raspberrypi"
  ATLAS     := -L/usr/lib/atlas-base/
  LIBS      := ${LIBS} -llapack -lf77blas -lcblas -latlas
endif

# The OpenGL libraries, including GLUT, GLU and OpenGL
# OGLLIB := -lglut -lGL -lGLU

# The X11 libraries
# X11LIB     := -lXt -lXi -lXext -lX11 -lm

# ifneq "${strip ${STATIC}}" ""
  #  STATIC non-null: use static libraries
  LDFLAGS := $(DEBUG) -static-libgfortran -static-libgcc
  LIBRARIES := ${OGLLIBDIR} ${X11LIBDIR} ${ATLAS} ${LIBRARIES}
  LIBS    := ${LIBS} -lpthread -lc ${OGLLIB} ${X11LIB}
# else
#  #  STATIC null or unset: use shared libraries for OpenGL and X11
#  LDFLAGS  := $(DEBUG) -static-libgfortran -static-libgcc
#  FFLAGS    := ${FFLAGS} -DOPENGL -DF2003
#  LIBRARIES := ${OGLLIBDIR} ${X11LIBDIR} ${ATLAS} ${LIBRARIES}
#  LIBS      := ${LIBS} -lpthread -lc ${OGLLIB} ${X11LIB}
# endif

MOD         := mod

I hacked the last block to force no OpenGL, but perhaps this is not needed if we get the flags right.

In the Makefile use:

#  This Makefile is designed for use with Gnu Make, and probably won't
#  work with the standard versions of Make.

BASE   := ${shell pwd}
#  If the above doesn't work, use something like this:
#  BASE   := ${PWD}
#  or
#  BASE   := ${HOME}/Orient4.6

#  Select the default architecture. E.g.
ARCH   := ARM
# ARCH   := x86-64
# ARCH   := x86-32
# ARCH   := osx
# ARCH   := XP

#  Select the default compiler.  See ${ARCH}/${COMPILER}/Flags for compiler options.
ifndef COMPILER
  COMPILER := nag
endif
# COMPILER := nag
# COMPILER := pgf90
COMPILER := gfortran
# COMPILER := ifc
# COMPILER := alpha
# COMPILER := sgi

ifeq ($(COMPILER),nagfor)
  COMPILER := nag
endif

#  Use
#    make DEBUG="-g"
#  (for example) to make a version for debugging
ifdef DEBUG
DIR := ${ARCH}/$(COMPILER)/debug
else
DIR := ${ARCH}/$(COMPILER)/exe
endif

PREFIX = ${BASE}
# PREFIX = /usr/local
INSTALL_DIR = ${PREFIX}/bin

STATIC=""

And build it using make

AJMPublic/orient/compilation-instructions (last edited 2021-04-14 12:57:49 by apw109)