CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   REEF3D (https://www.cfd-online.com/Forums/reef3d/)
-   -   Problems compiling DIVEMesh (https://www.cfd-online.com/Forums/reef3d/239723-problems-compiling-divemesh.html)

zweihuehner November 21, 2021 20:22

Problems compiling DIVEMesh
 
When trying to compile DIVEMesh with "make j 8" there seems to be a namespace issue in driver.h with 'data'. Thus the compilation can not be completed.
I followed the steps from the installation videos:


Quote:

(
sudo apt-get install build-essential gfortran unzip make wget openmpi-bin libopenmpi-dev
mkdir libraries
cd libraries
git clone https://github.com/hypre-space/hypre.git
cd hypre/src
./configure --prefix=/usr/local/hypre
make all
sudo make install
sudo printf '\n#export Path for hypre (part of reef3D) \nPATH=/usr/local/hypre/lib:usr/local/hypre/include:$PATH' >> ~/.bashrc
source ~/.bashrc

)

cd
git clone https://github.com/REEF3D/DIVEMesh.git
cd DIVEMesh
make -j 8


What am I doing wrong?


**System information:**
- REEF3D 21.10
- DIVEMesh 21.10
- OpenMPI 4.1.o
- Hypre 2.23.0
- OS Ubuntu


Here is the output from the compilation:


Quote:

In file included from src/driver.cpp:23:
src/driver.h:59:9: error: reference to ‘data’ is ambiguous
59 | data *pdata;
| ^~~~
In file included from /usr/include/c++/11/string:54,
from /usr/include/c++/11/bits/locale_classes.h:40,
from /usr/include/c++/11/bits/ios_base.h:41,
from /usr/include/c++/11/ios:42,
from /usr/include/c++/11/ostream:38,
from /usr/include/c++/11/iostream:39,
from src/driver.h:23,
from src/driver.cpp:23:
/usr/include/c++/11/bits/range_access.h:319:5: note: candidates are: ‘template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)’
319 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:310:5: note: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])’
310 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:300:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)’
300 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/11/bits/range_access.h:290:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)’
290 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
In file included from src/driver.h:25,
from src/driver.cpp:23:
src/driver_declarations.h:36:7: note: ‘class data’
36 | class objects_geometry;
| ^~~~
In file included from src/driver_analytics.cpp:23:
src/driver.h:59:9: error: reference to ‘data’ is ambiguous
59 | data *pdata;
| ^~~~
In file included from /usr/include/c++/11/string:54,
from /usr/include/c++/11/bits/locale_classes.h:40,
from /usr/include/c++/11/bits/ios_base.h:41,
from /usr/include/c++/11/ios:42,
from /usr/include/c++/11/ostream:38,
from /usr/include/c++/11/iostream:39,
from src/driver.h:23,
from src/driver_analytics.cpp:23:
/usr/include/c++/11/bits/range_access.h:319:5: note: candidates are: ‘template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)’
319 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:310:5: note: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])’
310 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:300:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)’
300 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/11/bits/range_access.h:290:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)’
290 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
In file included from src/driver.h:25,
from src/driver_analytics.cpp:23:
src/driver_declarations.h:36:7: note: ‘class data’
36 | class objects_geometry;
| ^~~~
src/driver.cpp: In member function ‘void driver::mainloop()’:
src/driver.cpp:75:5: error: ‘pdata’ was not declared in this scope; did you mean ‘data’?
75 | pdata->start(p,a);
| ^~~~~
| data
make: [Makefile:19: build/src/driver.o] Error 1 (ignored)
make: [Makefile:19: build/src/driver_analytics.o] Error 1 (ignored)
In file included from src/main.h:25,
from src/main.cpp:23:
src/driver.h:59:9: error: reference to ‘data’ is ambiguous
59 | data *pdata;
| ^~~~
In file included from /usr/include/c++/11/string:54,
from /usr/include/c++/11/bits/locale_classes.h:40,
from /usr/include/c++/11/bits/ios_base.h:41,
from /usr/include/c++/11/ios:42,
from /usr/include/c++/11/ostream:38,
from /usr/include/c++/11/iostream:39,
from src/main.h:24,
from src/main.cpp:23:
/usr/include/c++/11/bits/range_access.h:319:5: note: candidates are: ‘template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)’
319 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:310:5: note: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])’
310 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:300:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)’
300 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/11/bits/range_access.h:290:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)’
290 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
In file included from src/driver.h:25,
from src/main.h:25,
from src/main.cpp:23:
src/driver_declarations.h:36:7: note: ‘class data’
36 | class objects_geometry;
| ^~~~
make: [Makefile:19: build/src/main.o] Error 1 (ignored)
In file included from src/logic.cpp:23:
src/driver.h:59:9: error: reference to ‘data’ is ambiguous
59 | data *pdata;
| ^~~~
In file included from /usr/include/c++/11/string:54,
from /usr/include/c++/11/bits/locale_classes.h:40,
from /usr/include/c++/11/bits/ios_base.h:41,
from /usr/include/c++/11/ios:42,
from /usr/include/c++/11/ostream:38,
from /usr/include/c++/11/iostream:39,
from src/driver.h:23,
from src/logic.cpp:23:
/usr/include/c++/11/bits/range_access.h:319:5: note: candidates are: ‘template<class _Tp> constexpr const _Tp* std::data(std::initializer_list<_Tp>)’
319 | data(initializer_list<_Tp> __il) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:310:5: note: ‘template<class _Tp, long unsigned int _Nm> constexpr _Tp* std::data(_Tp (&)[_Nm])’
310 | data(_Tp (&__array)[_Nm]) noexcept
| ^~~~
/usr/include/c++/11/bits/range_access.h:300:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(const _Container&)’
300 | data(const _Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
/usr/include/c++/11/bits/range_access.h:290:5: note: ‘template<class _Container> constexpr decltype (__cont.data()) std::data(_Container&)’
290 | data(_Container& __cont) noexcept(noexcept(__cont.data()))
| ^~~~
In file included from src/driver.h:25,
from src/logic.cpp:23:
src/driver_declarations.h:36:7: note: ‘class data’
36 | class objects_geometry;
| ^~~~
src/logic.cpp: In member function ‘void driver::logic(lexer*)’:
src/logic.cpp:59:5: error: ‘pdata’ was not declared in this scope; did you mean ‘data’?
59 |
| ^
| data
src/logic.cpp:59:17: error: expected type-specifier before ‘data’
59 |
| ^
make: [Makefile:19: build/src/logic.o] Error 1 (ignored)
/usr/bin/ld: cannot find build/src/driver_analytics.o: No such file or directory
/usr/bin/ld: cannot find build/src/driver.o: No such file or directory
/usr/bin/ld: cannot find build/src/logic.o: No such file or directory
/usr/bin/ld: cannot find build/src/main.o: No such file or directory
collect2: error: ld returned 1 exit status
make: [Makefile:24: bin/DiveMESH] Error 1 (ignored)
(base) fafs@Fafs-XPS:~/Dev/Reef3D/DIVEMesh$ ll
total 5932
drwxrwxr-x 7 fafs fafs 4096 Nov 21 22:24 ./
drwxrwxr-x 5 fafs fafs 4096 Nov 21 22:01 ../
drwxrwxr-x 2 fafs fafs 4096 Nov 21 22:24 bin/
drwxrwxr-x 3 fafs fafs 4096 Nov 21 22:24 build/
-rw-rw-r-- 1 fafs fafs 5965464 Nov 21 22:01 DIVEMesh-UserGuide.pdf
drwxrwxr-x 8 fafs fafs 4096 Nov 21 22:01 .git/
-rw-rw-r-- 1 fafs fafs 66 Nov 21 22:01 .gitattributes
drwxrwxr-x 3 fafs fafs 4096 Nov 21 22:01 .github/
-rw-rw-r-- 1 fafs fafs 235 Nov 21 22:01 .gitignore
-rw-rw-r-- 1 fafs fafs 35126 Nov 21 22:01 LICENSE
-rw-rw-r-- 1 fafs fafs 14369 Nov 21 22:24 log
-rw-rw-r-- 1 fafs fafs 909 Nov 21 22:01 Makefile
-rwxrwxr-x 1 fafs fafs 2590 Nov 21 22:01 release-notes.txt*
drwxrwxr-x 2 fafs fafs 12288 Nov 21 22:01 src/
(base) fafs@Fafs-XPS:~/Dev/Reef3D/DIVEMesh$ cat log
g++ -w -O3 -march=native -c src/baselayer.cpp -o build/src/baselayer.o
g++ -w -O3 -march=native -c src/bc.cpp -o build/src/bc.o
g++ -w -O3 -march=native -c src/bedlevel.cpp -o build/src/bedlevel.o
g++ -w -O3 -march=native -c src/box_bl.cpp -o build/src/box_bl.o


...



Quote:


g++ -w -O3 -march=native -o ./bin/DiveMESH build/src/baselayer.o build/src/bc.o build/src/bedlevel.o build/src/box_bl.o build/src/data.o build/src/data_inversedist.o build/src/decomp_analyse.o build/src/decomp_correction.o build/src/decomp_costfunc.o build/src/decomp_count.o build/src/decomp.o build/src/decomp_paraslice.o build/src/decomp_partition.o build/src/decomp_partition_manual.o build/src/decomp_partition_planes.o build/src/decomp_periodic.o build/src/decomp_periodic_surfco.o build/src/decomp_periodic_surf.o build/src/decomp_print.o build/src/decomp_surface.o build/src/decomp_surfco.o build/src/decomp_vtp.o build/src/dive.o build/src/driver_analytics.o build/src/driver.o build/src/field1d.o build/src/field2d.o build/src/field.o build/src/geodat.o build/src/geodat_holecheck.o build/src/geodat_multigrid_ccipol.o build/src/geodat_multigrid.o build/src/geodat_pointcheck.o build/src/geodat_print-sampled.o build/src/geodat_print-vtp.o build/src/geodat_remove_bounds.o build/src/geodat_setup_ijk.o build/src/geometry_arch.o build/src/geometry_box_array.o build/src/geometry_box.o build/src/geometry_cone_x.o build/src/geometry_cone_y.o build/src/geometry_cone_z.o build/src/geometry.o build/src/geometry_cylinder_y.o build/src/geometry_cylinder_z.o build/src/geometry_ellipsoid.o build/src/geometry_ellipsoid_semi.o build/src/geometry_ellipsoid_semi_rot.o build/src/geometry_fluvial_box_fill_segments.o build/src/geometry_fluvial_box_util.o build/src/geometry_fluvial_box_v1.o build/src/geometry_fluvial_box_v2.o build/src/geometry_hexahedron.o build/src/geometry_jacketmember_norm.o build/src/geometry_ogee-weir.o build/src/geometry_plate_x.o build/src/geometry_pyramid.o build/src/geometry_ray_cast.o build/src/geometry_ray_cast_io_x.o build/src/geometry_ray_cast_io_ycorr.o build/src/geometry_ray_cast_io_zcorr.o build/src/geometry_ray_cast_x.o build/src/geometry_ray_cast_x_gcb.o build/src/geometry_ray_cast_y.o build/src/geometry_ray_cast_z.o build/src/geometry_rotation.o build/src/geometry_semicyl_y.o build/src/geometry_sphere.o build/src/geometry_stl.o build/src/geometry_tetrahedon.o build/src/geometry_wedge.o build/src/geometry_wedge_x.o build/src/geometry_wedge_y.o build/src/geometry_wedge_z.o build/src/hdc_allocate.o build/src/hdc.o build/src/hdc_decomp.o build/src/hdc_filename_in.o build/src/hdc_filename_out.o build/src/hdc_read.o build/src/hdc_read_header.o build/src/hdc_read_mainheader.o build/src/hdc_write.o build/src/hdc_write_header.o build/src/increment.o build/src/ini.o build/src/initialize.o build/src/intfield1d.o build/src/intfield1dy.o build/src/intfield2d.o build/src/intfield.o build/src/inverse_dist.o build/src/inverse_dist_local.o build/src/inverse_dist_local_setup.o build/src/kriging.o build/src/kriging_ini.o build/src/kriging_rearrange.o build/src/kriging_semivariogram.o build/src/kriging_solve.o build/src/lexer.o build/src/lexer_createspace.o build/src/lexer_gridspacing_cellBased.o build/src/lexer_gridspacing.o build/src/lexer_gridspacing_fsf.o build/src/lexer_gridspacing_print.o build/src/lexer_pos.o build/src/logic.o build/src/main.o build/src/module_void.o build/src/print_binary.o build/src/print_bottom.o build/src/print_debug.o build/src/print_solid.o build/src/print_vtu.o build/src/read_control.o build/src/read_data.o build/src/read_geodat.o build/src/read_solid.o build/src/read_stl.o build/src/read_topo.o build/src/resize.o build/src/resize_delete.o build/src/resize_resize.o build/src/slice.o build/src/solid.o build/src/solid_fluvial_box.o build/src/surface.o build/src/surface_dir.o build/src/surface_plate.o build/src/surface_solid.o build/src/topo.o




kamath November 22, 2021 08:00

Seems like a compiler issue on your local machine.
DiveMESH uses only g++ and has no dependencies. So problems compiling this are quite rare (and therefore I haven't seen a lot a problems) and generally compiler related.
Could you please post the output you get for:

which gcc

which g++

What I also find strange is that while you get an error during the compilation (from the first console output pasted above), the output that denotes the making of the executable is printed out in full (the last output).

zweihuehner November 22, 2021 08:19

Thank you for the quick reply.

Quote:

which gcc
usr/bin/gcc
gcc -dumpfullversion
11.2.0



which g++
usr/bin/g++
g++ -dumpfullversion
11.2.0


Is the executable output actually correct ? Shouldn't it end with


Quote:

-o DiveMESH
?

kamath November 22, 2021 08:37

The last quote in your original post is correct.
Starts with
g++ -w -O3 -march=native -o ./bin/DiveMESH ...
ends with build/src/topo.o

as expected.
Could you please confirm that the DIVEMesh/bin folder is actually empty?

Meanwhile I will check if there are any issues with gcc-11

zweihuehner November 22, 2021 08:54

DIVEMesh/bin is empty.


And I am very sorry there is also output at the very end:


Quote:

... o build/src/surface_solid.o build/src/topo.o
/usr/bin/ld: cannot find build/src/driver_analytics.o: No such file or directory
/usr/bin/ld: cannot find build/src/driver.o: No such file or directory
/usr/bin/ld: cannot find build/src/logic.o: No such file or directory
/usr/bin/ld: cannot find build/src/main.o: No such file or directory
collect2: error: ld returned 1 exit status
make: [Makefile:24: bin/DiveMESH] Error 1 (ignored)
I checked and those files don't exist.

I forgot to quote it as the maximum number of letters was exceeded.

kamath November 22, 2021 08:57

No problem :)

But I can at this stage confirm that compiling fails with gcc-11.

We are looking into it and a fix might come soon.

In the meantime, as a temp fix:
sudo update-alternatives --remove-all gcc
sudo update-alternatives --remove-all g++
sudo apt-get install gcc-9.3.0 g++-9.3.0

should help?

(This is the highest version I have confirmation currently for a successful compilation on a Linux machine)

zweihuehner November 22, 2021 09:34

Compiles beautifully now!

Your recommended commands didn't work for me, however I did the following instead:

Quote:

sudo add-apt-repository ppa:ubuntu-toolchain-r/test

sudo apt update
sudo apt install g++-9 gcc-9

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-9
sudo update-alternatives --config gcc

Versions are now both 9.4.0.

valgrinda November 23, 2021 07:19

Should be fixed in the newest DIVMesh release candidate, should be now compatible with gcc v11.

zweihuehner November 23, 2021 09:28

Thanks a lot !


All times are GMT -4. The time now is 09:52.