Return-Path: From: Paul Wise To: Faber MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: [Xchm-general] Re: xCHM under Cygwin (problems...) WARNING: LONG List-Archive: Date: Mon, 10 Nov 2003 09:33:54 -0500 (EST) Hi, I hope you don't mind me cc'ing the xCHM list Faber, but I wanted peeps to see this. The following is my ramblings while trying to get xchm working under cygwin and mingw. so you don't have to read the whole thing, know that I compiled both and put up screenshots of them working and a working mingw build. I'm lazy, so the mingw build has no png/tiff/jpeg capability. Urls: cygwin: http://bonedaddy.net/pabs3/screenshots/xchm.png http://bonedaddy.net/pabs3/screenshots/xchm-2.png mingw: http://bonedaddy.net/pabs3/screenshots/xchm-3.png http://bonedaddy.net/pabs3/xchm.exe OK, it's been ages since I tried xchm on cygwin, so I tried it again since I had an afternoon to spare. I went thru the same procedure as you did, except I used the devel version of libtool. I got the same results as you, including that warning you mentioned. I left the makefile with it's default CFLAGS, cause I think cygwin has pthreads and all that. Then I reinstalled wxWidgets 2.4.1 (I'm only on a modem, so I wasn't going to redownload it) into C:\apps\wxWidgets-2.4.1 (note the lack of spaces) The file you want to use is http://prdownloads.sourceforge.net/wxWidgets/wxMSW-2.4.2-setup.zip then I did ./configure in that directory & got the following output (without adding -mno-cygwin) Configured wxWidgets 2.4.1 for `i686-pc-cygwin' Which GUI toolkit should wxWidgets use? MSW Should wxWidgets be compiled in debug mode? no Should wxWidgets be linked as a shared library? yes Should wxWidgets be compiled in Unicode mode? no What level of wxWidgets compatibility should be enabled? wxWidgets 2.0 no wxWidgets 2.2 yes Which libraries should wxWidgets use? jpeg sys png sys regex sys tiff sys zlib sys then I did make, went & had lunch, came back to see that everything was done & the library was created so I did make install with no problems either then I went to the xchm-0.8.8 directory & did ./configure I got: checking for chm_open in -lchm... no configure: error: Can't find/use -lchm. Please install CHMLIB first. looking at the config.log I saw that it couldn't find the libchm.a file then I remembered that cygwin can't seem to find libs in /usr/local/lib, so I moved them to /lib so i ran configure again and it failed. in config.log I saw: configure:4130: gcc -o conftest.exe -fno-pcc-struct-return -I/usr/local/lib/wx/include/msw-2.4 -D__WIN95__ -D__WXMSW__ -DWXUSINGDLL=1 conftest.c -lchm >&5 /usr/lib/gcc-lib/i686-pc-cygwin/3.2/../../../libchm.a(chm_lib.o)(.text+0xebf): In function `_chm_fetch_bytes': /e/home/pabs/patches/chmlib-0.31/chm_lib.c:702: undefined reference to `_pread64' collect2: ld returned 1 exit status so I removed the -DCHM_USE_IO64 option from the makefile (leaving -DCHM_MT in there) and recompiled/installed/moved stuff then reconfigured xchm, had to remove the -DCHM_USE_PREAD flag from the makefile then I reconfigured xchm and it worked! w00t so I did make & ran the binary & it worked to prove it here's a coupla screenshots I put up on my website: http://bonedaddy.net/pabs3/xchm.png http://bonedaddy.net/pabs3/xchm-2.png these are xchm 0.8.8 running using the cygwin library, with cygwin chmlib, and a shared lib of wxWidgets-MSW 2.4.1 that's all well and good, but a proper mingw compiled version would be better, with chmlib & wxWidgets compiled in statically, preferablly to that end I started from the beginning using CFLAGS=-mno-cygwin LDFLAGS=-mno-cygwin in all the configure's and the Makefile I also added -DWIN32 to the chmlib Makefile, cause otherwise the ffs fuction will not be found (notice the _ffs in your config.log) for some reason some of the types were broken: UInt16 etc so I replaced the stuff in the #ifdef WIN32 blocks with the stuff for other platforms & it worked on to the wxWidgets reconfigure, which I did like so: CXXFLAGS=-mno-cygwin LDFLAGS=-mno-cygwin ./configure --disable-shared --disable-debug this went ok, so I did make clean, make, which gave me this c++ -c -I./lib/wx/include/msw-2.4 -I./include -D_WIN32_IE=0x400 -D__WIN95__ -D__WXMSW__ -fno-pcc-struct-return -O2 -MMD -mno-cygwin -Wall -o datetime.o ./src/common/datetime.cpp src/common/datetime.cpp: In member function `const wxChar* wxDateTime::ParseFormat(const wxChar*, const wxChar*, const wxDateTime&)': src/common/datetime.cpp:2923: `strptime' undeclared (first use this function) src/common/datetime.cpp:2923: (Each undeclared identifier is reported only once for each function it appears in.) make: *** [datetime.o] Error 1 after removing config*cache, reconfiguring, make clean, make I got c++ -c -I./lib/wx/include/msw-2.4 -I./include -I./src/regex -I./src/zlib -I./src/png -D_WIN32_IE=0x400 -D__WIN95__ -D__WXMSW__ -fno-pcc-struct-return -O2 -MMD -mno-cygwin -Wall -o filefn.o ./src/common/filefn.cpp src/common/filefn.cpp:112:25: fnmatch.h: No such file or directory make: *** [filefn.o] Error 1 for some reason it didn't properly detect that that header could not be found, so I grepped for it and then edited ./lib/wx/include/msw-2.4/wx/setup.h to turn off HAVE_FNMATCH_H then I got errors compiling src/common/imagjpeg.cpp, so I reconfigured to turn jpeg off, cause I was getting annoyed by this point CXXFLAGS=-mno-cygwin LDFLAGS=-mno-cygwin ./configure --disable-shared --disable-debug --without-libjpeg Configured wxWidgets 2.4.1 for `i686-pc-cygwin' Which GUI toolkit should wxWidgets use? MSW Should wxWidgets be compiled in debug mode? no Should wxWidgets be linked as a shared library? no Should wxWidgets be compiled in Unicode mode? no What level of wxWidgets compatibility should be enabled? wxWidgets 2.0 no wxWidgets 2.2 yes Which libraries should wxWidgets use? jpeg no png builtin regex builtin tiff sys zlib builtin then I edited setup.h again then did the same for tiff CXXFLAGS=-mno-cygwin LDFLAGS=-mno-cygwin ./configure --disable-shared --disable-debug --without-libtiff then I edited setup.h again jpeg is probly useful for xchm, but I'm too lazy to compile & install a library for mingw so I left it out by this time I was wishing I had a better computer, or a distcc cluster for compiling wxWidgets So then I configured xchm using the following (CFLAGS is needed cause the test program for -lchm is a c, not c++ one) CXXFLAGS='-mno-cygwin -DWIN32' CFLAGS='-mno-cygwin -DWIN32' LDFLAGS=-mno-cygwin ./configure This didn't work cause the _ffs function didn't show up (same as what is in your config.log) hmm, seems that you have to change chm_lib.c so ffs is compiled in, even when __GNUC__ is defined simply change #elif defined(WIN32) to #endif #if defined(WIN32) then the wx headers could not be found so I added a -I to the xchm configure & reconfigured CXXFLAGS='-mno-cygwin -DWIN32 -I/usr/local/include/' CFLAGS='-mno-cygwin -DWIN32 -I/usr/local/include/' LDFLAGS=-mno-cygwin ./configure then I had a problem with chmfile.h In file included from chmapp.cpp:25: chmfile.h: At global scope: chmfile.h:199: parse error before `&' token chmfile.h:206: `u_int64_t' was not declared in this scope chmfile.h:206: parse error before `,' token make[2]: *** [chmapp.o] Error 1 make[2]: Leaving directory `/e/home/pabs/patches/xchm-0.8.8/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/e/home/pabs/patches/xchm-0.8.8' make: *** [all] Error 2 so I added the following to chmfile.h typedef unsigned long long u_int64_t; typedef unsigned int u_int32_t; typedef unsigned short u_int16_t; then I got the following during linkage g++ -mno-cygwin -DWIN32 -I/usr/local/include/ -W -Wall -mno-cygwin -o xchm.exe chmapp.o chmfile.o chmframe.o chmfshandler.o chminputstream.o contenttaghandler.o chmfontdialog.o chmsearchpanel.o chmhtmlwindow.o chmfinddialog.o chmindexpanel.o chmlistctrl.o -L/usr/local/lib -mno-cygwin /usr/local/lib/libwxmsw241.a -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32 -ladvapi32 -lwsock32 -lkernel32 -luser32 -lgdi32 -lcomdlg32 -lchm /usr/local/lib/libwxmsw241.a(pngwrite.o)(.text+0xb21):pngwrite.c: undefined reference to `setjmp' /usr/local/lib/libwxmsw241.a(pngwrite.o)(.text+0xd0c):pngwrite.c: undefined reference to `setjmp' /usr/local/lib/libwxmsw241.a(pngread.o)(.text+0x19e):pngread.c: undefined reference to `setjmp' /usr/local/lib/libwxmsw241.a(pngread.o)(.text+0x3e5):pngread.c: undefined reference to `setjmp' /usr/local/lib/libwxmsw241.a(pngerror.o)(.text+0x2df):pngerror.c: undefined reference to `_impure_ptr' /usr/local/lib/libwxmsw241.a(pngerror.o)(.text+0x343):pngerror.c: undefined reference to `_impure_ptr' /usr/local/lib/libwxmsw241.a(pngerror.o)(.text+0x36b):pngerror.c: undefined reference to `_impure_ptr' /usr/local/lib/libwxmsw241.a(pngerror.o)(.text+0x3cf):pngerror.c: undefined reference to `_impure_ptr' /usr/local/lib/libwxmsw241.a(pngerror.o)(.text+0x423):pngerror.c: undefined reference to `_impure_ptr' /usr/local/lib/libwxmsw241.a(pngwutil.o)(.text+0x1853):pngwutil.c: more undefined references to `_impure_ptr' follow make[2]: *** [xchm.exe] Error 1 make[2]: Leaving directory `/e/home/pabs/patches/xchm-0.8.8/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/e/home/pabs/patches/xchm-0.8.8' make: *** [all] Error 2 then I went back and reconfigured wxWidgets without libpng (& edited setup.h & recompiled, reinstalled) CXXFLAGS=-mno-cygwin LDFLAGS=-mno-cygwin ./configure --disable-shared --disable-debug --with-mingw --without-libjpeg --without-libtiff --without-libpng hmm, it's 8:43 maybe I should give up already /me prays no more wxWidgets compiles are needed w000t it works, despite being fucking 3,854 Kb hmm, spose it's smaller than the wxWidgets plus the other dynamically linked xchm: http://bonedaddy.net/pabs3/screenshots/xchm-3.png http://bonedaddy.net/pabs3/xchm.exe making an installer & reducing the exe size is something for another day I think. Bye, Pabs