Generation of the a SALOME module by using YACS-GEN
This forum is DEPRECATED, please create new topics in the new SALOME forum.
For existing topics please transfer them to the new forum.
Dear Salome community
I am very thankful if someone can help.
System Info
(OS: Ubuntu 20.04, SALOME VERSION AND CODE : SALOME-9.7.0-native-UB20.04-SRC.tar.gz)
I'm trying to generate a SALOME module by using YACS-GEN, I run this python code and get the error :
The Error :
CMake Error at CMakeLists.txt:28 (MESSAGE):
We absolutely need the Salome CMake configuration files, please define
CONFIGURATION_ROOT_DIR !
-- Configuring incomplete, errors occurred!
See also "/home/amir/Documents/Softwares/SALOME/SALOME-9.7.0-native-UB20.04-SRC/MATHEMATICS_build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "math_component.py", line 54, in <module>
g.configure()
File
"/home/amir/Documents/Softwares/SALOME/SALOME-9.7.0-native-UB20.04-SRC/BINARIES-UB20.04/YACSGEN/lib/python3.8/site-packages/module_generator/gener.py",
line 845, in configure
raise Invalid("configure has ended in error")
module_generator.gener.Invalid: configure has ended in error
Hint :
(In BINARIES-UB20.04 directory, there is no folder named CONFIGURATION at all)
The Python Code:
#! /usr/bin/env python
import os
from module_generator import Generator,Module,Service,HXX2SALOMEComponent
# Generator python function generates the code
# grab from environment variables of interest (set by source env_products)
kernel_root_dir=os.environ["KERNEL_ROOT_DIR"]
gui_root_dir=os.environ["GUI_ROOT_DIR"]
yacs_root_dir=os.environ["YACS_ROOT_DIR"]
configuration_root_dir=os.environ["CONFIGURATION_ROOT_DIR"]
salome_env="/home/amir/Documents/Softwares/SALOME/SALOME-9.7.0-native-UB20.04-SRC/env_products.sh"
# create a context, that provide environment information
context={"update":1,"makeflags":"-j2","prerequisites":salome_env,"kernel":kernel_root_dir,"gui":gui_root_dir,"yacs":yacs_root_dir}
module="MATHEMATICS"
components_name=["MATH"]
components=[]
for compo_name in components_name:
cpp_root_dir="/home/amir/Documents/Softwares/SALOME/SALOME-9.7.0-native-UB20.04-SRC/ztz/new/MATHCPP"
components.append(HXX2SALOMEComponent("MATH.hxx","libMATHCXX.so",cpp_root_dir ))
module_root_dir="/home/amir/Documents/Softwares/SALOME/SALOME-9.7.0-native-UB20.04-SRC/BINARIES-UB20.04/MATHEMATICS"
# generate and compile the salome component with yacsgen
g=Generator(Module(module,components=components,prefix=module_root_dir),context)
g.generate()
g.configure()
g.make()
g.install()
BsQA3kJWHgkaqht
g.make_appli("appli_math", restrict=["KERNEL"], altmodules={"GUI":yacs_root_dir,"YACS":yacs_root_dir})
The python run in Terminal
classname= MATH
[OK] : double sum(const std::vector<double>& tab);
[OK] : double squareroot(double x);
[OK] : double plus(double x, double y);
[OK] : double minus(double x, double y);
[OK] : double times(double x, double y);
[OK] : double sinx(double x);
service : sum
inports -> [('tab', 'const std::vector<double>&')]
outports -> []
return -> double
implementation :
// Arguments processing
long _tab_size=tab.length();
const double *_tab_value = &tab[0];
std::vector<double> _tab(_tab_value,_tab_value+_tab_size);
// Call cpp component
double _rtn_cpp = cppCompo_->sum( _tab);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::sum");
END_OF("MATH_i::sum");
return _rtn_ior;
service : squareroot
inports -> [('x', 'double')]
outports -> []
return -> double
implementation :
// Arguments processing
double _x(x);
// Call cpp component
double _rtn_cpp = cppCompo_->squareroot( _x);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::squareroot");
END_OF("MATH_i::squareroot");
return _rtn_ior;
service : plus
inports -> [('x', 'double'), ('y', 'double')]
outports -> []
return -> double
implementation :
// Arguments processing
double _x(x);
double _y(y);
// Call cpp component
double _rtn_cpp = cppCompo_->plus( _x, _y);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::plus");
END_OF("MATH_i::plus");
return _rtn_ior;
service : minus
inports -> [('x', 'double'), ('y', 'double')]
outports -> []
return -> double
implementation :
// Arguments processing
double _x(x);
double _y(y);
// Call cpp component
double _rtn_cpp = cppCompo_->minus( _x, _y);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::minus");
END_OF("MATH_i::minus");
return _rtn_ior;
service : times
inports -> [('x', 'double'), ('y', 'double')]
outports -> []
return -> double
implementation :
// Arguments processing
double _x(x);
double _y(y);
// Call cpp component
double _rtn_cpp = cppCompo_->times( _x, _y);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::times");
END_OF("MATH_i::times");
return _rtn_ior;
service : sinx
inports -> [('x', 'double')]
outports -> []
return -> double
implementation :
// Arguments processing
double _x(x);
// Call cpp component
double _rtn_cpp = cppCompo_->sinx( _x);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::sinx");
END_OF("MATH_i::sinx");
return _rtn_ior;
service : sum
inports -> [('tab', 'const std::vector<double>&')]
converted inports -> [['tab', 'dblevec']]
outports -> []
converted outports -> []
Return -> double
converted Return -> double
service : squareroot
inports -> [('x', 'double')]
converted inports -> [['x', 'double']]
outports -> []
converted outports -> []
Return -> double
converted Return -> double
service : plus
inports -> [('x', 'double'), ('y', 'double')]
converted inports -> [['x', 'double'], ['y', 'double']]
outports -> []
converted outports -> []
Return -> double
converted Return -> double
service : minus
inports -> [('x', 'double'), ('y', 'double')]
converted inports -> [['x', 'double'], ['y', 'double']]
outports -> []
converted outports -> []
Return -> double
converted Return -> double
service : times
inports -> [('x', 'double'), ('y', 'double')]
converted inports -> [['x', 'double'], ['y', 'double']]
outports -> []
converted outports -> []
Return -> double
converted Return -> double
service : sinx
inports -> [('x', 'double')]
converted inports -> [['x', 'double']]
outports -> []
converted outports -> []
Return -> double
converted Return -> double
CNC bug : // Arguments processing
long _tab_size=tab.length();
const double *_tab_value = &tab[0];
std::vector<double> _tab(_tab_value,_tab_value+_tab_size);
// Call cpp component
double _rtn_cpp = cppCompo_->sum( _tab);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::sum");
END_OF("MATH_i::sum");
return _rtn_ior;
CNC bug : // Arguments processing
double _x(x);
// Call cpp component
double _rtn_cpp = cppCompo_->squareroot( _x);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::squareroot");
END_OF("MATH_i::squareroot");
return _rtn_ior;
CNC bug : // Arguments processing
double _x(x);
double _y(y);
// Call cpp component
double _rtn_cpp = cppCompo_->plus( _x, _y);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::plus");
END_OF("MATH_i::plus");
return _rtn_ior;
CNC bug : // Arguments processing
double _x(x);
double _y(y);
// Call cpp component
double _rtn_cpp = cppCompo_->minus( _x, _y);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::minus");
END_OF("MATH_i::minus");
return _rtn_ior;
CNC bug : // Arguments processing
double _x(x);
double _y(y);
// Call cpp component
double _rtn_cpp = cppCompo_->times( _x, _y);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::times");
END_OF("MATH_i::times");
return _rtn_ior;
CNC bug : // Arguments processing
double _x(x);
// Call cpp component
double _rtn_cpp = cppCompo_->sinx( _x);
// Post-processing & return
CORBA:ouble _rtn_ior(_rtn_cpp);
endService("MATH_i::sinx");
END_OF("MATH_i::sinx");
return _rtn_ior;
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- The Fortran compiler identification is GNU 9.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Check for working Fortran compiler: /usr/bin/gfortran
-- Check for working Fortran compiler: /usr/bin/gfortran -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran supports Fortran 90
-- Checking whether /usr/bin/gfortran supports Fortran 90 -- yes
CMake Error at CMakeLists.txt:28 (MESSAGE):
We absolutely need the Salome CMake configuration files, please define
CONFIGURATION_ROOT_DIR !
-- Configuring incomplete, errors occurred!
See also "/home/amir/Documents/Softwares/SALOME/SALOME-9.7.0-native-UB20.04-SRC/MATHEMATICS_build/CMakeFiles/CMakeOutput.log".
Traceback (most recent call last):
File "math_component.py", line 54, in <module>
g.configure()
File "/home/amir/Documents/Softwares/SALOME/SALOME-9.7.0-native-UB20.04-SRC/BINARIES-UB20.04/YACSGEN/lib/python3.8/site-packages/module_generator/gener.py", line 845, in configure
raise Invalid("configure has ended in error")
module_generator.gener.Invalid: configure has ended in error
Duplicate of
https://www.salome-platform.org/forum/forum_12/706478155
Check the solution there (tldr; download CONFIGURATION either from the SALOME repositories or from Linux images)
Previously Gregor Simic wrote:
Duplicate of
https://www.salome-platform.org/forum/forum_12/706478155
Check the solution there (tldr; download CONFIGURATION either from the SALOME repositories or from Linux images)
Dear Gregor
Thank you very much for the quick reply.
I'm a little confused about module development. Should I build the SALOME source code (with my own module ) from scratch or I can add CONFIGURATION Folder to the INSTALL folder and run the python code ?
Many thanks
You can use existing SALOME installation of course. Just put the CONFIGURATION directory into the INSTALL directory of SALOME.
In case of Windows you have to put the CONFIGURATION directory inside W64 directory. In case of Linux I think the directory is named BINARIES?
Then you can proceed with building the module as you tried initially.
Best regards,
Gregor
This forum is DEPRECATED, please create new topics in the new SALOME forum.
For existing topics please transfer them to the new forum.