Hello everyone,
I have upgraded a project from cmake 2.8 to cmake 4.0 and llvm 3.9.0 to 22.1.0 so of course I got compilation issues. For example in the project there is a class not found error for vm.hh file and the class is defined inside vm-decl.hh. vm.hh includes well vm-decl.hh but the error persists. I was wondering if it is a C++ or CMake error and if you have an idea to help to fix it ?
Thank you I really appreciate.
vm-decl.hh :
// Copyright © 2011, Université catholique de Louvain
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef MOZART_VM_DECL_H
#define MOZART_VM_DECL_H
#include <cstdlib>
#include <forward_list>
#include <atomic>
#include "core-forward-decl.hh"
#include "memmanager.hh"
#include "store-decl.hh"
#include "threadpool-decl.hh"
#include "gcollect-decl.hh"
#include "sclone-decl.hh"
#include "space-decl.hh"
#include "uuid-decl.hh"
#include "vmallocatedlist-decl.hh"
#include "atomtable.hh"
#include "bigintimplem-decl.hh"
#include "coreatoms-decl.hh"
#include "properties-decl.hh"
#include "debugger-decl.hh"
namespace mozart {
///////////////////
// BuiltinModule //
///////////////////
class BuiltinModule {
public:
/**
* @param vm The virtual machine
* @param name The name of the built-in module to invoke
*/
inline
BuiltinModule(VM vm, const char* name);
virtual ~BuiltinModule() {}
/** Gets the name of the built-in module as an atom */
atom_t getName() {
return _name;
}
/**
* Provides access to a built-in module
* @returns The built-in module as a stable node
*/
StableNode& getModule() {
return *_module;
}
protected:
/**
* Inits the built-in module into a protected node
* @param vm The virtual machine
* @param module A pointer on a node containing the module (generally unstable)
*/
template <typename T>
inline
void initModule(VM vm, T&& module);
private:
atom_t _name;
ProtectedNode _module;
};
....
vm.hh :
// Copyright © 2011, Université catholique de Louvain
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef MOZART_VM_H
#define MOZART_VM_H
#ifndef MOZART_VM_DECL_H
#error "vm-decl.hh should be defined before vm.hh"
#endif
#include "mozartcore.hh" // Includes mozartcore-decl.hh that includes vm-decl.hh
// #include "vm-decl.hh" // I tried to add that too but same behavior
#ifndef MOZART_GENERATOR
namespace mozart {
///////////////////
// BuiltinModule //
///////////////////
BuiltinModule::BuiltinModule(VM vm, const char* name)
: _name(vm->getAtom(name)) {}
template <typename T>
void BuiltinModule::initModule(VM vm, T&& module) {
_module = vm->protect(std::forward<T>(module));
}
....
When doing make :
[ 0%] Built target gensources
[ 0%] Building CXX object vm/vm/main/CMakeFiles/mozartvm.dir/emulate.cc.o
In file included from /home/matdubuisson/Desktop/mozart2/vm/vm/main/emulate.hh:29,
from /home/matdubuisson/Desktop/mozart2/vm/vm/main/debugger-decl.hh:29,
from /home/matdubuisson/Desktop/mozart2/vm/vm/main/vm-decl.hh:49,
from /home/matdubuisson/Desktop/mozart2/vm/vm/main/mozartcore-decl.hh:49,
from /home/matdubuisson/Desktop/mozart2/vm/vm/main/mozartcore.hh:28,
from /home/matdubuisson/Desktop/mozart2/vm/vm/main/mozart.hh:28,
from /home/matdubuisson/Desktop/mozart2/vm/vm/main/emulate.cc:25:
/home/matdubuisson/Desktop/mozart2/vm/vm/main/vm.hh:43:1: error: ‘BuiltinModule’ does not name a type
43 | BuiltinModule::BuiltinModule(VM vm, const char* name)
| ^~~~~~~~~~~~~
/home/matdubuisson/Desktop/mozart2/vm/vm/main/vm.hh:47:6: error: ‘BuiltinModule’ has not been declared
47 | void BuiltinModule::initModule(VM vm, T&& module) {
| ^~~~~~~~~~~~~
/home/matdubuisson/Desktop/mozart2/vm/vm/main/vm.hh: In function ‘void mozart::initModule(VM, T&&)’:
/home/matdubuisson/Desktop/mozart2/vm/vm/main/vm.hh:48:3: error: ‘_module’ was not declared in this scope; did you mean ‘module’? [-Wtemplate-body]
48 | _module = vm->protect(std::forward<T>(module));
| ^~~~~~~
| module
....
Also the error from the #error has not been triggered.
The code comes from a multi-paradigm programing language that I improve for my thesis, this is my fork with the partial upgrade : GitHub - matdubuisson/mozart2: Mozart Programming System v2 · GitHub .
Thank you very much in advance,
I hope to be clear else do not hesitate to ask for clarifications,
Mattéo,