> On Sat, 2007-06-23 at 20:11 -0600, Ximsce wrote: >> Unfortunately, I have another newbie-type question. I am trying to >> compile zip using arm-wince-cegcc-gcc so that I can use it as a >> commandline tool.
Stop here and step back a bit. Are you sure you want a command line tool? Is this to integrate with another app? Perhaps a dll with just the zip/unzip functionality would fit? Read on, please. When I got to the linking phase, there was an error >> saying that -luser32 and -ladvapi32 could not be found. > That's because you have to port the software to Windows CE. You can't expect it to work without at least a bit of porting work. Danny Backx wrote: > Windows CE doesn't implement the same API as the desktop versions of > Windows; and they're packaged differently. Much of what I'd expect to be > system services are in coredll.dll on CE. > Danny's right on. You have to change the link command to not link into user32 and advapi32, but into the CE libs that implement the functions you need. Most usually are in coredll.dll. I usually do something like: arm-wince-mingw32ce-nm -A /opt/mingw32ce/arm-wince-mingw32ce/lib/*.a | grep <the function I want> ... to see where it is. Be prepared to see an empty result coming out of that command. >> After some >> searching, I grabbed these libraries from the mingw32 project (I realize >> doing so probably won't work once I put the application on the iPaq, but >> I just wanted to see if I could get it to compile). > > I am not sure of what you mean. Have you found binaries from Mingw ? > Then they're most likely compiled for an x86 processor which won't work > on your iPaq. Also I'd be surprised if you could link them. > 100% sure they won't work. >> Well, the libraries >> are found, but I get a bunch of "undefined reference" errors: >> >> zip.o:zip.c:(.text+0x307c): undefined reference to `setmode' >> zipup.o:zipup.c:(.text+0x77c): undefined reference to `setmode' >> zipup.o:zipup.c:(.text+0x958): undefined reference to `_sopen' >> win32.o:win32.c:(.text+0x168): undefined reference to `GetConsoleMode' >> win32.o:win32.c:(.text+0x1ac): undefined reference to `SetConsoleMode' >> win32.o:win32.c:(.text+0x21c): undefined reference to `SetConsoleMode' > > Actually I believe CE doesn't support some of these functions. The MSDN > docs I could find on GetConsoleMode appear to indicate that. > You're right. CE doesn't have those. If you use Pocket Console, you could use/port their lib to have GetConsoleMode, and other console functions. >> win32.o:win32.c:(.text+0x26c): undefined reference to `GetFullPathNameW' >> win32.o:win32.c:(.text+0x2c0): undefined reference to >> `GetVolumeInformationW' >> win32.o:win32.c:(.text+0x630): undefined reference to `_get_osfhandle' >> win32.o:win32.c:(.text+0x634): undefined reference to `GetFileType' >> win32.o:win32.c:(.text+0x664): undefined reference to `GetVersion' >> win32.o:win32.c:(.text+0x73c): undefined reference to >> `DosDateTimeToFileTime' >> win32.o:win32.c:(.text+0x7e4): undefined reference to >> `GetVolumeInformationW' >> win32.o:win32.c:(.text+0xbac): undefined reference to >> `GetVolumeInformationW' >> nt.o:nt.c:(.text+0x74): undefined reference to `OpenProcessToken' >> nt.o:nt.c:(.text+0xe8): undefined reference to `LookupPrivilegeValueW' >> nt.o:nt.c:(.text+0x12c): undefined reference to `AdjustTokenPrivileges' >> nt.o:nt.c:(.text+0x15c): undefined reference to `LookupPrivilegeValueW' >> nt.o:nt.c:(.text+0x180): undefined reference to `AdjustTokenPrivileges' >> nt.o:nt.c:(.text+0x1fc): undefined reference to `lstrlenA' >> nt.o:nt.c:(.text+0x288): undefined reference to `CreateFileA' >> nt.o:nt.c:(.text+0x2a8): undefined reference to `GetKernelObjectSecurity' >> nt.o:nt.c:(.text+0x300): undefined reference to >> `GetSecurityDescriptorLength' >> nt.o:nt.c:(.text+0x3fc): undefined reference to `GetVolumeInformationW' >> nt.o:nt.c:(.text+0x448): undefined reference to `lstrcpynA' >> nt.o:nt.c:(.text+0x52c): undefined reference to `GetDriveTypeW' >> nt.o:nt.c:(.text+0x564): undefined reference to `CreateFileA' >> nt.o:nt.c:(.text+0x58c): undefined reference to `GetKernelObjectSecurity' >> nt.o:nt.c:(.text+0x5e0): undefined reference to `GetKernelObjectSecurity' >> nt.o:nt.c:(.text+0x6c0): undefined reference to `CreateFileA' >> >> Many of these appear to be methods that come out of the w32api or the >> coredll. Also, the first one, 'setmode', is used in some of the source >> for cegcc, so I'm not sure why the linker can't find them here. > You need to port the package for it to work. Since you are getting undefined references to native Win32 functions, I would say that zip package builds OOTB with MSVC or MinGW. In that case, the package is already prepared to build in a pure Win32 environment. Am I right? I would port it to CE using mingw32ce. Stuff you'll need to learn: - Most win32 apis in WinCE only come in the wide version. No CreateFileA, only CreateFileW, etc, etc. You either port the code calling those functions, or provide a CreateFileA yourself as a wrapper around CreateFileW that converts the in/out parameters between ansi/wide. - On CE there is no 'current directory' notion. On cegcc, we do have it, because we provide a layer on top of coredll.dll (cegcc.dll) that takes care of the bookkeeping. Usually, the number of places in the code you have to remember this are very low. - No errno, but since the app seems to be ported to native win32, it should be already using GetLastError/SetLastError for the error handling. Again, cegcc does have an errno, because we provide a layer on top of coredll.dll that does the bookkeeping and converting from to {Get|Set}LastError. > We have _setmode but no setmode in the coredll.def. > > Danny > >> The >> command I'm using is: >> >> arm-wince-cegcc-gcc -ozip.exe -s zip.o crypt.o ttyio.o zipfile.o zipup.o >> fileio.o util.o crc32.o crctab.o globals.o deflate.o trees.o win32.o >> win32zip.o nt.o -luser32 -ladvapi32 >> Judging from the object name, ttyio.o would be the hardest to port, but maybe you can get by with simply disabling the code it implements. >> Sorry for abusing the list with debug/compile questions like this; I >> really appreciate your assistance, and hopefully I can figure out a way >> to return the favor. >> The best way you can return the favor is to contribute the port so others don't go through the same hassles. Cheers, Pedro Alves ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Cegcc-devel mailing list Cegcc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/cegcc-devel