- Thank you received: 3
Build from source on Windows
4 years 4 months ago #2912
by ddrake
Build from source on Windows was created by ddrake
Hi, I'm getting a compile error when I try to build NGSolve from source on Windows 7 with Visual Studio 2015 C++ and Python 3.7. I get the same error if I try to build using the CMake command or from inside Visual Studio.
The error is:
This is not an urgent issue for me, but I was wondering if there is a work-around. The nightly build works, so I'm guessing that there is just some issue with my build environment.
I'm attaching my CMakeCache.txt. Please let me know if there is more information I can provide.
Best,
Dow
The error is:
Code:
c:\users\dow\ngsuite\src\external_dependencies\netgen\libsrc\core\type_traits.hpp(46): fatal error C1001: An internal error has occurred in the compiler. [C:\Users\Dow\ngsuite\build\netgen\netgen\libsrc\core\ngcore.vcxproj] [C:\Users\Dow\ngsuite\build\netgen\netgen.vcxproj]
8> (compiler file 'f:\dd\vctools\compiler\cxxfe\sl\p1\c\template.cpp', line 13144)
8> To work around this problem, try simplifying or changing the program near the locations listed above.
8> Please choose the Technical Support command on the Visual C++
8> Help menu, or open the Technical Support help file for more information (compiling source file C:\Users\Dow\ngsuite\src\external_dependencies\netgen\libsrc\core\localheap.cpp)
8> c:\users\dow\ngsuite\src\external_dependencies\netgen\libsrc\core\type_traits.hpp(52): note: see reference to class template instantiation 'ngcore::detail::has_Range<std::T>' being compiled
8> with
8> [
8> T=std::size_t
8> ] (compiling source file C:\Users\Dow\ngsuite\src\external_dependencies\netgen\libsrc\core\localheap.cpp)
8> c:\users\dow\ngsuite\src\external_dependencies\netgen\libsrc\core\type_traits.hpp(46): note: see reference to variable template 'const bool has_range<unsigned __int64>' being compiled (compiling source file C:\Users\Dow\ngsuite\src\external_dependencies\netgen\libsrc\core\localheap.cpp)
8> c:\users\dow\ngsuite\src\external_dependencies\netgen\libsrc\core\array.hpp(333): note: see reference to class template instantiation 'ngcore::T_Range<std::size_t>' being compiled (compiling source file C:\Users\Dow\ngsuite\src\external_dependencies\netgen\libsrc\core\localheap.cpp)
I'm attaching my CMakeCache.txt. Please let me know if there is more information I can provide.
Best,
Dow
Attachments:
- christopher
- Offline
- Administrator
Less
More
- Thank you received: 101
4 years 4 months ago #2913
by christopher
Replied by christopher on topic Build from source on Windows
I think VS2015 is too old, they do not support cpp17 fully afaik. And obviously crash on it... Can you use VS 2019? - community edition is free
Best
Christopher
Best
Christopher
The following user(s) said Thank You: ddrake
4 years 4 months ago - 4 years 4 months ago #2914
by ddrake
Replied by ddrake on topic Build from source on Windows
Thanks, Christopher! That makes sense. I was following the instructions on the
Build on Windows
page, which maybe could be updated. They mention:
Best,
Dow
EDIT: I replaced Python 3.7 with Python 3.8, assuming that the documentation was out of date in that respect also. Then this worked for me to build NGSolve:
where
in my case was
Then I did the step to set environment variables:
This prepended
to my PYTHONPATH, but then netgen wasn't able to find the python modules:
I tried changing the PYTHONPATH to include
Then netgen ran correctly, and I was able to import ngsolve from the netgen python console and run a python script using
The only remaining issue is that if I try to import ngsolve in a regular python shell or in a Jupyter notebook, or run my script using
, I get the error:
The package "C:\Users\Dow\ngsuite\install\lib\site-packages\netgen\libngpy.lib" exists as a static library, but the Python 3.8 interpreter seems to be expecting a dynamic load library (dll) perhaps?
Best,
Dow
andYou need a recent compiler, we advise Microsoft Visual Studio 2015
Code:
cmake "../src" -DCMAKE_INSTALL_PREFIX="BASEDIR/install" -G "Visual Studio 14 Win64"
Best,
Dow
EDIT: I replaced Python 3.7 with Python 3.8, assuming that the documentation was out of date in that respect also. Then this worked for me to build NGSolve:
Code:
cmake "../src" -DCMAKE_INSTALL_PREFIX="BASEDIR/install" -G "Visual Studio 16 2019" -A "x64"
Code:
BASEDIR
Code:
C:/Users/Dow/ngsuite
Code:
cmake --build . --config Release --target set_environment_variables
Code:
C:/Users/Dow/ngsuite/install
Code:
C:\Users\Dow>netgen
NETGEN-6.2.2006-8-g2800d6c2
Developed by Joachim Schoeberl at
2010-xxxx Vienna University of Technology
2006-2010 RWTH Aachen University
1996-2006 Johannes Kepler University Linz
optfile ./ng.opt does not exist - using default values
togl-version : 2
loading ngsolve library
NGSolve-6.2.2006-49-ga4dfcd3b
Using Lapack
Including sparse direct solver UMFPACK
Running parallel using 8 thread(s)
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ngsolve'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'ngsolve'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'netgen'
Thank you for using NGSolve
I tried changing the PYTHONPATH to include
Code:
C:/Users/Dow/ngsuite/install/lib/site-packages
Code:
netgen myscript.py
Code:
python myscript.py
Code:
C:\Users\Dow>python test.py
Traceback (most recent call last):
File "test.py", line 1, in <module>
from ngsolve import *
File "C:\Users\Dow\ngsuite\install\lib\site-packages\ngsolve\__init__.py", lin
e 12, in <module>
import netgen
File "C:\Users\Dow\ngsuite\install\lib\site-packages\netgen\__init__.py", line
13, in <module>
from . import libngpy
ImportError: DLL load failed while importing libngpy: The specified module could
not be found.
Best,
Dow
Last edit: 4 years 4 months ago by ddrake.
4 years 4 months ago #2918
by ddrake
Replied by ddrake on topic Build from source on Windows
Sorry -- I was wrong yesterday when I reported that the build completed correctly. I deleted the build and install directories and repeated the build steps.
This time I noticed an error in the build that I had missed.
I can't find any error preceding this, but there were many warnings about "inconsistent dll linkage".
I'm attaching the configure/build output along with my CMakeCache.txt
I also tried deleting the build and install directories and building in Visual Studio. The documentation says:
I don't know what else to try at this point.
Best,
Dow
Code:
cmake "../src" -DCMAKE_INSTALL_PREFIX="BASEDIR/install" -G "Visual Studio 16 2019" -A "x64"
cmake --build . --config Release --target install
Code:
...
-- Installing: C:/UsersDow/ngsuite/install/Lib/site-packages/ngsolve/labextension/labextension
-- Installing: C:/UsersDow/ngsuite/install/Lib/site-packages/ngsolve/labextension/labextension/plugin.js
-- Installing: C:/UsersDow/ngsuite/install/Lib/site-packages/ngsolve/labextension/labextension/plugin.js.map
-- Installing: C:/UsersDow/ngsuite/install/Lib/site-packages/ngsolve/labextension/package.json
Traceback (most recent call last):
File "c:\users\dow\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\dow\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Dow\AppData\Local\Programs\Python\Python38\Scripts\jupyter-nbextension.exe\__main__.py", line 7, in <module>
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\traitlets\config\application.py", line 664, in launch_instance
app.start()
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 983, in start
super(NBExtensionApp, self).start()
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\jupyter_core\application.py", line 259, in start
self.subapp.start()
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 711, in start
self.install_extensions()
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 682, in install_extensions
full_dests = install(self.extra_args[0],
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 206, in install_nbextension_python
m, nbexts = _get_nbextension_metadata(module)
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 1117, in _get_nbextension_metadata
m = import_item(module)
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\traitlets\utils\importstring.py", line 42, in import_item
return __import__(parts[0])
ModuleNotFoundError: No module named 'ngsolve'
Traceback (most recent call last):
File "c:\users\dow\appdata\local\programs\python\python38\lib\runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\dow\appdata\local\programs\python\python38\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "C:\Users\Dow\AppData\Local\Programs\Python\Python38\Scripts\jupyter-nbextension.exe\__main__.py", line 7, in <module>
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\traitlets\config\application.py", line 664, in launch_instance
app.start()
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 983, in start
super(NBExtensionApp, self).start()
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\jupyter_core\application.py", line 259, in start
self.subapp.start()
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 891, in start
self.toggle_nbextension_python(self.extra_args[0])
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 864, in toggle_nbextension_python
return toggle(module,
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 477, in enable_nbextension_python
return _set_nbextension_state_python(True, module, user, sys_prefix,
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 375, in _set_nbextension_state_python
m, nbexts = _get_nbextension_metadata(module)
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\notebook\nbextensions.py", line 1117, in _get_nbextension_metadata
m = import_item(module)
File "c:\users\dow\appdata\local\programs\python\python38\lib\site-packages\traitlets\utils\importstring.py", line 42, in import_item
return __import__(parts[0])
ModuleNotFoundError: No module named 'ngsolve'
...
I can't find any error preceding this, but there were many warnings about "inconsistent dll linkage".
I'm attaching the configure/build output along with my CMakeCache.txt
I also tried deleting the build and install directories and building in Visual Studio. The documentation says:
The only '.sln' file in the build directory was 'ngsuite.sln', which I assume is the new name for 'SUPERBUILD.sln'. I built the "INSTALL" project as instructed. The same warnings and errors were generated and the behavior of the installed application was the same (i.e. netgen runs but importing ngsolve in a python shell fails).Alternatively you can open BASEDIR\build\SUPERBUILD.sln in Visual Studio and build the "INSTALL" project. Make sure to select the desired solution configuration (e.g. Release).
I don't know what else to try at this point.
Best,
Dow
Attachments:
4 years 4 months ago #2921
by matthiash
Replied by matthiash on topic Build from source on Windows
Hi Dow,
I think you need to set the environment variables (like PYTHONPATH):
cmake --build . --config Release --target set_environment_variables
I wasn't aware this is now already needed during the build, we will move this up in the documentation.
Best,
Matthias
I think you need to set the environment variables (like PYTHONPATH):
cmake --build . --config Release --target set_environment_variables
I wasn't aware this is now already needed during the build, we will move this up in the documentation.
Best,
Matthias
The following user(s) said Thank You: ddrake
4 years 4 months ago #2922
by ddrake
Replied by ddrake on topic Build from source on Windows
Thanks, Matthias!
Your point makes sense. But I think there may also be an issue with the directory that is being added to PYTHONPATH by set_environment_variables.
I just tried removing references to ngsolve directories from my PATH and PYTHONPATH, then running
The build failed in the same way.
Your point makes sense. But I think there may also be an issue with the directory that is being added to PYTHONPATH by set_environment_variables.
I just tried removing references to ngsolve directories from my PATH and PYTHONPATH, then running
Code:
cmake --build . --config Release --target set_environment_variables
cmake --build . --config Release --target install
Time to create page: 0.115 seconds