Skip to content

Commit

Permalink
Merge pull request NCAR#123 from grantfirl/fix_libxml2_issue_for_SCM
Browse files Browse the repository at this point in the history
Fix libxml2 v2.9.9 compilation failure
  • Loading branch information
grantfirl authored Jul 17, 2019
2 parents b3c6dda + 6b79e60 commit 2d22532
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 8 deletions.
7 changes: 5 additions & 2 deletions scm/doc/TechGuide/chap_quick.tex
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ \section{System Requirements, Libraries, and Tools}
\item cmake 2.8.12.1, 2.8.12.2, and 3.6.2
\item netCDF 4.3.0, 4.4.0, 4.4.1.1, 4.5.0, 4.6.1 and 4.6.3 (not 3.x) with HDF5, ZLIB and SZIP
\item Python 2.7.5, 2.7.9, and 2.7.13 (not 3.x)
\item Libxml2 2.2 and 2.9.7 (not 2.9.9)
\item Libxml2 2.2, 2.9.7, 2.9.9
\end{itemize}

Because these tools and libraries are typically the purview of system administrators to install and maintain, they are considered part of the basic system requirements.
Expand Down Expand Up @@ -157,7 +157,10 @@ \section{Compiling SCM with CCPP}
\begin{lstlisting}[language=bash]
-DPC_LIBXML_INCLUDEDIR=... -DPC_LIBXML_LIBDIR=...
\end{lstlisting}
to the cmake command.
to the cmake command. If a compilation error appears related to \execout{libxml2}, namely that a unicode file is not found in the include path, add the appropriate include path to the \execout{CFLAGS} environment variable
\begin{lstlisting}[language=bash]
export CFLAGS="-I/include_path"
\end{lstlisting} before cleaning out the \execout{bin} directory and rerunning \execout{cmake}.
\item Compile. Add \execout{VERBOSE=1} to obtain more information on the build process.
\begin{lstlisting}[language=bash]
make
Expand Down
Binary file modified scm/doc/TechGuide/main.pdf
Binary file not shown.
38 changes: 32 additions & 6 deletions scm/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,22 @@ endif()
# Set compile options
if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
# Basic settings
set (CMAKE_C_FLAGS "-O0 -g -fPIC" CACHE STRING "" FORCE)
set (CMAKE_CXX_FLAGS "-O0 -g -fPIC" CACHE STRING "" FORCE)
set (CMAKE_Fortran_FLAGS "-O0 -g -fPIC" CACHE STRING "" FORCE)
#if CFLAGS, CXX_FLAGS, or FFLAGS are defined via environment variables, use them
if (DEFINED ENV{CFLAGS})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g -fPIC" CACHE STRING "" FORCE)
else (DEFINED ENV{CFLAGS})
set (CMAKE_C_FLAGS "-O0 -g -fPIC" CACHE STRING "" FORCE)
endif (DEFINED ENV{CFLAGS})
if (DEFINED ENV{CXXFLAGS})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -fPIC" CACHE STRING "" FORCE)
else (DEFINED ENV{CXXFLAGS})
set (CMAKE_CXX_FLAGS "-O0 -g -fPIC" CACHE STRING "" FORCE)
endif (DEFINED ENV{CXXFLAGS})
if (DEFINED ENV{FFLAGS})
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O0 -g -fPIC" CACHE STRING "" FORCE)
else (DEFINED ENV{FFLAGS})
set (CMAKE_Fortran_FLAGS "-O0 -g -fPIC" CACHE STRING "" FORCE)
endif (DEFINED ENV{FFLAGS})
# Compiler-dependent settings
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ggdb")
Expand All @@ -100,9 +113,22 @@ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
message (FATAL_ERROR "This program has only been compiled with gfortran, pgf90 and ifort. If another compiler is needed, the appropriate flags must be added in ${CMAKE_SOURCE_DIR}/CMakeLists.txt")
endif (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
elseif (${CMAKE_BUILD_TYPE} MATCHES "Release")
set (CMAKE_C_FLAGS "-O2 -g -fPIC" CACHE STRING "" FORCE)
set (CMAKE_CXX_FLAGS "-O2 -g -fPIC" CACHE STRING "" FORCE)
set (CMAKE_Fortran_FLAGS "-O2 -g -fPIC" CACHE STRING "" FORCE)
#if CFLAGS, CXX_FLAGS, or FFLAGS are defined via environment variables, use them
if (DEFINED ENV{CFLAGS})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2 -g -fPIC" CACHE STRING "" FORCE)
else (DEFINED ENV{CFLAGS})
set (CMAKE_C_FLAGS "-O2 -g -fPIC" CACHE STRING "" FORCE)
endif (DEFINED ENV{CFLAGS})
if (DEFINED ENV{CXXFLAGS})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -g -fPIC" CACHE STRING "" FORCE)
else (DEFINED ENV{CXXFLAGS})
set (CMAKE_CXX_FLAGS "-O2 -g -fPIC" CACHE STRING "" FORCE)
endif (DEFINED ENV{CXXFLAGS})
if (DEFINED ENV{FFLAGS})
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -O2 -g -fPIC" CACHE STRING "" FORCE)
else (DEFINED ENV{FFLAGS})
set (CMAKE_Fortran_FLAGS "-O2 -g -fPIC" CACHE STRING "" FORCE)
endif (DEFINED ENV{FFLAGS})
# Compiler-dependent settings
if (${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU")
set (CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -ffree-line-length-none -cpp -fdefault-real-8")
Expand Down

0 comments on commit 2d22532

Please sign in to comment.