At last I was able to build OSG without disrupting my PC environment!
After failed attempts with Cygwin and VS6 I succeeded with MINGW.
Here I want to share my "cookbook" and to point to some fixes that could be included in 1.2-released. My Environment is: WinXP, OSG 1.2-rc1. Remember that I have already Cygwin installed, so change the points 3 and 4 accordingly. Small corrections needed to OSG are in point 9. Corrections that need some more work besides my quick and dirty workaround in 11-14, a strange linker problem in 16 and the evergreen WorkCrew crash in 7. Feel free to add comments and corrections; after maybe I can also update the MINGW build page on the site.
Now the real work starts...

                                       mario

1) Download from Sourceforge MinGW-5.0.3.exe and install binutils, gcc and make. Select a destination directory without spaces in it
(so forget C:\Program Files)

2) Download from sourceforge MSYS-1.0.11-2004.04.30-1.exe and install it. Again select a destination directory without spaces in it.
I have used C:/MinGW and C:/MSYS

3) Edit /etc/profile and put MinGW and MSYS bin directories in the path before the Cygwin ones
PATH=/cygdrive/c/msys/bin:/cygdrive/c/MinGW/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:$PATH
export PATH
For Cygwin this is C:\Program Files\cygwin\etc\profile

4) From the control panel select System->Advanced->Environment Variables and edit the Path variable (using the marvelous user
interface provided :-)). Put the bin directories in the following order:
C:\msys\bin;C:\MinGW\bin;C:\Program Files\cygwin\bin
Restart windows (im my case after changing /etc/profile, the Cygwin make and uname were picked if no reboot)

5) Install the following packages (the full installer ones) under d:/gnuwin32 for example

freetype 2.1.10, jpeg 6b-4, libpng 1.2.8, libungif 4.1.4, tiff 3.8.2-1, zlib-1.2.3

List and location is on http://www.openscenegraph.org/osgwiki/pmwiki.php/Downloads/Dependencies
Copy the DLL from the various bin directories to C:/MinGW/bin

6) Edit the following script and source it in the shell used for build OSG. It seems necessary to specify the paths as /d/blabla and
not as /cygdrive/d/blabla (as with Cygwin)

export OSG_ROOT=/d/OSG_OP_OT-1.2-rc2
export BSD_ROOT=/d/gnuwin32

export OPENTHREADS_INC_DIR=$OSG_ROOT/OpenThreads/include
export OPENTHREADS_LIB_DIR=$OSG_ROOT/OpenThreads/lib/MINGW32
export PRODUCER_INC_DIR=$OSG_ROOT/Producer/include
export PRODUCER_LIB_DIR=$OSG_ROOT/Producer/lib/MINGW32
export COMPILE_EXAMPLES=yes
export COMPILE_INTROSPECTION=no

export FREETYPE_INCLUDE=$BSD_ROOT/freetype/include
export FREETYPE_LIB=$BSD_ROOT/freetype/lib
export PATH=${PATH}:$BSD_ROOT/freetype/bin

export JPEG_INCLUDE=-I$BSD_ROOT/jpeg/include
export JPEG_LIB="-L$BSD_ROOT/jpeg/lib -ljpeg"

export GIF_INCLUDE=-I$BSD_ROOT/libungif/include
export GIF_LIB=$BSD_ROOT/libungif/lib

export TIFF_INCLUDE=-I$BSD_ROOT/tiff/include
export TIFF_LIBS=$BSD_ROOT/tiff/lib

export PNG_INCLUDE=-I$BSD_ROOT/libpng/include
export PNG_LIB=$BSD_ROOT/libpng/lib

export OSG_INC_DIR=$OSG_ROOT/OpenSceneGraph/include
export OSG_LIB_DIR=$OSG_ROOT/OpenSceneGraph/lib/MINGW32

7) cd OpenThreads; make
To test the examples: cd examples_src; make
WorkCrew again crash and burns...

8) cd ../Producer

9) Edit Make/makedefs line 424 and append -mnop-fun-dllimport to DEF
make. to build the examples cd Test; make. The compilation fail on Trackball that needs OSG built first (see 16)

10) Under the installed freetype edit bin/freetype-config and change line 12 to be (no D:/gnuwin32.... it confound dependency tracking)
prefix=/d/gnuwin32/freetype

And around line 144 edit the line to be:
libs="-L$libdir -lfreetype -lz -Wl,-s -liberty -lwsock32 -lole32 -luuid -lmsvcp60 "

11) For the jpeg plugin
edit $OSG_ROOT\OpenSceneGraph\src\osgPlugins\jpeg\GNUMakefile and change JPEG_LIBS to JPEG_LIB
(the former for some reason is not overriden by the script definition)

12) For the gif plugin edit $OSG_ROOT\OpenSceneGraph\src\osgPlugins\gif\GNUmakefile to contain

ifeq ($(OS),HP-UX)
INC   += $(GIF_INCLUDE)
else
INC   += $(GIF_INCLUDE)

LINKARGS += -L$(GIF_LIB)
endif

13) For the tiff plugin edit $OSG_ROOT\OpenSceneGraph\src\osgPlugins\tiff\GNUMakefile to contain
ifeq ($(OS),HP-UX)
INC     += $(TIFF_INCLUDE)
else
INC     += $(TIFF_INCLUDE)
#LDFLAGS += -L$(TIFF_LIBS)
LINKARGS += -L$(TIFF_LIBS) $(JPEG_LIB)
endif

14) For the png plugin edit$ OSG_ROOT\OpenSceneGraph\src\osgPlugins\png\GNUMakefile to contain
ifneq ($(OS),HP-UX)
INC  += $(PNG_INCLUDE)

LINKARGS += -L$(PNG_LIB)
else
INC += $(PNG_INCLUDE)
endif

15) cd OpenSceneGraph; make

16) to build the Producer Trackball example modify the GNUMakefile as:

LIBS = \
-L$(OSG_LIB_DIR) -losgProducer -losgDB -losgGA -losgText -losgUtil -losg \
   -lProducer -lOpenThreads

INC      += -I$(OSG_INC_DIR)

But linker complains that cannot find -losgProducer. Strange.

--
Ing. Mario Valle
Visualization Group                              | http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to