When I built my OpenFoam-3.0.x from sources I specified the option WM_LABEL_SIZE=64 (just out of curiosity) which affected the definition of the "label" type:
// "label.h"
// A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
...
#define INT_ADD_SIZE(x,s,y) x ## s ## y
#define INT_ADD_DEF_SIZE(x,s,y) INT_ADD_SIZE(x,s,y)
#define INT_SIZE(x,y) INT_ADD_DEF_SIZE(x,WM_LABEL_SIZE,y)
...
namespace Foam {
typedef INT_SIZE(int, _t) label;
It is now:
typedef int64_t label;
And somewhere in <cstdint>:</cstdint>
typedef long int int64_t;
Then I tried to install swak4Foam according to this guide: https://openfoamwiki.net/index.php/C...m/Installation:
mkdir -p $FOAM_RUN
cd "$HOME/OpenFOAM/$USER-$WM_PROJECT_VERSION"
hg clone http://hg.code.sf.net/p/openfoam-extend/swak4Foam swak4Foam
cd swak4Foam
./Allwmake
The output was:
Previously compiled for OpenFOAM 3.0.x
/home/sergei/OpenFOAM/sergei-3.0.x/swak4Foam/privateRequirements/bin existing. Prepending to PATH-variable (private version of Bison)
No file 'swakConfiguration'. Python etc won't work. See README for details
Try 'ln -s swakConfiguration.automatic swakConfiguration' for automatic configuration. BEWARE: this does not work on some systems
Checking swak4Foam-version and generating file
Swak version is 0.4.0
Bison is version 2.7.12-4996
Flex is version 2.5.37 (Minor version: 37)
OpenFOAM-version: Major 3 Minor 0 Patch -1 (-1 == x / 98)
No change to swak4FoamParsers/foamVersion4swak.H
...
../SubsetValueExpressionParser.yy: In instantiation of ‘Foam::autoPtr<Foam::Field<Type> > Foam::SubsetValueExpressionDriver::evaluatePluginFunction(const Foam::word&, const parserSubset::location&, int&, bool) [with T = Foam::Vector<double>]’:
../SubsetValueExpressionParser.yy:740:7: required from here
../SubsetValueExpressionParser.yy:132:9: error: no matching function for call to ‘Foam::CommonPluginFunction::evaluate(std::basic_string<char>, int&, bool&)’
../SubsetValueExpressionParser.yy:132:9: note: candidates are:
In file included from ../SubsetValueExpressionParser.yy:99:0:
lnInclude/CommonPluginFunction.H:224:12: note: template<class T> Foam::tmp<T> Foam::CommonPluginFunction::evaluate(const Foam::string&, Foam::label&)
tmp<T> evaluate(
^
lnInclude/CommonPluginFunction.H:224:12: note: template argument deduction/substitution failed:
../SubsetValueExpressionParser.yy:132:9: note: cannot convert ‘scanned’ (type ‘int’) to type ‘Foam::label& {aka long int&}’
In file included from ../SubsetValueExpressionParser.yy:99:0:
lnInclude/CommonPluginFunction.H:230:20: note: template<class T> Foam::tmp<Foam::Field<Type> > Foam::CommonPluginFunction::evaluate(const Foam::string&, Foam::label&, bool)
tmp<Field<T> > evaluate(
^
lnInclude/CommonPluginFunction.H:230:20: note: template argument deduction/substitution failed:
../SubsetValueExpressionParser.yy:132:9: note: cannot convert ‘scanned’ (type ‘int’) to type ‘Foam::label& {aka long int&}’
../SubsetValueExpressionParser.yy: In instantiation of ‘Foam::autoPtr<Foam::Field<Type> > Foam::SubsetValueExpressionDriver::evaluatePluginFunction(const Foam::word&, const parserSubset::location&, int&, bool) [with T = double]’:
../SubsetValueExpressionParser.yy:1301:7: required from here
../SubsetValueExpressionParser.yy:132:9: error: no matching function for call to ‘Foam::CommonPluginFunction::evaluate(std::basic_string<char>, int&, bool&)’
../SubsetValueExpressionParser.yy:132:9: note: candidates are:
In file included from ../SubsetValueExpressionParser.yy:99:0:
lnInclude/CommonPluginFunction.H:224:12: note: template<class T> Foam::tmp<T> Foam::CommonPluginFunction::evaluate(const Foam::string&, Foam::label&)
tmp<T> evaluate(
The error is basically: c++ compiler can't convert "int &" to "long int &" implicitly on the ground of possible numeric overflow. swak4Foam doesn't always obey the rules - sometimes it uses "int", sometimes "Foam::label" in the source code. The remedy is to be consistent and use typedefed types througout the code.
Here is zipped output: http://www.cfd-online.com/Forums/attachments/openfoam-installation/44405d1452282913-swak4foam-openfoam-3-0-x-make.log.zip
Thanks for the report.
I had a quick look at the sources and I think I can fix this. But to be sure I'll have to build myself a "large label"-installation myself
Pushed a fixed version to the repository. Could you try it so that I can close the Ticket?
Basically the problem was that I was passing a reference to a label to a function generated by flex and that wanted an int (which usually is 32 bit). Until now this used to be fine but not with the 64 bit labels
I have already rebuilt my OpenFOAM with WM_LABEL_SIZE=32 and then Swak4Foam was bult with no issues. Not sure if I want to rebuld everything again, maybe later. If you say that the errors were fixed than I don't object to closing the ticket.