Various fixes for compiling 4.1 on macOS. Martin Beaudoin. Approved by Bernhard Gschaider.

This commit is contained in:
Hrvoje Jasak 2018-02-27 10:45:52 +00:00
commit 077f219e9c
39 changed files with 249 additions and 18 deletions

View file

@ -10,6 +10,7 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-llduSolvers

View file

@ -9,6 +9,7 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-llduSolvers

View file

@ -10,4 +10,5 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-llduSolvers

View file

@ -10,4 +10,5 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-llduSolvers

View file

@ -10,4 +10,5 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-llduSolvers

View file

@ -10,4 +10,5 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-llduSolvers

View file

@ -10,4 +10,5 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-llduSolvers

View file

@ -8,5 +8,6 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-llduSolvers

View file

@ -8,5 +8,6 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-llduSolvers

View file

@ -9,6 +9,6 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lequationReader

View file

@ -10,4 +10,5 @@ EXE_LIBS = \
-lmeshTools \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-llduSolvers

View file

@ -10,5 +10,6 @@ EXE_LIBS = \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-lfiniteVolume \
-llduSolvers

View file

@ -13,6 +13,7 @@ EXE_LIBS = \
-lspecie \
-lradiation \
-lcompressibleRASModels \
-lcompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-llduSolvers

View file

@ -10,6 +10,7 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-lsurfMesh \

View file

@ -10,6 +10,7 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-lsurfMesh \

View file

@ -6,5 +6,6 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-llduSolvers

View file

@ -9,6 +9,7 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-lsampling \

View file

@ -10,6 +10,7 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleLESModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-llduSolvers

View file

@ -10,6 +10,7 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-llduSolvers

View file

@ -8,5 +8,6 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-llduSolvers

View file

@ -6,6 +6,7 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume \
-lmeshTools \
-llduSolvers

View file

@ -9,10 +9,12 @@ EXE_INC = \
EXE_LIBS = \
$(FOAM_LIBBIN)/postCalc.o \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lcompressibleTurbulenceModel \
-lfiniteVolume

View file

@ -7,4 +7,5 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume

View file

@ -7,4 +7,5 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume

View file

@ -11,10 +11,12 @@ EXE_INC = \
EXE_LIBS = \
$(FOAM_LIBBIN)/postCalc.o \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lincompressibleLESModels \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lcompressibleLESModels \
-lfiniteVolume \

View file

@ -7,6 +7,7 @@ EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lreactionThermophysicalModels \
-lfiniteVolume \

View file

@ -9,7 +9,9 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleRASModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lfiniteVolume

View file

@ -9,4 +9,5 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleLESModels \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lfiniteVolume

View file

@ -9,9 +9,11 @@ EXE_INC = \
EXE_LIBS = \
-lincompressibleTransportModels \
-lincompressibleTurbulenceModel \
-lincompressibleRASModels \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleTurbulenceModel \
-lcompressibleRASModels \
-lfiniteVolume \
-lmeshTools \

View file

@ -52,7 +52,10 @@ Description
#include <sys/socket.h>
#include <netdb.h>
#include <dlfcn.h>
#ifndef darwin
#include <link.h>
#endif
#include <netinet/in.h>
@ -261,10 +264,10 @@ Foam::fileNameList Foam::findEtcFiles
fileNameList results;
// Search for user files in
// * ~/.OpenFOAM/VERSION
// * ~/.OpenFOAM
// * ~/.foam/VERSION
// * ~/.foam
//
fileName searchDir = home()/".OpenFOAM";
fileName searchDir = home()/".foam";
if (isDir(searchDir))
{
fileName fullName = searchDir/FOAMversion/name;
@ -552,6 +555,7 @@ bool Foam::chMod(const fileName& name, const mode_t m)
}
// Return the file mode
mode_t Foam::mode(const fileName& name)
{
fileStat fileStatus(name);
@ -566,6 +570,7 @@ mode_t Foam::mode(const fileName& name)
}
// Return the file type: FILE or DIRECTORY
Foam::fileName::Type Foam::type(const fileName& name)
{
mode_t m = mode(name);
@ -585,24 +590,28 @@ Foam::fileName::Type Foam::type(const fileName& name)
}
// Does the name exist in the filing system?
bool Foam::exists(const fileName& name, const bool checkGzip)
{
return mode(name) || isFile(name, checkGzip);
}
// Does the directory exist?
bool Foam::isDir(const fileName& name)
{
return S_ISDIR(mode(name));
}
// Does the file exist?
bool Foam::isFile(const fileName& name, const bool checkGzip)
{
return S_ISREG(mode(name)) || (checkGzip && S_ISREG(mode(name + ".gz")));
}
// Return size of file
off_t Foam::fileSize(const fileName& name)
{
fileStat fileStatus(name);
@ -617,6 +626,7 @@ off_t Foam::fileSize(const fileName& name)
}
// Return time of last file modification
time_t Foam::lastModified(const fileName& name)
{
fileStat fileStatus(name);
@ -631,6 +641,7 @@ time_t Foam::lastModified(const fileName& name)
}
// Read a directory and return the entries as a string list
Foam::fileNameList Foam::readDir
(
const fileName& directory,
@ -726,6 +737,7 @@ Foam::fileNameList Foam::readDir
}
// Copy, recursively if necessary, the source to the destination
bool Foam::cp(const fileName& src, const fileName& dest)
{
// Make sure source exists.
@ -825,6 +837,7 @@ bool Foam::cp(const fileName& src, const fileName& dest)
}
// Create a softlink. dst should not exist. Returns true if successful.
bool Foam::ln(const fileName& src, const fileName& dst)
{
if (POSIX::debug)
@ -862,6 +875,7 @@ bool Foam::ln(const fileName& src, const fileName& dst)
}
// Rename srcFile dstFile
bool Foam::mv(const fileName& src, const fileName& dst)
{
if (POSIX::debug)
@ -887,6 +901,8 @@ bool Foam::mv(const fileName& src, const fileName& dst)
}
//- Rename to a corresponding backup file
// If the backup file already exists, attempt with "01" .. "99" index
bool Foam::mvBak(const fileName& src, const std::string& ext)
{
if (POSIX::debug)
@ -924,6 +940,8 @@ bool Foam::mvBak(const fileName& src, const std::string& ext)
}
// Remove a file, returning true if successful otherwise false
bool Foam::rm(const fileName& file)
{
if (POSIX::debug)
@ -944,6 +962,7 @@ bool Foam::rm(const fileName& file)
}
// Remove a dirctory and its contents
bool Foam::rmDir(const fileName& directory)
{
if (POSIX::debug)
@ -1233,7 +1252,7 @@ bool Foam::dlSymFound(void* handle, const std::string& symbol)
}
}
#ifdef NOT_SURE_HOW_TO_USE_THIS
static int collectLibsCallback
(
struct dl_phdr_info *info,
@ -1260,6 +1279,7 @@ Foam::fileNameList Foam::dlLoaded()
}
return libs;
}
#endif
void Foam::osRandomSeed(const label seed)

View file

@ -262,7 +262,7 @@ void Foam::sigFpe::set(const bool verbose)
# elif defined(__APPLE__)
struct sigaction newAction;
newAction.sa_handler = sigFpeHandler;
newAction.sa_handler = sigHandler;
newAction.sa_flags = SA_NODEFER;
sigemptyset(&newAction.sa_mask);
if (sigaction(SIGFPE, &newAction, &oldAction_) < 0)

View file

@ -26,6 +26,7 @@ License
#include "dlLibraryTable.H"
#include "OSspecific.H"
#include "int.H"
#include <dlfcn.h>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -34,6 +35,8 @@ namespace Foam
defineTypeNameAndDebug(dlLibraryTable, 0);
}
Foam::dlLibraryTable Foam::dlLibraryTable::loadedLibraries;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -75,24 +78,75 @@ bool Foam::dlLibraryTable::open
{
if (functionLibName.size())
{
void* functionLibPtr = dlOpen(functionLibName, verbose);
void* functionLibPtr =
dlopen(functionLibName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
#ifdef darwin
// If failing to load under OS X, let's try some obvious variations
// before giving up completely
fileName osxFileName(functionLibName);
if(!functionLibPtr && functionLibName.ext()=="so")
{
osxFileName=functionLibName.lessExt()+".dylib";
functionLibPtr =
dlopen(osxFileName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
}
// If unsuccessful, which might be the case under Mac OSX 10.11 (El
// Capitan) with System Integrity Protection (SIP) enabled, let's try
// building a full path using well-known environment variables. This is
// the last resort, unless you provide the full pathname yourself.
if (!functionLibPtr)
{
if (verbose)
{
WarningInFunction
<< "could not load " << functionLibName
<< endl;
}
fileName l_LIBBIN_Name =
getEnv("FOAM_LIBBIN")/osxFileName;
functionLibPtr =
dlopen(l_LIBBIN_Name.c_str(), RTLD_LAZY|RTLD_GLOBAL);
}
if (!functionLibPtr)
{
fileName l_SITE_LIBBIN_Name =
getEnv("FOAM_SITE_LIBBIN")/osxFileName;
functionLibPtr =
dlopen(l_SITE_LIBBIN_Name.c_str(), RTLD_LAZY|RTLD_GLOBAL);
}
if (!functionLibPtr)
{
fileName l_USER_LIBBIN_Name =
getEnv("FOAM_USER_LIBBIN")/osxFileName;
functionLibPtr =
dlopen(l_USER_LIBBIN_Name.c_str(), RTLD_LAZY|RTLD_GLOBAL);
}
#elif defined mingw
if(!functionLibPtr && functionLibName.ext()=="so") {
fileName lName=functionLibName.lessExt()+".dll";
functionLibPtr =
dlopen(lName.c_str(), RTLD_LAZY|RTLD_GLOBAL);
}
#endif
if (!functionLibPtr)
{
WarningIn
(
"dlLibraryTable::open(const fileName& functionLibName)"
) << "could not load " << dlerror()
<< endl;
return false;
}
else
{
libPtrs_.append(functionLibPtr);
libNames_.append(functionLibName);
return true;
if (!loadedLibraries.found(functionLibPtr))
{
loadedLibraries.insert(functionLibPtr, functionLibName);
return true;
}
else
{
return false;
}
}
}
else

View file

@ -37,6 +37,8 @@ SourceFiles
#include "label.H"
#include "DynamicList.H"
#include "Hash.H"
#include "HashTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,6 +50,8 @@ namespace Foam
\*---------------------------------------------------------------------------*/
class dlLibraryTable
:
public HashTable<fileName, void*, Hash<void*> >
{
// Private Member Functions
@ -68,6 +72,12 @@ public:
// Declare name of the class and its debug switch
ClassName("dlLibraryTable");
// Static data members
//- Static data someStaticData
static dlLibraryTable loadedLibraries;
// Constructors
//- Construct null

View file

@ -1145,7 +1145,7 @@ void Foam::argList::printUsage() const
printNotes();
Info<< nl
<<"Using: OpenFOAM-" << Foam::FOAMversion
<<"Using: foam-extend-" << Foam::FOAMversion
<< " (see www.foam-extend.org)" << nl
<<"Build: " << Foam::FOAMbuild << nl
<< endl;

View file

@ -31,6 +31,25 @@ License
#include <cmath>
#if defined(darwin) && defined(__clang__)
#ifndef DUMMY_SCALAR_FUNCTIONS
#define DUMMY_SCALAR_FUNCTIONS
inline float j0f(float x) { return float(j0(double(x)));}
inline float j1f(float x) { return float(j1(double(x)));}
inline float y0f(float x) { return float(y0(double(x)));}
inline float y1f(float x) { return float(y1(double(x)));}
inline float jnf(const int n, const float s) { return float(jn(n, double(s))); }
inline float ynf(const int n, const float s) { return float(yn(n, double(s))); }
inline long double j0l(float x) { return double(j0(double(x)));}
inline long double j1l(float x) { return double(j1(double(x)));}
inline long double y0l(float x) { return double(y0(double(x)));}
inline long double y1l(float x) { return double(y1(double(x)));}
inline long double jnl(const int n, const float s) { return double(jn(n, double(s))); }
inline long double ynl(const int n, const float s) { return double(yn(n, double(s))); }
#endif
#endif // darwin
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam

View file

@ -69,6 +69,11 @@ bool read(const char*, int64_t&);
Istream& operator>>(Istream&, int64_t&);
Ostream& operator<<(Ostream&, const int64_t);
#if WM_ARCH_OPTION == 64 && darwin && __clang__
Istream& operator>>(Istream&, long&);
Ostream& operator<<(Ostream&, const long);
#endif
//- Template specialization for pTraits<int64_t>
template<>
class pTraits<int64_t>

View file

@ -101,5 +101,17 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const int64_t i)
return os;
}
#if WM_ARCH_OPTION == 64 && darwin && __clang__
Foam::Istream& Foam::operator>>(Istream& is, long& i)
{
return operator>>(is, reinterpret_cast<int64_t&>(i));
}
Foam::Ostream& Foam::operator<<(Ostream& os, const long i)
{
os << int64_t(i);
return os;
}
#endif
// ************************************************************************* //

View file

@ -1,6 +1,6 @@
.SUFFIXES: .C .cxx .cc .cpp
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wno-overloaded-virtual -Wno-unsequenced -Wno-c++11-extensions -Wno-unused-comparison
c++WARN = -Wall -Wextra -Wno-unused-parameter -Wold-style-cast -Wno-overloaded-virtual -Wno-unsequenced -Wno-c++11-extensions -Wno-unused-comparison -Wno-undefined-var-template
CC = $(WM_CXX) $(WM_CXXFLAGS) -ftrapping-math

79
wmake/src/Makefile Normal file
View file

@ -0,0 +1,79 @@
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | foam-extend: Open Source CFD
# \\ / O peration | Version: 4.1
# \\ / A nd | Web: http://www.foam-extend.org
# \\/ M anipulation | For copyright notice see file Copyright
#------------------------------------------------------------------------------
# License
# This file is part of foam-extend.
#
# foam-extend is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# foam-extend is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
#
# Script
# Makefile
#
# Description
# Makefile used to compile wmake utilities.
#
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# The Makefile use a POSIX shell
#------------------------------------------------------------------------------
SHELL = /bin/sh
#------------------------------------------------------------------------------
# Initialise suffices list
#------------------------------------------------------------------------------
.SUFFIXES:
.SUFFIXES: .o
#------------------------------------------------------------------------------
# set compilation and dependency building rules
#------------------------------------------------------------------------------
GENERAL_RULES = $(WM_DIR)/rules/General
RULES = $(WM_DIR)/rules/$(WM_ARCH)$(WM_COMPILER)
BIN = $(WM_DIR)/bin/$(WM_ARCH)$(WM_COMPILER)
include $(RULES)/general
include $(RULES)/$(WM_LINK_LANGUAGE)
#------------------------------------------------------------------------------
# targets
#------------------------------------------------------------------------------
all: $(BIN)/dirToString $(BIN)/wmkdep
clean:
rm -f $(BIN)/dirToString $(BIN)/wmkdep 2>/dev/null
$(BIN)/dirToString: dirToString.c
@mkdir -p $(BIN)
$(cc) $(cFLAGS) dirToString.c -o $(BIN)/dirToString
$(BIN)/wmkdep: wmkdep.l
@mkdir -p $(BIN)
flex wmkdep.l
$(cc) $(cFLAGS) lex.yy.c -o $(BIN)/wmkdep
@rm -f lex.yy.c 2>/dev/null
#------------------------------------------------------------------------------