Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.2.2007 throws an error #72

Closed
davydden opened this issue Sep 2, 2020 · 14 comments
Closed

6.2.2007 throws an error #72

davydden opened this issue Sep 2, 2020 · 14 comments

Comments

@davydden
Copy link

davydden commented Sep 2, 2020

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
Copy link
Author

davydden commented Sep 4, 2020

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
Copy link

iwetuan commented Sep 7, 2020

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
Copy link

iwetuan commented Sep 7, 2020

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
Copy link

iwetuan commented Sep 7, 2020

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

@mhochsteger
Copy link
Member

@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
Copy link

iwetuan commented Sep 7, 2020

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
Copy link
Author

davydden commented Sep 7, 2020

Hi @mhochsteger ,

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

@mhochsteger
Copy link
Member

@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
Copy link

iwetuan commented Sep 7, 2020

@mhochsteger thanks! it works.

@davydden
Copy link
Author

davydden commented Sep 7, 2020

@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
Copy link
Author

@mhochsteger 6.2.2008 does show this issue anymore.

@davydden
Copy link
Author

@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 NGSolve/ngsolve@3f0092a , 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 davydden reopened this Sep 18, 2020
@davydden
Copy link
Author

@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.

gentoo-bot pushed a commit to gentoo/sci that referenced this issue Jan 13, 2022
Bug: NGSolve/netgen#72
Bug: NGSolve/netgen#77
Closes: https://bugs.gentoo.org/155424
Closes: https://bugs.gentoo.org/756214
Package-Manager: Portage-3.0.30, Repoman-3.0.3
RepoMan-Options: --force
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
@AlexLuya
Copy link

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants