Comments (9)
We are still trying to reproduce and track down this strange bug. You can follow the discussion here:
https://sourceforge.net/p/asymptote/discussion/409349/thread/76353ab0/
from asymptote.
Hello John,
regarding garbage collector, I stayed with the version included in "asymptote-2.41.src.tgz". It is "gc-7.6.0.tar.gz". The system has version 7.2d installed (both at work and at home).
I can do builds on my machine at home with gc-7.6.0.tar.gz and gc-7.6.2.tar.gz. I will come back to you, when I have done them.
bernie
from asymptote.
What I would first suggest is:
make clean
./configure --disable-gc
make all
from asymptote.
Hello John,
meanwhile I did three builds with different settings for Boehm-Demers-Weiser garbage collector on my machine at home (RHEL 7.3). Before building, I checked for missing libraries by means of:
$ ./configure | grep ’compile without’
Afterwards I added gsl-devel, fftw-devel, mesa-libOSMesa and mesa-libOSMesa-devel via yum to the system. Additionally, I downloaded gc-7.6.2.tar.gz and put it into the folder where the source archive was unpacked to.
The builds where done with three different configurations. The first one was without gc as you suggested:
$ ./configure --disable-gc
$ make all
the second one with gc-7.6.0:
$ make clean
$ ./configure
$ make all
and the third one with gc-7.6.2:
$ make clean
$ ./configure --enable-gc=7.6.2
$ make all
In all three cases the build stops, when processing diatom.asy due to the "additional %". Your suggestion on inserting
if(*format == "%") return "";
into the function string format(string *format, bool forcemath=false, string separator, real x, string locale=emptystring)
of runstring.in helps. Indeed, it would be nice to find the real cause.
How can I debug the C++ code behind asymptote? The chapter about debugging in the manual refers to processing *.asy-files only, doesn't it?
bernie
from asymptote.
For the TeXLive release, I've decided to add temporarily the line
if(*format == "%") return "";
patch but it is probably masking the real problem here.
Yes, the debugging discussed in the manual is for asy files. In this case the easiest way to debug
is probably (without the above patch) to insert cout statements like this in the code and send me the output of
asy -c "format('%',1.0)"
:
cout << "1: " << "[" << p << "]" << endl;
const char *tail=p;
string f=format->substr(start-p0,tail-start);
const char *oldlocale=NULL;
if(!locale.empty()) {
oldlocale=setlocale(LC_ALL,NULL);
if(oldlocale) oldlocale=StrdupNoGC(oldlocale);
setlocale(LC_ALL,locale.c_str());
}
cout << "2: " << "[" << f << "]" << endl;
Int size=snprintf(NULL,0,f.c_str(),x)+1;
if(size < 1) size=255; // Workaround for non-C99 compliant systems.
char *buf=new char[size];
snprintf(buf,size,f.c_str(),x);
cout << "3: " << "[" << buf << "]" << endl;
Aside: The GNU debugger for c++ is called gdb. There is also a useful tool for checking for segmentation faults called valgrind. When using such tools you should normally disable garbage collection and debugging:
./configure --disable-gc
make clean
make CFLAGS=-g
gdb asy
run
from asymptote.
Hello John,
as asymptote 2.44 is available, I did the build with the sources of this version. I added the extra cout
-statements as indicated above to the file runstring.in
. Furthermore the extra if
-statement of the "workaround" was commented out.
As expected the build stops at the processing of diatom.asy
. For testing the output within the folder, where I did $ make all
, I used:
$ ./asy -dir ./base -config "" -c "format('%',1.0)"
(no $ sudo make install
!).
The output is the following four lines:
1: []
2: [%]
3: [%]
%
So here the function call of snprintf(buf,size,f.c_str(),x);
does not result in what would be expected?
bernie
from asymptote.
Exactly; the problem is with snprintf on your system. To be fair, the man page for snprintf doesn't
explicitly specify the behaviour for the format string "%". Now let's test a few more possibilities:
./asy -dir ./base -config "" -c "format('% ',1.0)"
./asy -dir ./base -config "" -c "format('% %',1.0)"
./asy -dir ./base -config "" -c "format('% %%',1.0)"
./asy -dir ./base -config "" -c "format('% %%g',1.0)"
Thanks!
from asymptote.
Hello John,
output of ./asy -dir ./base -config "" -c "format('% ',1.0)"
:
1: []
2: [% ]
3: [% ]
%
output of ./asy -dir ./base -config "" -c "format('% %',1.0)"
:
1: []
2: [% %]
3: [%]
%
output of ./asy -dir ./base -config "" -c "format('% %%',1.0)"
:
1: []
2: [% %%]
3: [%%]
%%
output of ./asy -dir ./base -config "" -c "format('% %%g',1.0)"
:
1: []
2: [% %%g]
3: [%1]
%1
bernie
from asymptote.
For comparison, here is what I get on fc28 with gcc-8.1.1. The results of the first and third examples differ:
./asy -dir ./base -config "" -c "format('% ',1.0)"
1: []
2: [% ]
3: []
./asy -dir ./base -config "" -c "format('% %',1.0)"
1: []
2: [% %]
3: [%]
%
./asy -dir ./base -config "" -c "format('% %%',1.0)"
1: []
2: [% %%]
3: [%]
%
./asy -dir ./base -config "" -c "format('% %%g',1.0)"
1: []
2: [% %%g]
3: [%1]
%1
from asymptote.
Related Issues (20)
- Postscript error creating svg with libgs.so.10.02 HOT 4
- svg breakage with gs-10.03.0 HOT 1
- asy-latex one line processing
- Linking error on macOS with clang: `Undefined symbols for architecture x86_64: "_add_history"` etc. HOT 5
- Can’t compile LSP – <boost/filesystem/directory.hpp> missing from LspCpp/src/lsp/utils.cpp HOT 1
- Algolia DocSearch integration?
- Defining struct in a loop gives confusing error message HOT 1
- Feature request: Convert tab to 4 [/8] spaces in error message reporting
- Feature request: `var oldAsin=asin;` copies the function HOT 2
- Bug: unitsize() does not work to set unitsize of other pictures HOT 2
- Feature suggestion: automatic generation of constructor HOT 1
- Documentation of cputime is in Structure section? HOT 1
- Feature suggestion: shorthand to create a picture HOT 9
- Feature suggestion: Remove `add(picture dest, picture src, pair position)` variant as it's dangerous HOT 4
- Stack traceback on error?
- Suggestion: integrate with Typst? HOT 3
- Suggestion: `envelope` type don't need `above` passed in HOT 1
- Why does the bounding box of a frame containing just a label not just the label's bounding box? HOT 1
- Suggestion: transformations for shading tools? HOT 1
- Feature suggestion: baseline specification for inclusion in LaTeX HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asymptote.