gnokii-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiling Gnokii with Microsoft Visual C++ Toolkit 2003


From: Robert Thomson
Subject: Compiling Gnokii with Microsoft Visual C++ Toolkit 2003
Date: Tue, 25 Apr 2006 17:04:51 +1000 (EST)

Thought I'd share some information I've gathered on compiling gnokii for windows.
Compiler: Microsoft Visual C++ Toolkit 2003 available for free at http://msdn.microsoft.com/visualc/vctoolkit2003/
You also need to download and install the platform SDK. I downloaded the Windows® Server 2003 SP1 Platform SDK ISO Install from http://www.microsoft.com/downloads/details.aspx?familyid=D8EECD75-1FC4-49E5-BC66-9DA2B03D9B92&displaylang=en

I only installed the core windows components though.

Operating System: Windows XP SP2

Phone: Nokia 3120

Cable: Genuine Nokia CA-42

Gnokii Source: 0.6.11

Start by unzipping the source into a directory <path> of your choice
open a command prompt and change to <path>/gnokii-0.6.11/win32 directory
make a couple of changes to some source files; Line 177 of <path>\gnokii-0.6.11\common\links\atbus.c fails to compile because the variable start is declared and used on the same line. Put "char * start;" at the beginning of the function and then remove the char * from the beginning of line 177.
Line 250 of <path>\gnokii-0.6.11\common\nokia-decoding.c call the timegm function which isn't available under windows (at least with the microsoft libraries). I substituted "mktime(&tm_time);" for  "timegm(&tm_time);" I don't believe that this is an adequate replacement function but I wasn't interested in calendar functions only sms messaging and it allowed me to compile and link.
create a directory called MSVC7-Toolkit under the <path>/gnokii-0.6.11/win32 directory
create a file called libgnokii-src.txt in <path>/gnokii-0.6.11/win32/MSVC7-Toolkit directory with the following contents
..\..\common\phones\atbosch.c
..\..\common\links\atbus.c
..\..\common\links\gnbus.c
..\..\common\phones\ateric.c
..\..\common\phones\atgen.c
..\..\common\phones\atnok.c
..\..\common\phones\atsie.c
..\..\common\phones\atsoer.c
..\..\common\phones\gnapplet.c
..\..\common\pkt.c
..\..\common\cfgreader.c
..\..\common\compat.c
..\..\common\device.c
..\..\common\vcal.c
..\..\common\phones\fake.c
..\..\common\links\fbus-3110.c
..\..\common\links\fbus-phonet.c
..\..\common\links\fbus.c
..\..\common\phones\generic.c
..\..\common\gsm-api.c
..\..\common\gsm-bitmaps.c
..\..\common\gsm-call.c
..\..\common\gsm-common.c
..\..\common\gsm-encoding.c
..\..\common\gsm-error.c
..\..\common\gsm-filetypes.c
..\..\common\gsm-networks.c
..\..\common\gsm-ringtones.c
..\..\common\gsm-sms.c
..\..\common\gsm-statemachine.c
..\..\common\links\m2bus.c
..\..\common\misc.c
..\..\common\phones\nk3110 .c
..\..\common\phones\nk6100.c
..\..\common\phones\nk6160.c
..\..\common\phones\nk6510.c
..\..\common\phones\nk7110.c
..\..\common\nokia-decoding.c
..\..\common\phones\nokia.c
..\..\common\sms-nokia.c
..\..\common\snprintf.c
..\..\common\devices\tekram.c
..\..\common\devices\bluetooth.c
..\..\common\devices\unixbluetooth.c
..\..\common\devices\osxbluetooth.c
..\..\common\devices\irda.c
..\..\common\devices\winirda.c
..\..\common\links\utils.c
..\..\common\vcard.c
..\..\common\ldif.c
..\..\common\devices\winserial.c
..\..\common\readmidi.c
..\..\intl\localcharset.c

create a batch file called make.bat with the following contents.  Watch the unintended line breaks here. There should be 6 lines in total starting with Rem, copy, for, link, cl and link respectively.

Rem Batch file to compile Gnokii.exe and libgnokii.dll using MS Visual C++ Toolkit 2003
copy config.h ../include
for /f  %%i in (libgnokii-src.txt) do cl /nologo /MT /W3 /GX /O2 /I "." /I "../../include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "GNOKIIDLL_EXPORTS" /D "HAVE_CONFIG_H" /YX /FD /c %%i
link /nologo /dll /machine:I386 /out:libgnokii.dll atbosch.obj atbus.obj gnbus.obj ateric.obj atgen.obj atnok.obj atsie.obj atsoer.obj gnapplet.obj pkt.obj cfgreader.obj compat.obj device.obj vcal.obj fake.obj fbus-3110.obj fbus-phonet.obj fbus.obj generic.obj gsm-api.obj gsm-bitmaps.obj gsm-call.obj gsm-common.obj gsm-encoding.obj gsm-error.obj gsm-filetypes.obj gsm-networks.obj gsm-ringtones.obj gsm-sms.obj gsm-statemachine.obj m2bus.obj misc.obj nk3110.obj nk6100.obj nk6160.obj nk6510.obj nk7110.obj nokia-decoding.obj nokia.obj sms-nokia.obj snprintf.obj tekram.obj bluetooth.obj unixbluetooth.obj osxbluetooth.obj irda.obj winirda.obj utils.obj vcard.obj ldif.obj winserial.obj readmidi.obj localcharset.obj
cl /nologo /W3 /GX /MT /O2 /I "." /I "../../include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "GNOKIIDLL_IMPORTS" /YX /FD /c ..\..\common\compat.c ..\..\getopt\win32\getopt.c ..\..\gnokii\gnokii.c ..\..\common\snprintf.c
link /nologo /subsystem:console /machine:I386 /out:gnokii.exe libgnokii.lib compat.obj getopt.obj gnokii.obj snprintf.obj

run make.bat
If you get compile/link errors make sure that your environment variables for LIB and INCLUDE are set correctly to include the c compiler and the platform SDK. The c compiler will create a batch file vcars32.bat upon installation.  Edit it to include the platform sdk include and lib paths and run it before compiling again.

copy the binaries libnokii.dll and gnokii.exe along with a copy of the sample gnokiirc file to the directory where you intend to install or run on the computer.

The gnokiirc file I used is below.

# This is a sample ~/.gnokiirc file.  Copy it into your
# home directory and name it .gnokiirc.
# See http://wiki.gnokii.org/index.php/Config for working examples.
#

[global]

# Set port to the physical port used to connect to your phone.
# Linux version is:
port = com4:
#
# For MacOSX you will need something like:
# port = /dev/cu.USA28X1P1.1
#
# For Win32 you want to use:
# port = com1:
# or similiar.
#
# FreeBSD (probably NetBSD and OpenBSD too) use:
# port = /dev/cuaa0
#
# With Linux-IrDA you will want to use
# port = /dev/ircomm0
# or similiar.
#
# Use this setting also for the Bluetooth connection:
# port = aa:bb:cc:dd:ee:ff
# when using it with AT driver set it to:
# port = /dev/rfcomm0
# or similiar.
#
# For the Linux USB cables you will need one of the following settings (or
# similiar)
# port = /dev/ttyUSB0
# port = /dev/tts/USB0
# port = /dev/ttyACM0
# the last one will work only with AT driver. The correct setting should be
# given in the dmesg output.

# Set model to the model number of your phone. For the
# Symbian phones use:
# model = series60
# For other non-Nokia phones and when you want to use AT
# mode use:
# model = AT
# If you can't figure out what to put here read the FAQ.
# If it still doesn't help, consult gnokii-ml or #gnokii at freenode.
model = 6510
# There are few main models that should make use of the certain drivers.
# These are: 6110, 7110, 6510, 3110, 2110, 6160.

# Set IrDA device name.
# If you use irda connection you may want gnokii to autodetect the irda
# device it connects to. This is fine for most of the cases. if you have
# more than one device in range you may want to give manually the device
# name so gnokii correctly recognizes it. Use the name that you can see
# in the discovery log when the phone with infrared is in the range of
# your irda port.
# Note that you need to set this for each phone_ section separately. It
# isn't nested from the global section.
# irda_string = Nokia 6610i

# Initlength controls the number of characters sent to the
# phone during initialisation.  You can either set it to
# the word "default" or a positive integer.
#
# You can try setting this value if you want to connect
# to the phone quicker.  If you've never noticed the
# connection to be slow, it is suggested that you
# leave this alone.  Read the initialisation code in fbus-xxxx
# to understand what this changes if you're curious.
initlength = default

# The type of the connection, for IR set this to infrared or irda.
# For the nk6110 driver only infrared is valid for the IrDA connection.
# See Docs/gnokii-ir-howto for more detailes on this.
# If you have 6210/6250/7110 phone and dau9p cable (the one you can
# use with 6100 series and cannot use hardware modem from the phone)
# you may want to use 'dau9p' value to get faster initialization.
# If you use dlr3 or dlr3p cable for nokia phones in FBUS mode (ie.
# you don't use model = AT) you may want to use 'dlr3p' value here.
# Note that it is recommended and currently the best way to use this
# cable with nk6510 driver.
connection = dlr3p
# With DKU-2 cable use the following setting
# connection = dku2
# With DKU-5 cable use the following setting
# connection = dlr3p
# For Bluetooth and AT driver use the following setting
# connection = serial
# For other Bluetooth settings use
# connection = bluetooth
# For infraded connection with phones other then Nokia 6110/6130/6150 use
# connection = irda

# Set this to 'yes' if you want gnokii to set and check the lock file in
# /var/lock directory. It avoids potential conflicts with other serial
# port software (eg. minicom). If you have wrong permissions for the
# directory, a warning will be generated. If you don't want a lockfile, set
# it to 'no'.
use_locking = no

# Baudrate to use on serial port connections.
# Currently used only by models AT and BIP/CIMD. Defaults to 19200.
serial_baudrate = 19200

# Force waiting after each send character the specified usec time.
# Value -1 forces the fastest 'block' writing,
# value 0 writes each character separately without any explicite waiting,
# other positive values specify the appropriate 1/1000000 sec delaying.
# Siemens M20 requires at least "1"!  FIXME: Model-driven autodetection
#serial_write_usleep = 10000

# Force serial port handshaking mode, useful primarily for "AT" model.
# Gnokii "AT" model uses software handshake by default.
# Possible values: hardware (RTS/CTS - 7 wires) or software (XON/XOFF - 3 wires)
#handshake = software

# If defined (not commented out by '#') it will quit Gnokii anytime
# when DCD line will drop.
#require_dcd = 1

# If you are using a bluetooth connection, you can specify the rfcomm
# channel number here. Default value is 1.
#rfcomm_channel = 1

# There may happen various timeouts during the communication with the phone.
# This parameter enables the retransmission policy. Ie. if the phone doesn't
# respond, we send the frame again. This happend mainly with the older
# phones. You may want to enable it when you see mysterious timeouts.
# Be very carefull with this option. It is suspected to cause phone breakage
# with new DCT4 phones (like Nokia 6100). By default it is switched off
# (sm_retry = 0)
#sm_retry = 1

# Run the specified script(s) right after opening and initializing the device
# and before any communucation (right before closing for disconnect_script).
# You may find handy to use it to connect your modem to SMS Center
# when using BIP or CIMD protocols
# Non-absolute path is relative to the specific directory where gnokii is run!
#connect_script = /absolute/path/to/gnokii/Docs/sample/cimd-connect
#disconnect_script =

# When sending SMS you can experience timeouts. This is the feature of the
# overloaded SMSCs. The phones waits for the response from the SMSC confirming
# that it received the short message. When the SMSC is DoSed with many requests
# it will take more time to get the response. Adjust it to your needs. The
# value is given in seconds to wait. Defaults to 10 seconds. Set to 0 to wait
# forever.
smsc_timeout = 10

# Set bindir to point to the location of the various gnokiid binaries.
# In particular ensure that mgnokiidev is in this location, with
# permissions 4750, owned by root, group gnokii.  Ensure you
# are in the gnokii group and that the group exists...
[gnokiid]
bindir = /usr/local/sbin/

# Any entries in the following two sections will be set as environment
# variables when running the scripts.
# Handy for use for $VAR substitutions in your chat(8) script.
[connect_script]
TELEPHONE = 12345678
[disconnect_script]


# The following parameters control how libgnokii handle the debugging messages.
# Currently there are three categories: "debug" controls the libgnokii
# normal debug output, "rlpdebug" controls the debug output of the RLP
# subsystem, and "xdebug" is used by the xgnokii or smsd.

[logging]

# where to log the debug output (on: stderr, off: /dev/null)
debug = on

# where to log the rlp debug output (on: stderr, off: /dev/null)
rlpdebug = off

# where to log X debug output (on: stderr, off: /dev/null)
xdebug = off

Send instant messages to your online friends http://au.messenger.yahoo.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]