-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Compiler does not recognize keywords in confess_at calls in XSP files #39
Comments
This is a known problem of Perl XS/XSP compilers on Windows. See the following e-mail I sent to the XS/XSP maintainers: I am trying to set up a development perl environment compiled from scratch with Visual Studio 2013 free C/C++ compiler. I stumbled over a following problem: If the XS file contains an INCLUDE_COMMAND call, this line is later stored as a comment into the generated XS.c file in a form of #line NUMBER "filepath". Here the "filepath" will be the complete parameter of INCLUDE_COMMAND. If the parameter contains escaped quotes, this breaks the FILE substitution in the visual studio C++ compiler. Here is an example of a #line inserted into XS.c, which the Visual Studio C++ has a problem with: #line 112 "c:\\wperl64d\\bin\\perl.exe -MExtUtils::XSpp::Cmd -e xspp -- -t "D:/src-perl/Slic3r/xs/xsp/typemap.xspt" "D:/src-perl/Slic3r/xs/xsp/Print.xsp"" If I remove the quotes from the INCLUDE_COMMAND call, the resulting form is swallowed by the Visual Studio compiler without any problem. #line 112 "c:\\wperl64d\\bin\\perl.exe -MExtUtils::XSpp::Cmd -e xspp -- -t D:/src-perl/Slic3r/xs/xsp/typemap.xspt D:/src-perl/Slic3r/xs/xsp/Print.xsp" I see the following ways to fix this problem:
Thanks for consideration, How exactly does it fail? What error message does it produce? What fails is the substitution of the FUNCTION macro, which is Microsoft's non-standard variant of the func macro defined by the C99 standard I believe. Visual Studio will fail to compile various asserts, which unfold the FUNCTION macro. I think what happens is the Visual Studio compiler somehow incorrectly interprets the quoting. The error message given by the compiler is confusing at least and it was quite hard to pinpoint it to the quotes in the #line. |
So, I'll confess I know absolutely nothing about Perl or XS/XSP (it should be obvious), but it looks like the problem is with both of the string-related keywords (FILE and FUNCTION). I replaced the CONFESS macro with four lines, each of the first three has a single keyword (FILE, etc.) with literals for the other actual parameters; the fourth has literals for all four actual parameters. The two sets of error messages below are for the first and third lines (FILE and FUNCTION). The second and fourth lines (LINE) and no keywords both compiled successfully. Here is the block of code from xs\xsp\Config.xsp, starting at line 43, with the CONFESS macro statement replaced with four statements to isolate the issue (near the bottom of the snippet):
|
You need to edit |
BTW, how do you generate an exe, rather than a perl script for this? |
You are welcome. No problem, I am actually happy that someone was able to On Tue, Nov 22, 2016 at 4:22 PM, bwbeall notifications@github.com wrote:
|
Version
1.31.6
Operating system type + version
Windows 10.0.14393 Pro x64
VS 2013 Version 12.0.40629.00 Update 5
NET Framework 4.6.01586
Behavior
I am building prusa3d/slic3r using the 1.31.6, and I am getting errors in statements that use the CONFESS macro. For example, in Config.xsp, the following code:
generates the following error messages:
Slic3r-master/xs/xsp/Config.xsp"(395) : error C2146: syntax error : missing ')' before identifier 'C'
Slic3r-master/xs/xsp/Config.xsp"(395) : error C2660: 'confess_at' : function does not take 1 arguments
Slic3r-master/xs/xsp/Config.xsp"(395) : error C2059: syntax error : ')'
Basically, the problem is the keywords FILE, LINE, and FUNCTION are not being recognized by the build process. When I replace the "CONFESS" statement with:
confess_at( FILE, LINE, FUNCTION, "This StaticConfig object does not provide get_extrusion_axis()");
I get the same errors, but when I replace it with:
confess_at( "FILE", 1, "FUNCTION", "This StaticConfig object does not provide get_extrusion_axis()");
there are no error messages generated. The same problem also occurs in GCode.xsp, TriangleMesh.xsp, Geometry.xsp, and Line.xsp. Oddly enough, this only happens on one of my two build computers (which are both substantially the same).
The text was updated successfully, but these errors were encountered: