PDA

View Full Version : SEQ port to CygWin



arantius
06-26-2003, 04:59 PM
I was really hoping to have this thread be an announcement. I've worked thru a number of little snags in the past few days but though I've gotten SEQ to compile with only minor warnings and no errors, it will not link. I'm going to give the error message I get below, hoping that will be enough. If I need to provide more information I'll do so but I don't want to clutter up my message if I don't have to. Thanks!

P.S. The majority of the work so far has really been just correctly installing all the prerequisite packages and then working through the compile errors, filling in what SEQ expects in a linux environment that isn't quite the same, so far just a tree of extra .h includes and one to the SEQ code itself (a typecast).


g++ -O2 -Wall -g -ggdb -DDEBUG -finline-functions -DQT_THREAD_SUPPORT=1 -DDISPLA
Y_ICONS=false -DICON_DIR=\"/eq-icons/\" -o showeq.exe main.o spawn.o spawnshell.
o spawnlist.o spellshell.o spelllist.o vpacket.o editor.o filter.o m_spawnshell.
o m_spawnlist.o m_spellshell.o m_spelllist.o m_editor.o packet.o m_packet.o inte
rface.o m_interface.o compass.o m_compass.o map.o m_map.o util.o experiencelog.o
m_experiencelog.o combatlog.o m_combatlog.o msgdlg.o m_msgdlg.o player.o m_play
er.o decode.o m_decode.o skilllist.o m_skilllist.o statlist.o m_statlist.o filte
rmgr.o m_filtermgr.o mapcore.o category.o m_category.o compassframe.o m_compassf
rame.o group.o m_group.o guild.o m_guild.o netdiag.o m_netdiag.o logger.o m_logg
er.o xmlconv.o xmlpreferences.o m_xmlpreferences.o seqwindow.o m_seqwindow.o seq
listview.o m_seqlistview.o zonemgr.o m_zonemgr.o spawnmonitor.o m_spawnmonitor.o
spawnpointlist.o m_spawnpointlist.o spawnlistcommon.o m_spawnlistcommon.o spawn
list2.o m_spawnlist2.o libEQ.o itemdb.o m_itemdb.o gdbmconv.o -L/usr/lib/qt3/li
b -lqt-mt /usr/lib/libgdbm.dll.a -lz -lpcap -L/usr/lib/qt3/lib -L/usr/X11R6/lib
Info: resolving QString::shared_null by linking to __imp___ZN7QString11sha
red_nullE (auto-import)
Info: resolving QString::null by linking to __imp___ZN7QString4nullE (auto-
import)
Info: resolving _qApp by linking to __imp__qApp (auto-import)
Info: resolving _static_QUType_ptr by linking to __imp__static_QUType_ptr (auto-
import)
Info: resolving _static_QUType_int by linking to __imp__static_QUType_int (auto-
import)
Info: resolving _static_QUType_QString by linking to __imp__static_QUType_QStrin
g (auto-import)
Info: resolving _static_QUType_Null by linking to __imp__static_QUType_Null (aut
o-import)
Info: resolving _static_QUType_varptr by linking to __imp__static_QUType_varptr
(auto-import)
Info: resolving _static_QUType_bool by linking to __imp__static_QUType_bool (aut
o-import)
Info: resolving _static_QUType_charstar by linking to __imp__static_QUType_chars
tar (auto-import)
Info: resolving QColor::colormodel by linking to __imp___ZN6QColor10colorm
odelE (auto-import)
Info: resolving _gdbm_errnm_spawnshell.o(.text+0x1f70): In function `_ZN10SpawnS
hell9qt_invokeEiP8QUObject':
/usr/lib/qt3/include/private/qucom_p.h:312: undefined reference to `SpawnShell::
updateSpawn(unsigned short, short, short, short, short, short, short, signed cha
r, signed char, unsigned char)'
o by linking to __imp__gdbm_errno (auto-import)
Info: resolving _gdbm_version by linking to __imp__gdbm_version (auto-import)
collect2: ld returned 1 exit status
make[3]: *** [showeq.exe] Error 1
make[3]: Leaving directory `/home/Administrator/src/seq/showeq/src'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/Administrator/src/seq/showeq/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/Administrator/src/seq/showeq'
make: *** [all] Error 2

Cryonic
06-26-2003, 09:13 PM
QT compiled with GCC3+ ? My guess would be no since you see similar compile problems under linux. Also helps if you do post what version of the needed libraries you are using (e.g. QT)

arantius
06-26-2003, 10:32 PM
GCC 3.2 used to compile all of:
QT 3.1.0 (from kde-cygwin.sourceforge.net)
gdbm 1.8.0
libpcap 0.8 (from winpcap.polito.it)

Anything else you'd like me to add?

arantius
06-26-2003, 10:35 PM
I suppose I was't clear it's reallly the spawnshell.o(.text+0x1f70): In function `_ZN10SpawnShell9qt_invokeEiP8QUObject': /usr/lib/qt3/include/private/qucom_p.h:312: undefined reference to `SpawnShell::updateSpawn(unsigned short, short, short, short, short, short, short, signed char, signed char, unsigned char)' that concerns me. The auto import parts seem fine.

Ratt
06-26-2003, 11:16 PM
The GDBM stuff will be easy to resolve (if nothing else, rip out the GDBM shit) -- the QT stuff is ugly though.

Try turning off DEBUG for one thing.. not that it *should* matter, but I've found that compiling in debug info can sometimes screw things up when doing really funky stuff like this.

Was QT compiled with -mt enabled?

arantius
06-27-2003, 02:34 AM
Commenting out the appropriate sections of gdbmconv.cpp (the line "#include <errno.h>", the functions displayGDBMError and GDBMConvenience::Version) got rid of those Info alerts, but I do not believe those are actually a problem.
Qt was ./configured with the -thread flag, I assume that is what you meant?
And finally, most importantly, compiling without debug information helped a lot. It did not fix the problem, but it changed the error message. The change was in the right place to make my eye notice that the error message was mixed in the middle of the GDBM info alert about errno. (When I commented parts of gdbmconv, that error message then displayed on it's own line before any info alerts.) The new message was a bit more accurate:

m_spawnshell.o(.text+0x1f70):
m_spawnshell.cpp: undefined reference to
`SpawnShell::updateSpawn(unsigned short, short,
short, short, short, short, short, signed char,
signed char, unsigned char)'
Meaning, our undefined reference is actually in a file that we expect that function to be referred to in =)
I suspect this means somehow my moc is generating the m_spawnshell.cpp incorrectly ... Really just thinking out loud now that I've started this thread. Commenting out the two lines that do call updateSpawn() in fact compiles just fine, with the info alerts about auto importing that again, I'm sure are fine.
So, now I have a compiled showeq.exe which runs! Unfortunately it doesn't run far, pretty quickly I get pcap_error:pcap_open_live(eth0): live packet captuer not supported on this system.
So, things are not complete but working in the right direction. I'll have to see how winpcap does live capture, and I'll have to more seriously debug the call to updateSpawn.

Edit: put some linebreaks in that "code" ... I hate horizontal scrolling and don't want to make you all experience it =)

arantius
06-29-2003, 09:29 PM
Alright, more good progress =) I've re-tooled the Makefile.dist to do all the little things differently to make it work in CygWin, and added a part to detect the OS (cyg/linux) though I've only yet tested that as working in cyg.
Deugged my pcap problem to needing a slightly different library. Apparently the libpcap ported to cyg just has a stub pcap_open_live that just says "You can't do this!" whereas libwpcap does in fact actually work =) So I need to get configure to test for libwpcap if libpcap fails. I've gotten this far ...

Changed part of configure.in to:

AC_CHECK_LIB(pcap, pcap_open_live,
,
AC_CHECK_LIB(wpcap, pcap_open_live,,
AC_MSG_ERROR(cannot find pcap_open_live in libpcap.
Read the INSTALL file.),
-lwsock32
)
)

Run make -f Makefile.dist . Then run:

./configure
--with-extra-includes="/home/Administrator/src/seq/cygwin-includes"
--with-extra-libs="/home/Administrator/src/wpdpack/Lib"
But it does not apply those parameters when it compiles it's test, it runs g++ -o conftest.exe -g -O2 conftest.cc -lwpcap -lwsock32 without including the directory It of course cannot find the wpcap library and fails. It does not seem to honor the LDFLAGS environment variable either.

What am I doing wrong?

Razzle
08-28-2009, 06:24 PM
I know I know. I have bumped an ancient thread.

I got the titanium client compatible version of SEQ running in cygwin under Windows XP with minimal changes.

I had to use the latest winpcap beta, since it now contains the function pcap_open_live. From the Developer pack I put the includes (all the .h and pcap folder - leave stuff in folder) in /usr/include and libs (libpacket.a and libwpcap.a) in /lib

Also, don't forget to install WinPcap 4.1 driver +DLL's. Showeq will not run without them.

Other packages to include (i may not have listed all)

Devel:
gcc-core
gcc-g++
minires-devel
make
libtool
zlib-devel

KDE:
libqt3
libqt3-devel

X11:
X-start-menu-icons
xorg-server

I added the following symbolic links:

in /usr/lib/qt3/lib (so qt is recognized by configure)

ln -s libqt-mt.dll.a libqt-mt.so.3

in /lib (so pcap is recognized by configure)

ln -s libwpcap.a libpcap.a

A few headers are missing from cygwin, but I was able to just copy the needed files from a bsd install and they contained everything to make it compile and run.

Missing files to put in /usr/include
<netinet/if_ether.h>
<net/ethernet.h>
<net/if_arp.h>

During the build, it does not recognize using little endian properly and will use big endian (bad), but this can be handled by adding to packetcommon.h:

#include <endian.h>

A very important thing in windows, is that it does support a read timeout. So when pcap is started in packetcapture.cpp, you need to change the timeout to something other than zero.


In packetcapture.cpp change this:

m_pcache_pcap = pcap_open_live((char *) device, BUFSIZ, true, 0, ebuf);

to this:

m_pcache_pcap = pcap_open_live((char *) device, BUFSIZ, true, 10, ebuf);

Cygwin (or windows for that matter) does not have sysctl for setting buffer sizes. The default size when opening the socket with pcap is not large enough for showeq. To fix this I added this to packetcapture.cpp to resize the buffer to be large enough.

After the call to pcap_open_live in packetetcapture.cpp, it first checks it has if (!m_pcache_pcap). Since this parameter is used to resize the buffer, I want to make the resize call past that if statement by adding.


if (pcap_set_buffer_size(m_pcache_pcap, 524288) == -1)
{
pcap_perror (m_pcache_pcap, "pcap_error:pcap_set_buffer_size");
exit(0);
}

This allows resizing the receive buffer in windows so it will be large enough for the packet captures.

Under Cygwin, it uses the windows networking. There is a layer put in so the normal unix windows function works, but it still uses the window api. Because of this the ethernet device will not be /dev/eth0, etc. To get the device, I used some code I found on the winpcap site and compiled.


#include <stdlib.h>
#include <stdio.h>
#include <pcap.h>

main()
{
pcap_if_t *alldevs;
pcap_if_t *d;
int i=0;
char errbuf[PCAP_ERRBUF_SIZE];

/* Retrieve the device list from the local machine */
if (pcap_findalldevs(&alldevs, errbuf) == -1)
{
fprintf(stderr,"Error in pcap_findalldevs_ex: %s\n", errbuf);
exit(1);
}

/* Print the list */
for(d= alldevs; d != NULL; d= d->next)
{
printf("%d. %s", ++i, d->name);
if (d->description)
printf(" (%s)\n", d->description);
else
printf(" (No description available)\n");
}

if (i == 0)
{
printf("\nNo interfaces found! Make sure WinPcap is installed.\n");
return;
}

/* We don't need any more the device list. Free it */
pcap_freealldevs(alldevs);
}

i complied this with:

gcc -o finddev finddev.c -lpcap

On my system it had an output like this:


1. \Device\NPF_GenericDialupAdapter (Adapter for generic dialup and VPN capture)
2. \Device\NPF_{AD15CD41-2204-4B39-A0A3-E3C331E2EBA1} (Broadcom 440x 10/100 Integrated Controller (Microsoft's Packe
t Scheduler) )

The device 2 is my ethernet device.

To run showeq i then use the command (setting the device in quotes)


showeq -i "\Device\NPF_{AD15CD41-2204-4B39-A0A3-E3C331E2EBA1}"

(I think I have all the details now)