Page 1 of 1

Linux Server Installation

Posted: Thu 22 Oct 2020, 20:03
by kmalone10

I am trying to install openEMS on a Linux server (it has 4.18). Unfortunately I keep running into an error in one of the C++ files in CSXCAD that fails the make, and consequently the build, of openEMS on the server. I've tried to resolve the error but I am not fluent enough in C++ to fix it. These are the error lines that come up:

Code: Select all

[ 53%] Building CXX object src/CMakeFiles/CSXCAD.dir/CSPrimPolyhedronReader.cpp.o
/home/matlab/openEMS/CSXCAD/src/CSPrimPolyhedronReader.cpp: In member function 'virtual bool CSPrimPolyhedronReader::ReadFile()':
/home/matlab/openEMS/CSXCAD/src/CSPrimPolyhedronReader.cpp:167:34: error: cannot bind non-const lvalue reference of type 'const vtkIdType*&' {aka 'const long long int*&'} to an rvalue of type 'const vtkIdType*' {aka 'const long long int*'}
  while (verts->GetNextCell(numP, const_cast<vtkIdType*>(vertices)))
In file included from /usr/local/include/vtk-9.0/vtkPolyData.h:68,
                 from /usr/local/include/vtk-9.0/vtkPolyDataAlgorithm.h:36,
                 from /usr/local/include/vtk-9.0/vtkAbstractPolyDataReader.h:34,
                 from /usr/local/include/vtk-9.0/vtkSTLReader.h:38,
                 from /home/matlab/openEMS/CSXCAD/src/CSPrimPolyhedronReader.cpp:24:
/usr/local/include/vtk-9.0/vtkCellArray.h:1419:12: note:   initializing argument 2 of 'int vtkCellArray::GetNextCell(vtkIdType&, const vtkIdType*&)'
 inline int vtkCellArray::GetNextCell(vtkIdType& npts, vtkIdType const*& pts) VTK_SIZEHINT(pts, npts)
make[5]: *** [src/CMakeFiles/CSXCAD.dir/build.make:323: src/CMakeFiles/CSXCAD.dir/CSPrimPolyhedronReader.cpp.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:86: src/CMakeFiles/CSXCAD.dir/all] Error 2
make[3]: *** [Makefile:130: all] Error 2
make[2]: *** [CMakeFiles/CSXCAD.dir/build.make:112: CSXCAD-prefix/src/CSXCAD-stamp/CSXCAD-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:143: CMakeFiles/CSXCAD.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I think I've gotten so far that there is an error in line 167 of the CSPrimPolyhedronReader.cpp file, something about constant and non-constant value allocation. Beyond that my googling of the error has not amounted to much. Below are a few lines surrounding 167 (the while statement):

Code: Select all

	vtkIdType numP;
	vtkIdType *vertices = new vtkIdType[10];
	while (verts->GetNextCell(numP, vertices))
		face f;
		f.vertices = new int[f.numVertex];
		for (unsigned int np=0;np<f.numVertex;++np)
	return true;

Any help is greatly appreciated, and let me know if you need any more information that may be helpful.

Thank you for your time

Re: Linux Server Installation: Error in CSXCAD/CSPrimPolyhedronReader.cpp

Posted: Thu 22 Oct 2020, 20:12
by thorsten
Both seems to be related to vtk9. vtk 9 is very new and I have never tried to build against version 9. I guess I will have to adapt to the new vtk as for many major new version before.
I can only assume you build vtk yourself? I recommend to just use the distribution versions or at least try an older vtk (e.g. 8.2)

let me know if this helps...


Re: Linux Server Installation: Error in CSXCAD/CSPrimPolyhedronReader.cpp

Posted: Fri 23 Oct 2020, 21:45
by kmalone10
Hi Thorsten,

Thanks for the quick reply, that fixed it!

Unfortunately I've ran into another road block in the matlab interface when executing a file. When I run any file in examples or Tutorials (like Patch_Antenna.m for example) the openEMS executable is not dumping any file into the 'tmp' directory except for the .xml file. I've attached the log file below:

Code: Select all

    LogFile: 'openEMS.log'

 | openEMS 64bit -- version v0.0.35
 | (C) 2010-2016 Thorsten Liebig <>  GPL license
	Used external libraries:
		CSXCAD -- Version: v0.6.2
		hdf5   -- Version: 1.10.5
		          compiled against: HDF5 library version: 1.10.5
		tinyxml -- compiled against: 2.6.2
		boost  -- compiled against: 1_66
		vtk -- Version: 8.2.0
		       compiled against: 8.2.0

openEMS - verbose level 3
openEMS - dump simulation statistics to 'openEMS_run_stats.txt' and 'openEMS_stats.txt'
openEMS - dumping CSX geometry to 'debugCSX.xml'
Read openEMS xml file: patch_ant.xml ...
Read openEMS Settings...
Read Geometry...
Error using load
Unable to read file 'tmp/port_ut1'. No such file or directory.

Error in ReadUI (line 64)
    tmp = load( fullfile(path,filenames{n}) );

Error in Patch_Antenna (line 136)
U = ReadUI( {'port_ut1','et'}, 'tmp/', freq ); % time domain/freq domain voltage

The 'Error using load' part and down is because the 'port_u1' (or any other output) is not being created. Any advice is greatly appreciated.

Re: Linux Server Installation

Posted: Fri 30 Oct 2020, 00:20
by kmalone10

I have tried resolving the issue but I have not been able to yet. I have more detailed information about the error.

Code: Select all

openEMS - verbose level 3
Read openEMS xml file: patch_ant.xml ...
Read openEMS Settings...
Read Geometry...
free(): invalid pointer
/home/matlab/opt/openEMS/bin/ patch_ant.xml -vvv: Aborted

I've tried changing the 'tmp' directory and xml directory file paths, but I get either the "free(): invalid pointer" error above, "openEMS: Error File-Loading failed!!! File: patch_ant.xml:", or a Segmentation fault. The xml file is being made and it is not empty, and I've made sure I have permissions to write files in the directory, so I am pretty stuck.

Any help or recommendations is greatly appreciated.

Re: Linux Server Installation

Posted: Mon 02 Nov 2020, 19:54
by kmalone10
This issue has been resolved. Another user had posted a thread ( in the "Usage" section of the forum with the same issue within a couple days of this one that has a link to the github page. It looks like installing openEMS from the Linux "Compile from Source" page on Ubuntu version 18+ may cause a segmentation fault, so the solution is to install the newest version on github under "openEMS-Project".

Thank you Thorsten and Lee for (indirectly) helping solve my issue!