Closed yurivict closed 5 years ago
I was able to perform a successful build of SSAGES v0.8.3 and LAMMPS 22 Aug 2018 with Clang 6.0. There are warnings that are output from the LAMMPS compilation, but it should still complete successfully. There could be a chance that the engine used may affect this compilation. Which engine were you trying to compile with SSAGES?
I ran
mkdir build
cd build/
cmake .. -DLAMMPS_SRC=../lammps22Aug2018 -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0
make -j4
If you had performed a previous build and CMake is trying to reuse those files, you may get conflicts that cause the above issues. To clean your build directory, you can either delete the folder completely or run
make clean
make
to do a clean build.
If you cloned the GitHub repository, you can see if the source files have changed somehow. Run
git status
If any files in the src/
directory have been changed, you may want to checkout those files again to ensure the source isn't modified.
If the problems still exist, please show what errors/warnings you are still getting.
This is the same what I do, and it fails with LAMMPS_SRC
. The last error:
/usr/ports/science/ssages/work/SSAGES-public-0.8.3-alpha/src/CVs/CollectiveVariable.cpp:69:11: error: cannot initialize return object of type 'SSAGES::CollectiveVariable *' with an rvalue of type 'SSAGES::AntiBetaRMSDCV *'
return AntiBetaRMSDCV::Build(json, path);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The first error can be solved by adding #include <array>
in CollectiveVariable.h. You have a pedantic compiler.
The remaining can be solved by replacing the return
statements in CollectiveVariable.cpp with an explicit static cast. For example return AntiBetaRMSDCV::Build(json, path);
becomes return static_cast<CollectiveVariable*>(AntiBetaRMSDCV::Build(json, path));
. Clang can be quite strict about implicit type conversions. These should be fixed in the next release
If you can make those changes manually and report back, that would be great. Apologies for the inconvenience.
Fixing the array
include problem allows the build to proceed. However, now it fails in the lammps
code. It insists on running BSD make (/usr/bin/make) instead of GNU make (gmake
). I already have lammps
installed. Is there a way to just use the existing lammps
package? Also, the same situation is with gromacs
, it would be better to use the pre-installed package.
Can you reproduce the entire compilation error and details of your platform?
The issue with using an existing installation is that SSAGES (and all other advanced sampling libraries) need include additional calls/plugins in the original code in order to bias a simulation. This makes it necessary to recompile the code.
Can you reproduce the entire compilation error and details of your platform?
The second error somehow went away once I've added the array
include.
SSAGES (and all other advanced sampling libraries) need include additional calls/plugins in the original code in order to bias a simulation. This makes it necessary to recompile the code.
Does this mean that there are optional lammps
plugins that aren't built by default? I would rather update the lammps
package and add those to build by default.
You mentioned it failed somewhere else, correct? Can you reproduce that error?
SSAGES contains its own lammps plugin and fix which it adds when it compiled lammps. However, there are some added complexities that means you cannot just add the plugin and compile lammps regularly. It must be compiled through SSAGES.
However, we can definitely try to resolve your build problems if you share more information on what is going on.
With lammps
, it insists on using /usr/bin/make
which is a BSD make. How to override this? Adding the right make
to the PATH
doesn't help.
You can try setting -DCMAKE_MAKE_PROGRAM
to gmake
.
After adding #include <array>
and setting -DCMAKE_MAKE_PROGRAM=gmake
, were you able to compile SSAGES?
If not, please let us know what issues you are still having, as well as the compilation options you are using.
I find the same problem when building 0.8.5-alpha on macOS using clang 10.0.1. The problem is indeed solved by adding #include <array>
in CollectiveVariable.h
as noted by @hsidky above. I would suggest including that simple fix.
index bc537a2..ea6ef54 100644
--- a/src/CVs/CollectiveVariable.h
+++ b/src/CVs/CollectiveVariable.h
@@ -24,6 +24,7 @@
#include "types.h"
#include <vector>
#include <map>
+#include <array>
// Forward declare.
namespace Json {
I'm not sure why this issue was attributed to the compiler being "pedantic" since std::array
is used in CollectiveVariable.h
e.g. on line 53:
std::array<double, 2> bounds_;
(I do not get the problem related to lammps mentioned by @yurivict as I am building for Qbox).
Errors with clang-6 compiler: