METRON-1334 Add C++11 Compliance Check to 'platform-info.sh' #849
Conversation
else | ||
echo "Warning: Compiler is NOT C++11 compliant" | ||
fi | ||
rm -f $CPPFILE $OBJFILE | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A standard way in the language is to check for the value of __cplusplus
201402L is CPP 14
201103L is CPP 11
I don't have a preference, just throwing this out there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to account for platform_info on a non-dev machine? If there is no g++ at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have to account for platform_info on a non-dev machine? If there is no g++ at all?
The platform-info script is there to tell us whether a machine can be used to deploy metron. Right now, you have to build Metron to deploy it, so the script checks all dev dependencies.
If g++ is not in the path, then the script will tell us that. And it would carry on its merry way. That's the behavior that I would expect.
Maybe I am not following you. Can you describe the scenario you are thinking of more?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A standard way in the language is to check for the value of __cplusplus
Thanks, I saw that. I didn't think it was worth the trouble. IMHO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i agree about it not being worth the trouble.
as far as g++, I would expect us to check (pseudo)
if c++ in path then
build test program
else
echo No Cpp, you are in trouble!
fi
Maybe I'm mis-reading this, if there is no cpp, it will still try to build etc won't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I ran it, I did mis-understand. sorry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries. Glad to have a second set of eyes on it.
+1, Tested on OSX and on centos 6 with and without compliant g++ installed |
Ran on a purposefully misconfigured macOS system. Is this the expected output?
|
I think that is valid |
I agree with @ottobackwards . That looks like what I would expect to see. @JonZeolla I assume since you asked, it is not what you would expect. What would prefer to see here? |
Instead of trying to explaining my position, I threw together a quick PR to illustrate my thoughts. Feel free to take another approach if you'd prefer, or merge and/or modify without attribution. I tested it with |
+1 great stuff @nickwallen. |
Some of the module dependencies for the Management and Alerts UI must be built natively on the host. This requires a C/C++ compiler. In addition, some of the dependencies require a C++11 compliant compiler. This is causing problems for users who attempt to build Metron on a system with an older version of GCC, like CentOS 6.
Not having a C++11 compliant compiler can cause some non-obvious error messages when the build fails. This adds a version check for GCC and also a C++11 compliance check. The compiler itself must be on the user's PATH, which is what the Node modules also require.
If the compiler is C++11 compliant, you will see the following.
If the compiler is NOT C++11 compliant, you will see the following.
This was tested manually on Mac OS X, CentOS 6, CentOS 7, and Ubuntu Trusty 64.
Pull Request Checklist