Closed kschwede closed 3 years ago
Finally, peridocally, in the terminal output, i also see sh: 1: Syntax error: "(" unexpected
Is this something I should be worried about?
I think that is indeed something we should be worried about.
Is something going on with the multi-threading of building documentation? Currently, the only errors I see are those at the end. I'm attaching (the not very helpful) example output errors here in a zip file. ErrorsFromBuild.zip Some of the example outputs simply say "Killed" at the end.
I doubt it has to do with multi-threading, in particular, the errors that just say "Killed" are the same functions as in #1456, where they segfault.
Weirdly, when I try re-running ninja install-packages at least the second time (and getting a different similar-looking error the first time), it completed without errors.
The other error, on line clean (0.001, sosPoly sol)
, is calling csdp and I can reproduce that when csdp is not found, but I can't see how the second time csdp is found, unless csdp is also crashing and hence not returning anything.
Finally, peridocally, in the terminal output, i also see sh: 1: Syntax error: "(" unexpected
Do you see this appearing in any other example files? Perhaps try:
cat usr-dist/common/share/doc/Macaulay2/Elimination/example-output/* | grep unexpected
The cat command produces no output.
I'll try rebuilding again.
Should I try uninstalling csdp?
Might be worth trying with both system csdp and csdp built by M2. Let's try to reproduce it without rebuilding first. Try:
ninja uninstall-SumsOfSquares uninstall-NumericalImplicitization
ninja install-SumsOfSquares install-NumericalImplicitization
Do you see any errors? What if you do:
ninja uninstall-packages
ninja install-packages
Whoops, I just rebuilt from scratch now. Seeing the same errors. the cat command produces nothing.
Running
ninja uninstall-SumsOfSquares uninstall-NumericalImplicitization
ninja install-SumsOfSquares install-NumericalImplicitization
produces no errors even on the same system that just had errors. The only concerning information is the syntax error warnings.
[5/5] Installing package SumsOfSquares
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
-- making example results for RoundTol
-- making example results for SOSPoly
-- making example results for sosPoly
-- making example results for coefficient field
-- making example results for sosdecTernary
-- making example results for TraceObj
-- making example results for clean(RR,SOSPoly)
-- making example results for SumsOfSquares
-- making example results for solveSOS
-- making example results for solveSOS(RingElement,RingElement,Matrix)
-- making example results for sosInIdeal
-- making example results for library
-- making example results for SDPResult
-- making example results for recoverSolution
-- making example results for value(SOSPoly)
-- making example results for lowerBound
-- info: there are 18 documentation nodes that are not listed as a subnode
I'm running the full uninstall and install of packages now, but I expect that to take a bit longer.
The same errors occurred with the full uninstall + install of the packages that did not occur when just installing NumericalImplicitization.
See for instance:
[202/206] Installing package NumericalImplicitization
FAILED: Macaulay2/packages/CMakeFiles/install-NumericalImplicitization usr-dist/x86_64-Linux-Ubuntu-20.04/lib/x86_64-linux-gnu/Macaulay2/NumericalImplicitization/.ins
d
cd /home/schwede/M2Ninja/M2/M2/BUILD/build/Macaulay2/packages && /home/schwede/M2Ninja/M2/M2/BUILD/build/usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2 -q --stop --silent
preload --no-threads -e errorDepth=3 -e debugLevel=0 -e "installPackage(\"NumericalImplicitization\", Verbose => false, RerunExamples => false, CheckDocumentation =>
IgnoreExampleErrors => false, RemakeAllDocumentation => false, InstallPrefix => \"/home/schwede/M2Ninja/M2/M2/BUILD/build/usr-dist/\", UserMode => false, SeparateExe
true, DebuggingMode => true)" -e "\"info-\"|\"NumericalImplicitization\" << NumericalImplicitization#\"test number\" << close" -e "exit 0" && gzip -nf9 /home/schwede/
ja/M2/M2/BUILD/build/usr-dist/common/share/info/NumericalImplicitization.info
-- making example results for numericalHilbertFunction
-- making example results for ConvertToCone
-- making example results for isOnImage
ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512; cd /tmp/M2-15785-0/4-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/home/schwede/M2Ninja/
/BUILD/build/usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("NumericalImpli
ation", Reload => true, FileName => "/home/schwede/M2Ninja/M2/M2/Macaulay2/packages/NumericalImplicitization.m2")' <"/tmp/M2-15785-0/1_is__On__Image.m2" >>"/home/schw
2Ninja/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/NumericalImplicitization/example-output/_is__On__Image.errors" 2>&1
/home/schwede/M2Ninja/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/NumericalImplicitization/example-output/_is__On__Image.errors:0:1: (output file) error: Ma
y2 killed by signal 9
/tmp/M2-15785-0/1_is__On__Image.m2:0:1: (input file)
M2: *** Error 9
-- making example results for NumericalInterpolationTable
-- making example results for numericalImageDim
-- making example results for PseudoWitnessSet
-- making example results for pseudoWitnessSet
ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512; cd /tmp/M2-15785-0/8-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/home/schwede/M2Ninja/
/BUILD/build/usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("NumericalImpli
ation", Reload => true, FileName => "/home/schwede/M2Ninja/M2/M2/Macaulay2/packages/NumericalImplicitization.m2")' <"/tmp/M2-15785-0/1_pseudo__Witness__Set.m2" >>"/ho
hwede/M2Ninja/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/NumericalImplicitization/example-output/_pseudo__Witness__Set.errors" 2>&1
/home/schwede/M2Ninja/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/NumericalImplicitization/example-output/_pseudo__Witness__Set.errors:0:1: (output file) er
Macaulay2 killed by signal 9
/tmp/M2-15785-0/1_pseudo__Witness__Set.m2:0:1: (input file)
M2: *** Error 9
-- making example results for extractImageEquations
-- making example results for numericalImageSample
-- making example results for numericalSourceSample
-- making example results for numericalImageDegree
ulimit -c unlimited; ulimit -t 700; ulimit -m 850000; ulimit -s 8192; ulimit -n 512; cd /tmp/M2-15785-0/12-rundir/; GC_MAXIMUM_HEAP_SIZE=400M "/home/schwede/M2Ninja
2/BUILD/build/usr-dist/x86_64-Linux-Ubuntu-20.04/bin/M2-binary" -q --int --no-randomize --no-readline --silent --stop --print-width 77 -e 'needsPackage("NumericalImpl
zation", Reload => true, FileName => "/home/schwede/M2Ninja/M2/M2/Macaulay2/packages/NumericalImplicitization.m2")' <"/tmp/M2-15785-0/1_numerical__Image__Degree.m2" >
me/schwede/M2Ninja/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/NumericalImplicitization/example-output/_numerical__Image__Degree.errors" 2>&1
/home/schwede/M2Ninja/M2/M2/BUILD/build/usr-dist/common/share/doc/Macaulay2/NumericalImplicitization/example-output/_numerical__Image__Degree.errors:0:1: (output file
or: Macaulay2 killed by signal 9
/tmp/M2-15785-0/1_numerical__Image__Degree.m2:0:1: (input file)
M2: *** Error 9
-- making example results for numericalNullity
currentString:1:1:(3):[2]: error: installPackage: 3 error(s) occurred running examples for package NumericalImplicitization
Could you attach the log, at least after [180/206]
or so and until the end? I'm wondering if this has to do with which packages must be installed before SumsOfSquares and NumericalImplicitization.
Also, could you try doing:
ninja uninstall-SumsOfSquares uninstall-NumericalImplicitization uninstall-NumericalAlgebraicGeometry
ninja install-SumsOfSquares install-NumericalImplicitization
What's the best way to grab the log? (Sorry for the dumb question).
Anyways, removing NumericalAlgebraicGeometry and installing SumsOfSquare and NumericalImplicitization worked with no errors.
What's the best way to grab the log? (Sorry for the dumb question).
Not a dumb question, because I don't think there's a great way other than just copy and pasting from the terminal. I guess it would be easier to paste it as a gist: https://gist.github.com/ instead of right here.
Anyways, removing NumericalAlgebraicGeometry and installing SumsOfSquare and NumericalImplicitization worked with no errors.
Hmm, this is such a Heisenbug.
BuildPackages-Output.zip
That file is the complete output of a clean ninja install-packages
.
Thanks! I'll look into this more, though I have no idea right now.
So I tried uninstalling all packages and then running
ninja install-SumsOfSquares install-NumericalImplicitization
No errors either...
I suppose we could modify the packages in question to produce more debugging output?
Is there any chance that there's some issue interacting with these third party programs simultaneously?
I'm not sure how the multi-threading package installation works. How do I reduce the number of threads it uses? (Although i guess I can control resources shared to WSL2).
Ninja has a -j
option to control the number of jobs. It might be useful to see if ninja -j1 install-packages
gives the same error or not.
If the issue is about the order in which the packages are installed, that would be a problem with the packages that should be fixed.
If the issue has to do with multiple programs using csdp at the same time, that would be detectable by running the same example multiple times in parallel as a test. I'll try this later.
Ok, so I have not tried the -j option yet. I will in the next day or two.
By the way, why these packages appearing towards the end of the install-packages command? If this is controlled by build.ninja, at least NumericalImplicitization should be running in the middle?
It's possible that they start in the middle, but those examples take a long time and in that time because of the parallelization other packages start and finish.
Maybe, but running them individually doesn't take a particularly long amount of time.
On Fri, Sep 18, 2020, 9:27 PM Mahrud Sayrafi notifications@github.com wrote:
It's possible that they start in the middle, but those examples take a long time and in that time because of the parallelization other packages start and finish.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Macaulay2/M2/issues/1503#issuecomment-695157551, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABQAMMOEP4AGMHPO43V45QDSGQQLJANCNFSM4RQYDVBA .
I'm getting more and more convinced that this has to do with #1456. There's a variety of reasons that might cause a bug never to appear with autotools. Maybe because of parallelization, maybe because for some libraries CMake uses a more recent version.
Unfortunately, I also have no idea where the shell unexpected syntax errors are coming from.
Actually, I think it might have to do with Ubuntu using dash instead of bash as /usr/bin/sh, as implied here. Do you know what shell you're using?
I'm using bash.
Just ran a clean build (master branch), using ninja -j1 install-packages
There were no errors.
Did you get any dash errors? (the unexpected "(" syntax errors)
Yes, I still did (in some of the same packages). Here's the full output. SingleThreadBuildOutput.zip
I still can't reproduce the syntax errors.
Without rebuilding, if you run ninja install-Macaulay2Doc
it should take less than two minutes, but there's a long pause (maybe 15 seconds) between the following two lines for me:
-- warning: method has no documentation: Macaulay2Doc :: part(ZZ,ZZ,Number), key (part,ZZ,ZZ,Number), package Macaulay2Doc
../../../../Macaulay2/packages/VectorGraphics.m2:437:31:(2):[56]: warning: local declaration of temp shields variable with same name
The first time the error occurs is between these two lines. Can you try doing this and seeing if you get the syntax error or not? In particular, can you tell me if there's a long pause before or after the error is printed? The error must be coming from some invocation of the system shell, but I can't figure out where that is happening.
Do you have either mosek, sdpa, bertini, hom4ps2, or phcpack installed or on your path? I ask because my suspicion is that something is going wrong with SemidefiniteProgramming, which is only loaded by SumsOfSquares (via PackageExports) and Macaulay2Doc (because there's a link to that package), which matches where the unexpected syntax errors appear.
By the way, you're running this from a normal terminal, right? (i.e., not vscode or something like that)
Also, is this just on top of development, or a different branch?
This is on the master branch. Should I be on development?
I am running in a normal terminal.
There is a pause of less than 5 seconds (maybe 3 seconds?) after the
-- warning: method has no documentation: Macaulay2Doc :: part(ZZ,ZZ,Number), key (part,ZZ,ZZ,Number), package Macaulay2Doc
I get no syntax errors on VectorGraphics. Should I switch to development?
I do not believe I have mosek, sdpa, bertini, hom4ps2, phcpack
installed. I still have conoir-csdp
installed though.
This is on the master branch. Should I be on development?
No, I was just making sure it's recent.
I get no syntax errors on VectorGraphics.
But did you get the sh: 1: Syntax error: "(" unexpected
errors?
@tom111 have you ever seen such an error related to SemidefiniteProgramming? Every occurrence of it seems to be related to that package, but also it only seems to occur on the CMake build, but I'm not able to reproduce it.
But did you get the
sh: 1: Syntax error: "(" unexpected
errors?@tom111 have you ever seen such an error related to SemidefiniteProgramming? Every occurrence of it seems to be related to that package, but also it only seems to occur on the CMake build, but I'm not able to reproduce it.
I've not seen those. But it might be that they are related to the recent changes in how external programs are called: https://github.com/Macaulay2/M2/pull/1447 (race conditions and such...)
Thank you! @d-torrance do you know if all csdp examples are run in the same directory or in the temporary directory of the respective example? That might explain the "killed" errors above. Also, does runProgram
call /usr/bin/sh
at any point? Seems like differences between bash/dash may be causing issues here.
Thank you! @d-torrance do you know if all csdp examples are run in the same directory or in the temporary directory of the respective example? That might explain the "killed" errors above.
SemidefiniteProgramming
creates its own temporary directory to run csdp
in:
The RunDirectory
option just tells us to cd
into the appropriate directory before running the program:
Also, does
runProgram
call/usr/bin/sh
at any point? Seems like differences between bash/dash may be causing issues here.
No, not directly. It just uses run
as seen above.
@jchen419 confirmed that this still seems to happen, exactly on the packages that I suspected:
[382/575] Getting package information for Macaulay2Doc
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
[404/575] Getting package information for StatePolytope
sh: 1: Syntax error: "(" unexpected
[544/575] Getting package information for SemidefiniteProgramming
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
[545/575] Getting package information for SumsOfSquares
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
Still no clue, other than this has to do with one of these packages being loaded!
I am also getting a bunch of messages: sh: 1: Syntax error: "(" unexpected Just from starting the program, and I installed the prebuilt setup (Ubuntu 18.04, running under wsl).
Note that every time your program uses libc "system(...)" it is going to try to run something with sh. The "sh: 1:" makes it quite likely that is where the errors are coming from.
I looked at what is going on with strace, and there are some crazy things going on during start up. For some reason it (or something it starts) even begins searching into my /mnt/c/... directories, which I do not appreciate. It also tries to execute "polymake" all over the place. These and other things I see during startup in the strace log are a bit worrying.
Then M2-binary itself has full scripts littered throughout. This program is a hodge-podge of weirdness.
What in the world is M2 trying to do when it starts up?
M2 does a lot of things upon startup. You can make it do fewer by adding -q
to the command line.
The program polymake is used by the package StatePolytope, and if StatePolytope is loaded, then it tries to tell whether polymake is installed on the system.
I am also getting a bunch of messages: sh: 1: Syntax error: "(" unexpected Just from starting the program, and I installed the prebuilt setup (Ubuntu 18.04, running under wsl).
Hmm, this would indicate that this is not necessarily related to CMake. Could you try running run("(echo test)")
? Or maybe similar commands suggested here. I think the issue with the errors is that on wsl sh is a symlink to dash, which is ever so slightly limited in what it understands.
What in the world is M2 trying to do when it starts up?
You can pass --notify
to see the files M2 reads or writes to.
Running with --no-preload --notify
all the messages show up here:
--loaded /usr/share/Macaulay2/SRdeformations.m2
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
--loaded /usr/share/Macaulay2/StatePolytope.m2
linking /bin/sh to bash instead of dash, I still get errors
--loaded /usr/share/Macaulay2/SRdeformations.m2
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/mnt/c/Program Files (x86)/Python37-32/Scripts/polymake --version >/dev/null 2>&1'
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/mnt/c/Program Files (x86)/Python37-32/polymake --version >/dev/null 2>&1'
sh: -c: line 0: syntax error near unexpected token `('
... and so on
So it is trying to run polymake all over the place, and it is not properly escaping file paths.
So with this in mind, we can produce a similar error on a normal Ubuntu (non WSL) system.
$ export PATH="/what (now) brown cow:$PATH"
$ M2 --no-preload --notify
...
--loaded /usr/share/Macaulay2/SRdeformations.m2
sh: 1: Syntax error: word unexpected (expecting ")")
--loaded /usr/share/Macaulay2/StatePolytope.m2
I don't really understand what is going on here. If the goal is to run a program and you are going to spawn shells, then let the shell resolve the path. It seems to be trying to "manually" resolve a path by spawning a ton of shells attempting to execute a file. If the goal is just to check a path, it would be better to just check for existence of an executable instead of spawning a shell and looking at the exit code.
Ahhhhh!! M2 isn't escaping the paths properly! That explains why this is specific to WSL, I guess none of us had a parenthesis in PATH on mac or linux systems. @d-torrance do your functions escape paths?
I'm not aware of the specifics of those packages, but I agree with you that such queries shouldn't happen automatically even when a package is loaded, let alone when --no-preload
is given! @DanGrayson do you know why this is happening?
I think this is in the code for "findProgram". It must be taking the members of the path, one at a time, and running a command to see if the program is there. Adding (single) quotation marks around the member of the path would help.
@d-torrance
@DanGrayson there is a separate issue though: why are any package files being read when --no-preload
is given?
Maybe add -q
also to the command line, to prevent it getting the headlines of all the packages for the index it makes.
I'll look into this. It might be useful having a function, similar to regexQuote
, that escapes special characters in paths for use by findProgram
and friends. One potential problem, based on my brief research so far, is these characters may not be consistent from shell to shell.
Just put single quotes around the whole thing.
But single quotes break other things -- in particular ~
for the home directory:
profzoom@peg-amy:~/tmp$ touch foo
profzoom@peg-amy:~/tmp$ ls ~/tmp/foo
/home/profzoom/tmp/foo
profzoom@peg-amy:~/tmp$ ls '~/tmp/foo'
ls: cannot access '~/tmp/foo': No such file or directory
Yes, keep an initial ~
out of quotes.
Environment variables also don't work with single quotes.
On Tue, Feb 16, 2021 at 7:34 PM Daniel R. Grayson notifications@github.com wrote:
Yes, keep an initial ~ out of quotes.
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Macaulay2/M2/issues/1503#issuecomment-780233638, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAYAPRW6SWMD6EZEXYQOHW3S7MMMBANCNFSM4RQYDVBA .
Environment variables also don't work with single quotes.
Not sure what you're referring to:
gallium$ export foo='a b'
gallium$ printenv foo
a b
They don't work with environment variables contained in paths:
profzoom@peg-amy:~/tmp$ ls $HOME/tmp/foo
/home/profzoom/tmp/foo
profzoom@peg-amy:~/tmp$ ls '$HOME/tmp/foo'
ls: cannot access '$HOME/tmp/foo': No such file or directory
They don't work with environment variables contained in paths:
profzoom@peg-amy:~/tmp$ ls $HOME/tmp/foo /home/profzoom/tmp/foo profzoom@peg-amy:~/tmp$ ls '$HOME/tmp/foo' ls: cannot access '$HOME/tmp/foo': No such file or directory
There would never be a literal $HOME
in the value of PATH
-- it would get expanded at assignment time. Otherwise it won't work as intended.
again, why are you even manually searching everything in the path if you are going to invoke a shell anyway, let the shell handle the path for you. You also don't need to deal with escaping paths this way.
again, why are you even manually searching everything in the path if you are going to invoke a shell anyway, let the shell handle the path for you. You also don't need to deal with escaping paths this way.
That's a good point. Doug? ( @d-torrance )
They don't work with environment variables contained in paths:
profzoom@peg-amy:~/tmp$ ls $HOME/tmp/foo /home/profzoom/tmp/foo profzoom@peg-amy:~/tmp$ ls '$HOME/tmp/foo' ls: cannot access '$HOME/tmp/foo': No such file or directory
There would never be a literal
$HOME
in the value ofPATH
-- it would get expanded at assignment time. Otherwise it won't work as intended.
Not in PATH
, no, but potentially the user could pass $HOME
or another environment variable to findProgram
using one of the other options (setting programPaths#"foo"
or with the AdditionalPaths
option).
A couple reasons for the current implementation:
PATH
, but a few others as well (/usr/lib/Macaulay2/bin
or wherever Macaualy2 installs any programs that were shipped with it, and as mentioned in the comment above, anything given in the programPaths
hash table and the AdditionalPaths
option to findProgram
).MinimumVersion
option is given, and so we want to avoid the case where, say, foo 1.0 is installed in /usr/local/bin
, but we really need foo 2.0, which is in /usr/bin
. If /usr/local/bin
appears before /usr/bin
in PATH
, then we'd end up calling the wrong version if we just blindly run foo
.I'm totally open to suggestions for improvement, though!
Hopefully this is fixed now with #1944. @kschwede let me know if you still run into this.
I'm having repeated errors when building documentation with Cmake Gninja. I don't have these issues when compiling these the classic way.
master branch, WSL2 + Ubuntu 20.04, AMD 3900x, WSL2 looks like it's using about 12 gigs of memory (out of 32).
Is something going on with the multi-threading of building documentation? Currently, the only errors I see are those at the end. I'm attaching (the not very helpful) example output errors here in a zip file. ErrorsFromBuild.zip Some of the example outputs simply say "Killed" at the end.
Weirdly, when I try re-running ninja install-packages at least the second time (and getting a different similar-looking error the first time), it completed without errors.
Finally, peridocally, in the terminal output, i also see sh: 1: Syntax error: "(" unexpected
Is this something I should be worried about?
(they don't seem to cause the compilation to fail)