NGSolve / netgen

https://ngsolve.org
GNU Lesser General Public License v2.1
298 stars 131 forks source link

6.2.2007 throws an error #72

Closed davydden closed 4 years ago

davydden commented 4 years ago
netgen --version
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi

the software stack is built with gcc 9.3.0.

The latest stable version is 6.2.2006 does not show this issue.

davydden commented 4 years ago

with the source code the same issue happens at the end of the installation phase:

-- Installing: /blahblah/netgen/lib/python3.7/site-packages/netgen/read_gmsh.py
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi
CMake Error at python/cmake_install.cmake:59 (file):
...

I can also confirm that this happens with gcc 8.3.0 and gcc 7.4.0, thus unlikely to be related to the compiler version.

iwetuan commented 4 years ago

hi @davydden 我遇到相同的问题,问题出现在 cmake/generate_version_file.cmake,他期望的输入是这样的格式 v6.2.2004-25-gefbd71c8 但是我的git describe --tag --long 返回的 v6.2-dev-xx-xxx,

问题出现在 string(REGEX REPLACE "^v([0-9]+)\.." "\1" NETGEN_VERSION_MAJOR "${git_version_string}") string(REGEX REPLACE "^v[0-9]+\.([0-9]+)." "\1" NETGEN_VERSION_MINOR "${git_version_string}") string(REGEX REPLACE "^v[0-9]+\.[0-9]+\.([0-9]+)." "\1" NETGEN_VERSION_PATCH "${git_version_string}") string(REGEX REPLACE "^v[0-9]+\.[0-9]+\.[0-9]+\-([0-9]+)." "\1" NETGEN_VERSION_TWEAK "${git_version_string}") string(REGEX REPLACE "^v[0-9]+\.[0-9]+\.[0-9]+\-[0-9]+\-([0-9a-z]+).*" "\1" NETGEN_VERSION_HASH "${git_version_string}")

正则匹配执行 仅仅匹配 v6.2.2004-25-gefbd71c8 但是不能 v6.2-dev-xx-xxx

也需可以这样解决问题 set(git_version_string "v6.2.2007-25-gefbd71c8")

iwetuan commented 4 years ago

thanks fanyi.baidu.com

I have the same problem with cmake / generate version file.cmake He expects the input to be in this format

V6.2.2004-25-gefbd71c8, but my git describe -- tag -- long returns v6.2-dev-xx-xxx,

The problem is

string(REGEX REPLACE "^v([0-9]+).." "\1" NETGEN VERSION MAJOR "${git version string}")

string(REGEX REPLACE "^v[0-9]+.([0-9]+)." "\1" NETGEN VERSION MINOR "${git version string}")

string(REGEX REPLACE "^v[0-9]+.[0-9]+.([0-9]+)." "\1" NETGEN VERSION PATCH "${git version string}")

string(REGEX REPLACE "^v[0-9]+.[0-9]+.[0-9]+-([0-9]+)." "\1" NETGEN VERSION TWEAK "${git version string}")

string(REGEX REPLACE "^v[0-9]+.[0-9]+.[0-9]+-[0-9]+-([0-9a-z]+).*" "\1" NETGEN VERSION HASH "${git version string}")

Regular matching performs only matching

v6.2.2004-25-gefbd71c8

But it can't

v6.2-dev-xx-xxx

It also needs to be able to solve the problem in this way

set(git version string "v6.2.2007-25-gefbd71c8")

iwetuan commented 4 years ago

You may also need to remove your_build_dir/netgen/netgen_version.hpp then rebuild!

mhochsteger commented 4 years ago

@davydden @iwetuan

Hi both, How did you obtain the source code? Please post the output of git remote -v and git tag

Best, Matthias

iwetuan commented 4 years ago

hi @mhochsteger 这是我的输出

dbn@debian:~/Desktop/FET/netgen-mesher-git$ git remote -v origin https://git.code.sf.net/p/netgen-mesher/git (fetch) origin https://git.code.sf.net/p/netgen-mesher/git (push)

dbn@debian:~/Desktop/FET/netgen-mesher-git$ git tag v6.2-dev

davydden commented 4 years ago

Hi @mhochsteger ,

I check out tag 6.2.2007 (commit 6eaeccc) from github https://github.com/NGSolve/ngsolve.git .

mhochsteger commented 4 years ago

@iwetuan Ah, I see that tags were not pushed to sourceforge. That's fixed now, a 'git pull' followed by a rebuild should solve your issue.

@davydden Your issue is different, since your netgen source are fetched from github. Did you run 'git submodule update --recursive' after checking out 6.2.2007 in NGSolve? What's your output of git remote -v git tag git show in your_ngsolve_source/external_dependencies/netgen ?

iwetuan commented 4 years ago

@mhochsteger thanks! it works.

davydden commented 4 years ago

@mhochsteger Apologies, I confused the repos, I actually checkout it from the netgen https://github.com/NGSolve/netgen . But still, the same tag. Importantly, the issue is not there for 6.2.2006, as I mentioned in the OP.

davydden commented 4 years ago

@mhochsteger 6.2.2008 does show this issue anymore.

davydden commented 4 years ago

@mhochsteger @JSchoeberl interestingly enough, this is NOT an netgen issue, but NGSolve. When I install the 6.2.2008 stack and set environment for netgen only, then netgen --version is ok:

netgen --version
NETGEN-6.2.2008
Developed by Joachim Schoeberl at
2010-xxxx Vienna University of Technology
2006-2010 RWTH Aachen University
1996-2006 Johannes Kepler University Linz
Including MPI version 3.1
Problem in Tk_Init: 
result = no display name and no $DISPLAY environment variable
optfile ./ng.opt does not exist - using default values
togl-version : 2
no OpenGL

When I set environment for ngsolve 6.2.2008 (and netgen), then everything works as expected as well:

netgen --version
NETGEN-6.2.2008
Developed by Joachim Schoeberl at
2010-xxxx Vienna University of Technology
2006-2010 RWTH Aachen University
1996-2006 Johannes Kepler University Linz
Including MPI version 3.1
Problem in Tk_Init: 
result = no display name and no $DISPLAY environment variable
optfile ./ng.opt does not exist - using default values
togl-version : 2
no OpenGL
loading ngsolve library
NGSolve-6.2.2008
Using Lapack
Including sparse direct solver UMFPACK
Running parallel using 64 thread(s)

Finally when I set environment to the ngsolve 6.2.2008` patched with https://github.com/NGSolve/ngsolve/commit/3f0092a8a18fbc8061ea035387492e6a685f4140 , then we get an error:

netgen --version
NETGEN-6.2.2008
Developed by Joachim Schoeberl at
2010-xxxx Vienna University of Technology
2006-2010 RWTH Aachen University
1996-2006 Johannes Kepler University Linz
Including MPI version 3.1
Problem in Tk_Init: 
result = no display name and no $DISPLAY environment variable
optfile ./ng.opt does not exist - using default values
togl-version : 2
no OpenGL
loading ngsolve library
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi

By diffing build logs I noticed the following difference:

NGSolve 6.2.2008:  Automatic configuration OK.

vs

  NGSolve ........-..-..:  Automatic configuration OK.

Which brings me to the conclusion that at some point you are trying to output a version from an empty string. A catch of std::invalid_argument is missing somewhere. Would you be so kind to have a closer look. It must be a one-liner fix.

davydden commented 4 years ago

@mhochsteger @JSchoeberl I looked closer into generate_version_file to see that ngsolve relies on the presence of .git to determine the version if it's not build from a tag. I have been using a package manager to check-out the sources with a shallow copy --depth 1 and thus .git was absent. As soon as I let the .git be around, the version is picked-up as intended. Thus it's not a ngsolve issue.

I would still suggest to either catch std::invalid_argument or throw an error at the cmake stage if the version was not picked up correctly for some reason.

AlexLuya commented 2 years ago

@davydden ,Hello,this bug has never been fixed,and I have to add this line to netgen/cmake/generate_version_file.cmake always

set(NETGEN_VERSION 6.2.0-6.2.0.0-6.2.0.0)
set(NETGEN_VERSION_LONG 6.2.0-6.2.0.0-6.2.0.0})
set(NETGEN_VERSION_GIT 6.2.0-6.2.0.0-6.2.0.0)
set(NETGEN_VERSION_TWEAK 6.2.0.0)

By deleting the 'v' charactor from 6.2.0-v6.2.0.0-v6.2.0.0