I need to compile the C4.5 decision tree software into a Windows
executable. The source code is freely available from:
http://www.rulequest.com/Personal/c4.5r8.tar.gz
I have modified the makefile to use Microsoft's CL compiler by
removing the CC compiler options that were present, and changing all o
extensions to obj. Here is the current makefile:
================================================
# Macros
CC=cl
# Definitions of file sets
core.ln = \
getnames.ln getdata.ln trees.ln getopt.ln header.ln
trees.ln = \
besttree.ln build.ln info.ln discr.ln contin.ln subset.ln\
prune.ln stats.ln st-thresh.ln classify.ln confmat.ln\
sort.ln $(core.ln)
rules.ln = \
rules.ln genlogs.ln genrules.ln makerules.ln prunerule.ln\
siftrules.ln testrules.ln stats.ln confmat.ln sort.ln $(core.ln)
core = \
getnames.obj getdata.obj trees.obj getopt.obj header.obj
trees = \
besttree.obj build.obj info.obj discr.obj contin.obj subset.obj prune.obj\
stats.obj st-thresh.obj classify.obj confmat.obj sort.obj $(core)
rules = \
rules.obj genlogs.obj genrules.obj makerules.obj prunerule.obj\
siftrules.obj testrules.obj stats.obj confmat.obj sort.obj $(core)
# C4.5 decision tree generator
c4.5: c4.5.obj $(trees)
$(CC) c4.5.obj $(trees)
# C4.5 production rule generator
c4.5rules: c4.5rules.obj $(rules)
$(CC) c4.5rules.obj $(rules)
# C4.5 decision tree interpreter
consult: consult.obj userint.obj $(core)
$(CC) consult.obj userint.obj $(core)
# C4.5 production rule interpreter
consultr: consultr.obj rules.obj userint.obj $(core)
$(CC) consultr.obj rules.obj userint.obj $(core)
# Generic target for remaining files
.c.obj:
$(CC) -c $<
# Make everything
clean:
rm -rf *.obj *.exe
all:
make c4.5
make c4.5rules
$(trees): defns.i types.i extern.i
$(rules): defns.i types.i extern.i
================================================
To attempt to build the executable, I open cygwin (so I can use make),
browse to the source directory, and type 'make'. Here is the output I
get:
================================================
cl c4.5.obj besttree.obj build.obj info.obj discr.obj contin.obj
subset.obj prune.obj stats.obj st-thresh.obj classify.obj confmat.obj
sort.obj getnames.obj getdata.obj trees.obj getopt.obj header.obj
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
/out:c4.5.exe
c4.5.obj
besttree.obj
build.obj
info.obj
discr.obj
contin.obj
subset.obj
prune.obj
stats.obj
st-thresh.obj
classify.obj
confmat.obj
sort.obj
getnames.obj
getdata.obj
trees.obj
getopt.obj
header.obj
besttree.obj : error LNK2019: unresolved external symbol _random
referenced in function _Shuffle
c4.5.exe : fatal error LNK1120: 1 unresolved externals
================================================
So it looks like things are grinding to a hault at the 'c4.5' target.
A function in besttree.c is calling random(), which is included
through extern.i -> math.h. I figured this was simply a path problem,
and made sure all the appropriate environment variables were set
properly. I can't see anything wrong, although I'm not entirely sure
how cygwin might be affecting things. Here's a printout from env -
I've substituted <username> for my actual user name:
================================================
HOMEPATH=\Documents and Settings\<username>
MANPATH=/usr/local/man:/usr/share/man:/usr/man::/usr/ssl/man
APPDATA=W:\Documents and Settings\<username>\Application Data
HOSTNAME=bkb
VS71COMNTOOLS=P:\Visual Studio .NET 2003\Common7\Tools\
TERM=cygwin
PROCESSOR_IDENTIFIER=x86 Family 15 Model 0 Stepping 7, GenuineIntel
WINDIR=W:\WINDOWS
TEXDOCVIEW_txt=cygstart %s
TEXDOCVIEW_dvi=cygstart %s
OLDPWD=/cygdrive/s
USERDOMAIN=BKB
OS=Windows_NT
ALLUSERSPROFILE=W:\Documents and Settings\All Users
USER=<username>
TEMP=/cygdrive/g/Temp
COMMONPROGRAMFILES=W:\Program Files\Common Files
LIB=P:\Visual Studio .NET 2003\VC7\ATLMFC\LIB;P:\Visual Studio .NET
2003\VC7\LIB;P:\Visual Studio .NET
2003\VC7\PlatformSDK\lib\prerelease;P:\Visual Studio .NET
2003\VC7\PlatformSDK\lib;P:\Visual Studio .NET
2003\SDK\v1.1\lib;P:\Visual Studio .NET 2003\SDK\v1.1\Lib\
!W:=W:\Cygwin\bin
QTJAVA="W:\Program Files\Java\j2re1.4.2_05\lib\ext\QTJava.zip"
USERNAME=<username>
TEXDOCVIEW_pdf=cygstart %s
PROCESSOR_LEVEL=15
PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/cygdrive/p/Visual
Studio .NET 2003/Common7/IDE:/cygdrive/p/Visual Studio .NET
2003/VC7/BIN:/cygdrive/p/Visual Studio .NET
2003/Common7/Tools:/cygdrive/p/Visual Studio .NET
2003/Common7/Tools/bin/prerelease:/cygdrive/p/Visual Studio .NET
2003/Common7/Tools/bin:/cygdrive/p/Visual Studio .NET
2003/SDK/v1.1/bin:/cygdrive/w/WINDOWS/Microsoft.NET/Framework/v1.1.4322:/cygdrive/p/Tcl/bin:/cygdrive/w/WINDOWS/system32:/cygdrive/w/WINDOWS:/cygdrive/w/WINDOWS/System32/Wbem:/cygdrive/w/Program
Files/WinSCP3/:/cygdrive/w/j2sdk1.4.2_05/bin:/cygdrive/p/MiKTeX/Main/miktex/bin:/cygdrive/w/Program
Files/SSH Communications Security/SSH Secure Shell:.
FP_NO_HOST_CHECK=NO
PWD=/cygdrive/s/<username>/Eclipse/temp
SYSTEMDRIVE=W:
TEXDOCVIEW_html=cygstart %s
USERPROFILE=W:\Documents and Settings\<username>
PS1=\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$
LOGONSERVER=\\BKB
PROCESSOR_ARCHITECTURE=x86
HISTCONTROL=ignoredups
SHLVL=1
HOME=/home/<username>
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.tcl
MLCDIR=P:/MLC
HOMEDRIVE=W:
PROMPT=$P$G
COMSPEC=W:\WINDOWS\system32\cmd.exe
TMP=/cygdrive/g/Temp
SYSTEMROOT=W:\WINDOWS
PRINTER=Adobe PDF
CVS_RSH=/bin/ssh
PROCESSOR_REVISION=0007
CLASSPATH="W:\Program Files\Java\j2re1.4.2_05\lib\ext\QTJava.zip";.
MSDEVDIR=P:\Visual Studio 6\Common\MSDev98
TEXDOCVIEW_ps=cygstart %s
MAKE_MODE=unix
INFOPATH=/usr/local/info:/usr/share/info:/usr/info:
PROGRAMFILES=W:\Program Files
NUMBER_OF_PROCESSORS=1
INCLUDE=P:\Visual Studio .NET 2003\VC7\ATLMFC\INCLUDE;P:\Visual Studio
.NET 2003\VC7\INCLUDE;P:\Visual Studio .NET
2003\VC7\PlatformSDK\include\prerelease;P:\Visual Studio .NET
2003\VC7\PlatformSDK\include;P:\Visual Studio .NET
2003\SDK\v1.1\include;P:\Visual Studio .NET 2003\SDK\v1.1\include\
SESSIONNAME=Console
COMPUTERNAME=BKB
_=/usr/bin/env
================================================
Variables such as INCLUDE were set when I ran the vcvars32.bat file in
Vc7\bin, according to some instructions I found on MSDN. There is a
math.h file in 'P:\Visual Studio .NET 2003\Vc7\include' on my
computer, and this path is part of my INCLUDE variable as you can see.
I'm completely stumped.
Please tell me how I can get C4.5 to build... There is another machine
learning library I need to build as well, so please point out any
general errors you see with the attempts I have made. Thanks. |