Open heatherkellyucl opened 5 months ago
This what I have for the install line at present (will pick up system python if not told different).
cmake -D_BUILD_FORTRAN=ON -DBUILD_SHARED_LIBS=ON \
-DPYTHON_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX="$install_prefix" ..
With gcc 10.2.0 this ends up with quite a few strncpy warnings
[ 6%] Building C object third_party/FMI/CMakeFiles/epfmiimport.dir/main.c.o
In file included from /usr/include/string.h:633,
from /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMI/main.c:31:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMI/main.c: In function ‘getfmiEPlusVersion’:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMI/main.c:473:3: warning: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
473 | strncpy(fmiVersionNumber, verID, strlen (verID)+ 1);
| ^~~~~~~
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMI/main.c:473:36: note: length computed here
473 | strncpy(fmiVersionNumber, verID, strlen (verID)+ 1);
| ^~~~~~~~~~~~~~
and a related malloc warning.
[ 15%] Building C object third_party/FMUParser/CMakeFiles/parser.dir/parser.c.o
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.c: In function ‘callparser’:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.c:63:3: warning: ‘strcpy’ writing one too many bytes into a region of a size that depends on ‘strlen’ [-Wstringop-overflow=]
63 | strcpy(tmp, fmuFilNam);
| ^~~~~~~~~~~~~~~~~~~~~~
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.c:62:9: note: at offset 0 to an object allocated by ‘malloc’ here
62 | tmp = malloc(length*sizeof(char));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/string.h:633,
from /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.h:25,
from /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.c:22:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.c: In function ‘main’:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.c:260:12: warning: ‘__builtin_strncpy’ specified bound depends on the length of the source argument [-Wstringop-overflow=]
260 | if(strncpy(objNam, fmuFilNam, length)==NULL) {
| ^~~~~~~
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/third_party/FMUParser/parser.c:252:16: note: length computed here
252 | length = strlen(fmuFilNam)-4;
| ^~~~~~~~~~~~~~~~~
It then fails while linking with many "multiple definition of" errors:
[ 78%] Linking CXX shared library ../../Products/libenergyplusapi.so
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x18): multiple definition of `strLen'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x4b8): first defined here
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x20): multiple definition of `source'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x4c0): first defined here
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x24): multiple definition of `numInputKeys'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x4c4): first defined here
...
../../Products/libbcvtb.a(utilXml.c.o):(.bss+0x58): multiple definition of `vals'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x510): first defined here
../../Products/libbcvtb.a(utilXml.c.o):(.bss+0x80): multiple definition of `Buff'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x540): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Products/libenergyplusapi.so.9.4.0] Error 1
make[1]: *** [src/EnergyPlus/CMakeFiles/energyplusapi.dir/all] Error 2
make: *** [all] Error 2
(Could see what happens if not building the shared library too).
Tried with gcc 4.9.2 to see what happens, fails earlier:
[ 46%] Building CXX object src/EnergyPlus/CMakeFiles/energypluslib.dir/AirLoopHVACDOAS.cc.o
In file included from /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/src/EnergyPlus/AirLoopHVACDOAS.cc:82:0:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/src/EnergyPlus/WeatherManager.hh: In constructor ‘EnergyPlus::WeatherManager::SpecialDayData::SpecialDayData()’:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/src/EnergyPlus/WeatherManager.hh:384:24: error: ‘DateType’ is not a class, namespace, or enumeration
: DateType(DateType::InvalidDate), Month(0), Day(0), WeekDay(0), CompDate(0), WthrFile(false), Duration(0), DayType(0), ActStMon(0),
^
make[2]: *** [src/EnergyPlus/CMakeFiles/energypluslib.dir/AirLoopHVACDOAS.cc.o] Error 1
make[1]: *** [src/EnergyPlus/CMakeFiles/energypluslib.dir/all] Error 2
make: *** [all] Error 2
WIth gcc 10 again, and not telling to build shared libraries:
cmake -D_BUILD_FORTRAN=ON -DPYTHON_EXECUTABLE=$(which python) -DCMAKE_INSTALL_PREFIX=/home/cceahke/Scratch/energyplus/energyplus-9.4.0_install ..
None of the earlier warnings but still tries to link libenergyplusapi.so and fails.
[ 98%] Linking CXX shared library ../../Products/libenergyplusapi.so
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x18): multiple definition of `strLen'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x4b8): first defined here
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x20): multiple definition of `source'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x4c0): first defined here
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x24): multiple definition of `numInputKeys'
...
../../Products/libbcvtb.a(utilXml.c.o):(.bss+0x58): multiple definition of `vals'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x510): first defined here
../../Products/libbcvtb.a(utilXml.c.o):(.bss+0x80): multiple definition of `Buff'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x540): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Products/libenergyplusapi.so.9.4.0] Error 1
make[1]: *** [src/EnergyPlus/CMakeFiles/energyplusapi.dir/all] Error 2
make: *** [all] Error 2
Oh, I did have an extra underscore in -DBUILD_FORTRAN=ON
so that option wasn't recognised, adding in properly (not that it changes the problem).
Tried what happens if everything is static: -DBUILD_STATIC_ENERGYPLUS_API=ON
Then it builds the static library ok but fails on the executable.
[ 78%] Linking CXX static library ../../Products/libenergyplusapi.a
Full executable path is: /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/build/Products/libenergyplusapi.a
Setting up Python API, creating pyenergyplus package at /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/buil
d/Products/pyenergyplus
[ 78%] Built target energyplusapi
[ 78%] Building CXX object src/EnergyPlus/CMakeFiles/energyplus.dir/main.cc.o
[ 78%] Linking CXX executable ../../Products/energyplus
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x18): multiple definition of `strLen'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x4b8): first defined here
../../Products/libbcvtb.a(utilSocket.c.o):(.bss+0x20): multiple definition of `source'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x4c0): first defined here
...
../../Products/libbcvtb.a(utilXml.c.o):(.bss+0x80): multiple definition of `Buff'
../../Products/libenergypluslib.a(ExternalInterface.cc.o):(.bss+0x540): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [Products/energyplus-9.4.0] Error 1
make[1]: *** [src/EnergyPlus/CMakeFiles/energyplus.dir/all] Error 2
make: *** [all] Error 2
compilers/gnu/7.3.0
looks like it is getting further, but is complaining about a lot of nonexistent /include
directories right now.
Ok, that completed, was installable and I can see the help.
[cceahke@build01 build]$ ../../energyplus-9.4.0_install/energyplus -h
EnergyPlus, Version 9.4.0-Unknown
PythonLinkage: This version of EnergyPlus not linked to Python library.
Usage: energyplus [options] [input-file]
Options:
-a, --annual Force annual simulation
-c, --convert Output IDF->epJSON or epJSON->IDF, dependent on
input file type
-D, --design-day Force design-day-only simulation
-d, --output-directory ARG Output directory path (default: current
directory)
-h, --help Display help information
-i, --idd ARG Input data dictionary path (default: Energy+.idd
in executable directory)
-m, --epmacro Run EPMacro prior to simulation
-p, --output-prefix ARG Prefix for output file names (default: eplus)
-r, --readvars Run ReadVarsESO after simulation
-s, --output-suffix ARG Suffix style for output file names (default: L)
L: Legacy (e.g., eplustbl.csv)
C: Capital (e.g., eplusTable.csv)
D: Dash (e.g., eplus-table.csv)
-v, --version Display version information
-w, --weather ARG Weather file path (default: in.epw in current
directory)
-x, --expandobjects Run ExpandObjects prior to simulation
--convert-only Only convert IDF->epJSON or epJSON->IDF,
dependent on input file type. No simulation
Example: energyplus -w weather.epw -r input.idf
Need to check if anything goes wrong with an example as there were a load of bits of X11 it could link to.
As it says, isn't actually linked to python, that's another cmake option if we need that.
Am including -DLINK_WITH_PYTHON=ON
because it makes no sense to me that we're telling it where python is and then not to use it.
Example to test: source comes with weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw
(and others) used in this example https://energyplus.net/quick-start#runsim
Of course, it also needs an older python:
[ 67%] Building CXX object src/EnergyPlus/CMakeFiles/energypluslib.dir/PluginManager.cc.o
In file included from /shared/ucl/apps/python/3.9.10/gnu-4.9.2/include/python3.9/pytime.h:6:0,
from /shared/ucl/apps/python/3.9.10/gnu-4.9.2/include/python3.9/Python.h:81,
from /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/src/EnergyPlus/PluginManager.hh:68,
from /home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/src/EnergyPlus/PluginManager.cc:56:
/home/cceahke/Scratch/energyplus/EnergyPlus-9.4.0/src/EnergyPlus/PluginManager.cc: In static member function
static void EnergyPlus::PluginManagement::PluginInstance::reportPythonError()’:
/shared/ucl/apps/python/3.9.10/gnu-4.9.2/include/python3.9/object.h:633:41: error: expected ‘(’ before ‘PyType
_HasFeature’
#define PyType_FastSubclass(type, flag) PyType_HasFeature(type, flag)
^
That builds. Owain suggested we might be able to get it to work with later python if we rebuild any precreated cython parts it was pulling in - for now I'll leave that.
Test example, with the inputs from the source code repo.
mkdir examples
cd examples
cp ../EnergyPlus-9.4.0/weather/USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw .
cp ../EnergyPlus-9.4.0/testfiles/5ZoneAirCooled.idf .
cp ../EnergyPlus-9.4.0/idd/Energy+.idd.in .
energyplus -i Energy+.idd.in -w USA_IL_Chicago-OHare.Intl.AP.725300_TMY3.epw 5ZoneAirCooled.idf
IN:06685497
We have 9.1. And now also 24.1.0.
9.4 can't be installed from bindist because it requires a newer glibc, needs building from source.
https://github.com/NREL/EnergyPlus/releases/tag/v9.4.0
(Note: the newer versions have bindists for CentOS 7 so I installed 24.1.0 from that too).