and pasted it onto PGLabs, I got a massive error message:
Can't locate macro file |parserOrientation.pl| via path: |.|, |/opt/webwork/courses/wikiExamples/templates/macros|, |/opt/webwork/pg/macros|, |/opt/webwork/courses/wikiExamples/templates/Library/macros/Union|, |/opt/webwork/courses/wikiExamples/templates/Library/macros/Michigan|, |/opt/webwork/courses/wikiExamples/templates/Library/macros/CollegeOfIdaho|, |/opt/webwork/courses/wikiExamples/templates/Library/macros/FortLewis|, |/opt/webwork/courses/wikiExamples/templates/Library/macros/TCNJ|, |/opt/webwork/courses/wikiExamples/templates/Library/macros/NAU|, |/opt/webwork/courses/wikiExamples/templates/Library/macros/Dartmouth| at /opt/webwork/pg/lib/PGloadfiles.pm line 338.
Could anyone explain to me what is going on?
When a macro file (such as parserOrientation.pl) is loaded into a problem with loadMacros(), the system looks in a few different places for that file:
1) the directory containing the pg file (this is where instructors can put custom macro files used only in a single set)
2) the [course]/templates/macros directory (this is where instructors can put custom macro files used in many sets in a course)
3) the Library/macros directory (this is where NPL authors put custom macro files used in many of the problems they write for the NPL)
4) the pg/lib/macros directory (this is where webwork developers put macro files for general use)
The error you saw is due to the fact that parserOrientation.pl is a custom macro which comes with the Orientation problem set (case 1), so, in a standard installation, you can't use it outside of the Orientation problem set. (Of course, if you wanted to use it in other sets in your course, you could just move or copy it to your [course]/templates/macros directory.
Hope this helps,
Oops - yes, I meant pg/macros for (4). As far as I'm aware your second question has no precedent, especially when it comes to C code; maybe Mike or Arnie have an opinion about where it should go. Maybe for you NAU/macros and NAU/lib would make the most sense.
I'm intrigued by your mention of C code that needs to be compiled, and I'd be interested to know what you're using it for - it sounds like you're doing pretty interesting stuff. It does make the question of how to distribute the problems a bit harder though.
Are you packaging the perl modules that need the compiled C code with some kind of standard perl build tool (e.g. Module::Build or ExtUtils::MakeMaker)? That would at least make it safe to assume that they could be installed without too much trouble on a system that webwork is installed on.
So for this to work, I need three things:
Chromatic.pm loaded in global.conf
Chromatic.pm could be changed to compile color.c automatically if needed. This would make the installation a bit easier.
Perhaps there is an easier way now but this was the only solution in 2005. I think this is intentionally hard because of safety considerations.
We're open to suggestions of things that would make it easier.
We could also include Chromatic.pm as part of the standard distribution,
but we would have to figure out some way to compile color.c on each
computer or give specific instructions for doing so. This might not
be too hard.
So far Chromatic is the first and only PG extension that has required C
We could also allow a search for .pm files in the NationalProblemLibrary.
For safety reasons I think it would still be best if allowing these modules
had to be explicitly done in global.conf or course.conf.
(That's not all that much safety however.)
Chromatic.pm can be easily changed so it checks for the existence of the compiled executable and if it's not there, then it creates it with gcc -O3 color.c. The only problem is that gcc may not be installed.
WeBWorK has encountered warnings while processing your request. If this occured when viewing a problem, it was likely caused by an error or ambiguity in that problem. Otherwise, it may indicate a problem with the WeBWorK system itself. If you are a student, report these warnings to your professor to have them corrected. If you are a professor, please consult the warning output below for more information.
ERROR: Unable to compile /opt/webwork/pg/lib/chromatic/color.c. at /opt/webwork/pg/lib/Chromatic.pm line 18.
The command /usr/bin/gcc -O3 -o /opt/webwork/pg/lib/chromatic/color /opt/webwork/pg/lib/chromatic/color.c failed at /opt/webwork/pg/lib/Chromatic.pm line 19.
Chromatic.pm and a compiled version of color.c are required for this problem at /opt/webwork/pg/lib/Chromatic.pm line 20.
The file color.c will need to be compiled by a systems administrator. at /opt/webwork/pg/lib/Chromatic.pm line 21.
Can't write into directory /opt/webwork/pg/lib/chromatic at /opt/webwork/pg/lib/Chromatic.pm line 23.
|Time||Tue Nov 19 10:41:43 2013|
New script that will set permissions for all files.
- In particular the directory pg/lib/chromatic needs to have write permissions for the server since the C code color is compiled into it.
- To set all of the file permissions in webwork use
sudo -E /opt/webwork/webwork2/bin/setfilepermissions