Building Retroshare under Windows

Old SourceForge Discussion forum that is now archived. Please use one of the other forums.

Building Retroshare under Windows

Postby Mecher » Sat Oct 18, 2008 10:28 am

I'm running Retroshare 0.4.10a, and it crashes all the time when downloading files (uploading peer doesn't seem to crash though).

I thought I'd compile RS in debug mode under Windows and see if I can find the problem.

I'm using latest Cygwin, and I've compiled openssl-0.9.7g-xpgp-0.1 (after fixing some broken .lnk-files) and KadC. Latest cygwin includes pthreads (works; tried it on simple test-code, don't even need -lpthread), so I thought I'd get away with using that.

But when I try to compile latest SVN RS/libretroshare it seems to have trouble with pthreads anyway. It won't find pthread.h even though the test-program does. Maybe it has something to do with the -mno-cygwin flag from scripts/config-cygwin.mk?

Also, there seem to be different sorts of pthread libraries around (pthreads and pthreads-win32, and then there is cygwin vs cygwin-mingw . So my question is really:
Which "phtreads" package does libretroshare need? Do I need to compile it separately?

And on a similar note: Which thread library does retroshare-gui use?

Logs below.

Any pointers would be appreciated.

Mecher

--- log ----

make[1]: Entering directory `/cygdrive/n/Src/RetroShare-SVN/libretroshare/src/ut
il'
g++ -Wall -O2 -I .. -I ../../../../openssl-0.9.7g-xpgp-0.1c/include -DPQI_USE
_XPGP -v -I/cygdrive/c/home/rmfern/prog/MinGW/pthreads/pthreads.2 -DPTW32_STATIC
_LIB -mno-cygwin -mwindows -fno-exceptions -DWINDOWS_SYS -I/cygdrive/c/home/r
mfern/prog/MinGW/zlib-1.2.3 -c rsdebug.cc
Reading specs from /usr/lib/gcc/i686-pc-mingw32/3.4.4/specs
Configured with: /usr/build/package/orig/test.respin/gcc-3.4.4-3/configure --ver
bose --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --libe
xecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-langu
ages=c,ada,c++,d,f77,pascal,java,objc --enable-nls --without-included-gettext --
enable-version-specific-runtime-libs --without-x --enable-libgcj --disable-java-
awt --with-system-zlib --enable-interpreter --disable-libgcj-debug --enable-thre
ads=posix --enable-java-gc=boehm --disable-win32-registry --enable-sjlj-exceptio
ns --enable-hash-synchronization --enable-libstdcxx-debug
Thread model: posix
gcc version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
/usr/lib/gcc/i686-pc-mingw32/3.4.4/cc1plus.exe -quiet -v -I .. -I ../../../../o
penssl-0.9.7g-xpgp-0.1c/include -I/cygdrive/c/home/rmfern/prog/MinGW/pthreads/pt
hreads.2 -I/cygdrive/c/home/rmfern/prog/MinGW/zlib-1.2.3 -D__MSVCRT__ -D__MINGW3
2__ -DWIN32 -D_WIN32 -D__WIN32 -D__WIN32__ -DWINNT -idirafter /usr/lib/gcc/i686-
pc-mingw32/3.4.4/../../../../include/w32api -idirafter /usr/lib/gcc/i686-pc-ming
w32/3.4.4/../../../../i686-pc-mingw32/lib/../../include/w32api -DPQI_USE_XPGP -D
PTW32_STATIC_LIB -DWINDOWS_SYS rsdebug.cc -quiet -dumpbase rsdebug.cc -mno-cygwi
n -mwindows -mtune=pentiumpro -auxbase rsdebug -O2 -Wall -version -fno-exception
s -o /cygdrive/c/DOCUME~1/A2C11~1.HRU/LOCALS~1/Temp/ccm2xKLz.s
ignoring nonexistent directory "/usr/local/include/mingw"
ignoring duplicate directory "/usr/include/mingw"
ignoring duplicate directory "/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i68
6-pc-mingw32/lib/../../include/w32api"
ignoring nonexistent directory "/cygdrive/c/home/rmfern/prog/MinGW/pthreads/pthr
eads.2"
ignoring nonexistent directory "/cygdrive/c/home/rmfern/prog/MinGW/zlib-1.2.3"
#include "..." search starts here:
#include <...> search starts here:
..
../../../../openssl-0.9.7g-xpgp-0.1c/include
/usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++
/usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/i686-pc-mingw32
/usr/lib/gcc/i686-pc-mingw32/3.4.4/include/c++/backward
/usr/lib/gcc/i686-pc-cygwin/3.4.4/include
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../i686-pc-mingw32/include
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api
End of search list.
GNU C++ version 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) (i686-pc-cygw
in)
compiled by GNU C version 3.4.4 (cygming special, gdc 0.12, using dmd 0.
125).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
In file included from rsdebug.cc:30:
../util/rsthreads.h:30:21: pthread.h: No such file or directory
In file included from rsdebug.cc:30:
Mecher
 

RE: Building Retroshare under Windows

Postby greyfox126 » Sat Oct 18, 2008 12:15 pm

you can run rs under cygwin with this command (in the retroshare directory):

retroshare -s > rs.log 2>&1

this puts all the debug info into one file.
Take care as it can get quite big.

as for the pthreads question i think it would be the win32-pthreads. but then again i've not successfully compiled it on windows yet.

Chris
greyfox126
 

RE: Building Retroshare under Windows

Postby defnax » Sat Oct 18, 2008 12:52 pm

hi

i have attached libpthreadGC2d.a:
This was build by Dr.Bob for Windows.


https://sourceforge.net/tracker/download.php?group_id=178712&atid=886241&file_id=297858&aid=2176786
defnax
 

RE: Building Retroshare under Windows

Postby Mecher » Sat Oct 18, 2008 3:33 pm

Defnax: I'm still at the compilation stage, so the .a won't help unfortuntely :) Thanks though.

Anyway, think I worked around the pthread problem by commenting out these lines:

# for static pthread libs....
WININC += -DPTW32_STATIC_LIB
WININC += -mno-cygwin -mwindows -fno-exceptions
WININC += -DWINDOWS_SYS

After this it finds the cygwin pthreads stuff again :)

But then the next problem:

g++ -Wall -O2 -I .. -I ../../../../openssl-0.9.7g-xpgp-0.1c/include -DPQI_US
_XPGP -I/cygdrive/c/home/rmfern/prog/MinGW/pthreads/pthreads.2 -I/cygdrive/c/h
me/rmfern/prog/MinGW/zlib-1.2.3 -c rstlvbase.cc
In file included from rstlvbase.cc:29:
../serialiser/rstlvbase.h:241: error: `std::wstring' has not been declared
../serialiser/rstlvbase.h:241: error: ISO C++ forbids declaration of `out' with
no type

It can't compile the "wstring" type. After doing some googling I am at the conclusion that Cygwin doesn't support wstring (because newlib doesn't).

So I'm a bit stumped on how RS could be compiled under Cygwin at all? Dr.Bob? :)

I might try compiling under MingW instead...

/Mecher
Mecher
 

RE: Building Retroshare under Windows

Postby Dr Bob » Sat Oct 18, 2008 4:14 pm

Hi Mecher,

libretroshare is compiled under cygwin, but with flags for mingw compilation....
(thats what CYGWIN flags mean). The retroshare-gui is compiled using mingw
that is provided with Qt4.3.X.

You need to compile OpenSSL with mingw flags, and compile / install pthreads as well.

Your problem is related to missing pthreads for windows. U also need to manually change the path to point at where your support libraries are located (openssl, ,pthreads, etc).

The windows compilation as never be cleaned up - As no-one has shown any interest in developing
libretroshare.a on windows. I believe I'm still the only person to fully compile retroshare under windows ;) It really is a pain in the arse to debug retroshare under windows.

If you send me an email, I'll point you at the libraries I've used.

DrBob.
Dr Bob
 

RE: Building Retroshare under Windows

Postby jabber2 » Sun Oct 19, 2008 7:29 pm

what are the exact steps to compile under windows?
why is that not shared? thanks for a docu.
jabber2
 

RE: Building Retroshare under Windows

Postby Mecher » Sun Oct 19, 2008 8:26 pm

I'm doing headway on compiling under Windows (still not there yet though). If (ehm, when...) I get it running I'll submit a build script, and provide some documentation with an overview of how the build environment under Windows work.

Building under Cygwin, mingw-style, and my build of HEAD (r759) with some tweaks dies at:

make[1]: Entering directory `/cygdrive/n/Src/Retroshare-work/libretroshare/src/r
sserver'
g++ -Wall -O2 -I .. -I /cygdrive/n/Src/openssl/include -DPQI_USE_XPGP -I/cygd
rive/n/Src/pthreads -DPTW32_STATIC_LIB -mno-cygwin -mwindows -fno-exceptions -D
WINDOWS_SYS -I/cygdrive/n/Src/zlib -c p3face-startup.cc
p3face-startup.cc:1299: error: redefinition of `struct _CRYPTPROTECT_PROMPTSTRUC
T'
/usr/lib/gcc/i686-pc-mingw32/3.4.4/../../../../include/w32api/Wincrypt.h:1274: e
rror: previous definition of `struct _CRYPTPROTECT_PROMPTSTRUCT'
p3face-startup.cc:1304: error: ISO C++ forbids declaration of `CRYPTPROTECT_PROM
PTSTRUCT' with no type
p3face-startup.cc:1304: error: conflicting declaration 'typedef int CRYPTPROTECT
_PROMPTSTRUCT'

I will continue slugging with this during the week as time permits.

Mecher
Mecher
 

RE: Building Retroshare under Windows

Postby Mecher » Sun Oct 26, 2008 9:40 pm

I've finally managed to successfully compile RS (HEAD revision, r767) under Windows. Seems to run too. Connects to the network and looks all nice and dandy :)

DrBob: Thanks for the pointers in the post above. Got me a bit further, and I slugged through the rest.

>The windows compilation as never been
>cleaned up - As no-one has shown any
>interest in developing
>libretroshare.a on windows.

I believe that any application that is primarily about enabling people to communicate must work well on most of the available operating systems in order to get a noticeable penetration. I think it is great that RS is cross-platform!

I'll see if I can't at least help making it easier for people running Windows to get a development environment up and running. I think we need more people working on ironing out bugs under Windows.

>I believe I'm still the only person to fully
>compile retroshare under windows ;)

Now there are two ;-)

>It really is a pain in the arse to debug
>retroshare under windows.

I haven't gotten that far yet. Why is it more difficult under Windows than Linux?

Anyway, I'll work some more on doing debug vs release builds, before creating some scripts that will set up a development environment. Will probably take a bit of time (don't have much more than a few hours every week to play with this).

Mecher
Mecher
 

RE: Building Retroshare under Windows

Postby Dr Bob » Mon Oct 27, 2008 6:29 pm

Congratulations.... Number two windows compilation!

Debugging under gdb/cygwin is really painful because the stack is displayed incorrectly.
So if you get a seg fault.... the standard procedure is to run under gdb - until it crashes
then look at the stack. Under windows - this is almost useless - you've got no idea what happened.
(there are ways to demangle the stack but you must be very patient)

There have been several windows specific bugs which have taken weeks/months to find because of this problem.

The best solution would be to get libretroshare compiling under VC++. Then we can use
microsofts debugger - which would surely work under windows.

DrBob.
Dr Bob
 

RE: Building Retroshare under Windows

Postby defnax » Tue Oct 28, 2008 1:31 am

Then when you have time you can make a Howto Compile on Wiki?

http://retroshare.sourceforge.net/wiki/index.php/Developers_Corner
defnax
 


Return to Developers Corner - Archive

Who is online

Users browsing this forum: No registered users and 1 guest