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

TetGen: patch upstream to fix crash #3611

Merged
merged 1 commit into from
Sep 13, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions T/TetGen/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,18 @@ cd $WORKSPACE/srcdir/tetgen
# Patch tetgen.h with operators delegating new/delete to malloc/free for C/Julia compatibility
# Made corresponding feature request to upstream, probably available for 1.6.1
#

mv tetgen.h tmp.h
sed -e "s/class tetgenio {/class tetgenio { void * operator new(size_t n) { return malloc(n);} void operator delete(void* p) noexcept {free(p);} /g" tmp.h > tetgen.h

#
# Fix crash of README example (see TetGen.jl#26)
# There seems to be a on-off error or something like this in the routine writing the result. In 1.6.0 and also in
# the previous 1.5 version this does not happen.
#
mv tetgen.cxx tmp.cxx
sed -e "s/tetrahedrons->items \* 10/(tetrahedrons->items + 100) * 10/g" tmp.cxx > tetgen.cxx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an upstream PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upstream situtation is a little bit nonstandard. The UFZ repo referred to in the script is a github version of the upstream source available as download from tetgen.org (hosted at wias-berlin.de) after filling a download form. This is for historical reasons when open source was seen with suspicion etc., I am personally involved into this almost from beginning...

So I could send this as a PR to "semi-upstream" at UFZ, but the also prefer to keep it "as is":
ufz/tetgen#1 (comment) , so I decided for this PR.

The optimal course of action would start with having an official upstream repo. I will try to fix this situation at wias-berlin.de, which hopefully can be resolved in a couple of weeks. If this works I would let the UFZ people know and try to set up a proper workflow with the author Hang Si and modify the script accordingly.

Meanwhile I propose to accept this PR as a short-time solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is.... hilariously German.


# Compile and link together with C wrapper
${CXX} -c -fPIC -std=c++11 -O3 -c -DTETLIBRARY -I. ${WORKSPACE}/srcdir/cwrapper/cwrapper.cxx -o cwrapper.o
${CXX} -c -fPIC -std=c++11 -O3 -c -DTETLIBRARY tetgen.cxx -o tetgen.o
Expand All @@ -48,6 +57,8 @@ install_license LICENSE
"""

platforms = supported_platforms()
# platforms=[Platform("x86_64", "linux"; libc="glibc")]

products = [
LibraryProduct("libtet", :libtet)
]
Expand Down