(Note - copied from Tom Smiths' page: http://smittypaddler.com/cds/cdm/perlvrml/intro.htm)
VRML (Virtual Reality Modeling Language) is a simple language written in plain text which can be used to create 3d objects that you can rotate and zoom in and out on using a viewer. Using perl to generate VRML output lets you use iteration and arithmetic calculations. As you'll see in the samples, I've used it to do mechanical drawing in 3d.
The biggest drawback to VRML is that there aren't many viewers for Linux. I prefer vrmlview, but I don't have the source, so each new release of Linux or its libraries, I say a little prayer, hoping vrmlview will still work. I've used freewrl in the past, and I'm in the process of installing it on Linux Fedora Core 13. It's a bear to install. Here's my install log on Fedora Core 13. I encourage you to read it entirely before trying to install it on your system, as I made many mistakes, and had to backtrack often:
FreeWRL downloaded from -
http://www.tailwind-live.org/freewrl/
http://rpm.pbone.net/index.php3/stat/4/idpl/4126710/dir//com/bitstream-vera-fonts-1.10-0.fdr.14.noarch.rpm.html
mkdir /contrib/freewrl
cd /contrib/freewrl
# download
mkdir -p /usr/X11R6/bin
ln -s /usr/bin/mkfontdir /usr/X11R6/bin/mkfontdir
ln -s ? /usr/sbin/chkfontpath
rpm -Uvh freewrl-1.22.3-1.i386.rpm \
bitstream-vera-fonts-1.10-0.fdr.14.noarch.rpm
No joy. Couldn't find chkfontpath, and the symlink didn't work.
So then I downloaded the source and tried -
cd /contrib/freewrl
# download
bunzip2 -c freewrl-1.22.8.tar.bz2 | tar xvf -
cd freewrl-1.22.8
./configure
Says it needs zlib.h, so I yummed zlib-devel and tried again.
yum -y install zlib-devel
Complains it needs freetype2. I tried downloading freetype-2.3.12,
which supposedly contains freetype2; nope.
mkdir /contrib/freetype2
cd /contrib/freetype2
# download
tar xzvf freetype-2.3.12.tar.gz
cd freetype-2.3.12
./configure
I didn't see freetype2 anywhere in the build directories, so I didn't
do make install. I got a suggestion from freewrl-devel mail list to
install freetype-devel:
yum install freetype-devel
cd /contrib/freewrl/freewrl-1.22.8
./configure
configure: error: Unable to find an appropriate javascript engine
One of the ones it looked for was seamonkey-js, so I did -
yum install seamonkey
./configure
Didn't help; still can't find an appropriate JAVASCRIPT_ENGINE.
I now have two installed:
$ yum list installed seamonkey rhino
Loaded plugins: presto, refresh-packagekit
Installed Packages
rhino.noarch 1.7-0.7.r2.fc12 @anaconda-InstallationRepo-201005130056.i386
seamonkey.i686 2.0.5-1.fc13 @updates
yum -y install xulrunner-devel
The above installed 76 packages.
cd /contrib/freewrl/freewrl-1.22.8
./configure
configure: error: Can't find expat.h. Please install expat.
yum -y install expat
Package expat-2.0.1-10.fc13.i686 already installed and latest version
Nothing to do
yum -y install expat-devel
./configure
checking for XAW... configure: error: Package requirements
(xproto x11 xt xmu xaw7) were not met:
No package 'xmu' found
No package 'xaw7' found
yum -y install xmu xmu-devel xaw7 xaw7-devel
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
No package xmu available.
No package xmu-devel available.
No package xaw7 available.
No package xaw7-devel available.
Nothing to do
yum -y install libXmu-devel
yum -y install libXaw-devel
cd /contrib/freewrl/freewrl-1.22.8
./configure
checking for IMLIB2... configure: error: Package requirements
(imlib2) were not met:
yum -y install imlib2
./configure
checking for IMLIB2... configure: error: Package requirements
(imlib2) were not met:
yum -y install imlib2-devel
./configure
Success!
make
---------------------------------------------------------------------
make all-recursive
make[1]: Entering directory `/contrib/freewrl/freewrl-1.22.8'
Making all in src
make[2]: Entering directory `/contrib/freewrl/freewrl-1.22.8/src'
Making all in lib
make[3]: Entering directory `/contrib/freewrl/freewrl-1.22.8/src/lib'
CC main.lo
In file included from main.c:33:
./display.h:75:19: error: GL/gl.h: No such file or directory
./display.h:76:20: error: GL/glu.h: No such file or directory
./display.h:77:22: error: GL/glext.h: No such file or directory
./display.h:78:20: error: GL/glx.h: No such file or directory
In file included from main.c:33:
./display.h:146: error: expected specifier-qualifier-list before ‘GLuint’
In file included from main.c:33:
./display.h:271: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘GLcx’
./display.h:331: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘_global_gl_err’
In file included from main.c:39:
./resources.h:180: warning: ‘struct textureTableIndexStruct’ declared inside parameter list
./resources.h:180: warning: its scope is only this definition or declaration, which is probably not what you want
make[3]: *** [main.lo] Error 1
make[3]: Leaving directory `/contrib/freewrl/freewrl-1.22.8/src/lib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/contrib/freewrl/freewrl-1.22.8/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/contrib/freewrl/freewrl-1.22.8'
make: *** [all] Error 2
---------------------------------------------------------------------
yum -y install mesa-libGL-devel
./configure
make
---------------------------------------------------------------------
make all-recursive
make[1]: Entering directory `/contrib/freewrl/freewrl-1.22.8'
Making all in src
make[2]: Entering directory `/contrib/freewrl/freewrl-1.22.8/src'
Making all in lib
make[3]: Entering directory `/contrib/freewrl/freewrl-1.22.8/src/lib'
CC main.lo
In file included from main.c:33:
./display.h:76:20: error: GL/glu.h: No such file or directory
In file included from main.c:39:
./resources.h:180: warning: ‘struct textureTableIndexStruct’ declared inside parameter list
./resources.h:180: warning: its scope is only this definition or declaration, which is probably not what you want
make[3]: *** [main.lo] Error 1
make[3]: Leaving directory `/contrib/freewrl/freewrl-1.22.8/src/lib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/contrib/freewrl/freewrl-1.22.8/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/contrib/freewrl/freewrl-1.22.8'
make: *** [all] Error 2
---------------------------------------------------------------------
yum whatprovides '*glu.h'
yum -y install mesa-libGLU-devel
cd /contrib/freewrl/freewrl-1.22.8
./configure
make
---------------------------------------------------------------------
x3d_parser/X3DParser.c: In function ‘initializeX3DParser’:
x3d_parser/X3DParser.c:1673: warning: implicit declaration of function ‘XML_ParserCreate’
x3d_parser/X3DParser.c:1673: warning: assignment makes pointer from integer without a cast
x3d_parser/X3DParser.c:1674: error: too many arguments to function ‘XML_SetElementHandler’
x3d_parser/X3DParser.c:1676: error: too many arguments to function ‘XML_SetDefaultHandler’
x3d_parser/X3DParser.c: In function ‘X3DParse’:
x3d_parser/X3DParser.c:1742: warning: implicit declaration of function ‘XML_ErrorString’
x3d_parser/X3DParser.c:1743: warning: format ‘%s’ expects type ‘char *’, but argument 3 has type ‘int’
make[3]: *** [x3d_parser/X3DParser.lo] Error 1
make[3]: Leaving directory `/contrib/freewrl/freewrl-1.22.8/src/lib'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/contrib/freewrl/freewrl-1.22.8/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/contrib/freewrl/freewrl-1.22.8'
make: *** [all] Error 2
---------------------------------------------------------------------
cd /contrib/freewrl/freewrl-1.22.8/
mkdir src/lib/include
cp /usr/include/expat.h src/lib/include
./configure --with-expat=/contrib/freewrl/freewrl-1.22.8/src/lib/include
make
Same errors:
---------------------------------------------------------------------
x3d_parser/X3DParser.c:1674: error: too many arguments to function ‘XML_SetElementHandler’
x3d_parser/X3DParser.c:1676: error: too many arguments to function ‘XML_SetDefaultHandler’
---------------------------------------------------------------------
cd /contrib/freewrl/freewrl-1.22.8/
cp /contrib/slicer/Slicer3-3.6-2010-06-10-linux-x86/include/InsightToolkit/Utilities/expat/expat.h src/lib/include
./configure --with-expat=/contrib/freewrl/freewrl-1.22.8/src/lib/include
make > make.out 2>&1
Same errors, but I noticed it was still including
/usr/include/xulrunner-sdk-1.9.2/expat.h:
---------------------------------------------------------------------
...
make[3]: Entering directory `/contrib/freewrl/freewrl-1.22.8/src/lib'
CC x3d_parser/X3DParser.lo
In file included from x3d_parser/X3DParser.c:57:
/usr/include/xulrunner-sdk-1.9.2/expat.h:140: error: expected specifier-qualifier-list before ‘XML_Char’
...
x3d_parser/X3DParser.c:1674: error: too many arguments to function ‘XML_SetElementHandler’
x3d_parser/X3DParser.c:1676: error: too many arguments to function ‘XML_SetDefaultHandler’
---------------------------------------------------------------------
So I tried:
backupfile /usr/include/xulrunner-sdk-1.9.2/expat.h
# created /usr/include/xulrunner-sdk-1.9.2/expat.h.d100711.t164021
cp /usr/include/expat.h /usr/include/xulrunner-sdk-1.9.2/expat.h
./configure
make # same errors
cp /contrib/slicer/Slicer3-3.6-2010-06-10-linux-x86/include/InsightToolkit/Utilities/expat/expat.h /usr/include/xulrunner-sdk-1.9.2/expat.h
cp /contrib/slicer/Slicer3-3.6-2010-06-10-linux-x86/include/InsightToolkit/Utilities/expat/expatDllConfig.h /usr/include/xulrunner-sdk-1.9.2
make
but this produced this error -
---------------------------------------------------------------------
make[3]: Entering directory `/contrib/freewrl/freewrl-1.22.8/src/lib'
CC x3d_parser/X3DParser.lo
x3d_parser/X3DParser.c: In function ‘X3DParse’:
x3d_parser/X3DParser.c:1739: error: ‘XML_STATUS_ERROR’ undeclared (first use in this function)
---------------------------------------------------------------------
which is only correctible by including expat.h
in /usr/include/xulrunner-sdk-1.9.2:
---------------------------------------------------------------------
[root@kestrel freewrl-1.22.8]# grep XML_STATUS_ERROR /usr/include/xulrunner-sdk-1.9.2/expat.h.d100711.t164021
#define XML_STATUS_ERROR 0
XML_STATUS_ERROR = 0,
#define XML_STATUS_ERROR XML_STATUS_ERROR
have standalone="yes". If this handler returns XML_STATUS_ERROR,
The handler should return XML_STATUS_ERROR if processing should not
Otherwise it must return XML_STATUS_ERROR.
has no effect and returns XML_STATUS_ERROR.
argument will be copied. Returns XML_STATUS_ERROR if out of memory,
/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is
Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise.
return XML_STATUS_ERROR with error code XML_ERROR_ABORTED.
/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then
or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then
[root@kestrel freewrl-1.22.8]#
---------------------------------------------------------------------
cd /contrib/freewrl/freewrl-1.22.8/
cp /usr/include/xulrunner-sdk-1.9.2/expat.h.d100711.t164021 \
/usr/include/xulrunner-sdk-1.9.2/expat.h
cp /usr/include/expat.h src/lib/include
cp /usr/include/expat_external.h src/lib/include
./configure --with-expat=/contrib/freewrl/freewrl-1.22.8/src/lib
make > make2.out 2>&1
Got this error:
---------------------------------------------------------------------
/usr/bin/ld: cannot find -lGLEW
---------------------------------------------------------------------
yum -y install glew glew-devel
make > make3.out 2>&1
Worked.
make check > makecheck.out 2>&1
make install > makeinstall.out 2>&1
make installcheck > makeinstallcheck.out 2>&1
Updated /usr/local/bin/changelog
Finis
My e-mail address is smitty@smittypaddler.com.