|
From: Greg C. <chi...@mi...> - 2000-10-06 13:38:56
|
Wayne Davison wrote: > > Hi folks. I'm a bit new to the mingw thing, and though I've been able to > get the latest libxml (2.2.4) and pcre (3.4) compiled into DLLs, I've run > into a weird problem when I try to link them (plus zlib) into another DLL > of mine and then into my 4 programs. One of the programs works just > great, but two of them won't load at all (see below) and the 4th crashes > on load (which I haven't looked into yet). > > The error I'm getting is that the program is "not in the proper format". > Can someone enlighten me as to what this might mean? Does this indicate > that the compiler generated a bad file? Or might this mean that I'm doing > something stupid? Any hints on what I should be on the look-out for would > be appreciated. (In case you're curious, the programs I'm working on are > the "rbmake" project at sourceforge -- http://rbmake.sourceforge.net/ .) > > [I hope this isn't a FAQ or something, but the mailing-list search isn't > working at the moment, and I couldn't find anything that appeared to > mention this with a quick manual search.] It may be related to a problem I had. Since the mailing-list search isn't working for you, I'll copy the entire thing below. -------- Original Message -------- Subject: [mingw] Fixed [Was: "program is in an invalid format"] Date: Mon, 24 Jul 2000 23:18:47 -0400 From: Greg Chicares <chi...@mi...> Reply-To: mi...@eg... To: mi...@eg... References: <386...@mi...> Responding to my own message from 1999 Dec 28, in case anyone else encounters a similar problem. I suspect it's particularly likely to come up when porting a borland OWL application (as this one was). The problem was windres. Switching to the sdk compiler and running windres on its output was the fix. I found that idea in a message from Bruce Dodson dated 2000 Mar 23. In a little more detail: this rule: %.res.o : %.rc %.rh windres \ --include-dir $(a_bunch_of_include_dirs) \ --define __GNUG__ \ --use-temp-file \ -I rc -i $< \ -O coff -o $@ gives the problem reproducibly; this set does not: %.res : %.rc %.rh /sdktools/rc \ /i/whateverl/include \ /d__GNUG__ \ /r /fo$@ $< ren $(srcdir)/%.res %.res # Rename command is used above because SDK outputs '.RES' # but I try to keep everything lower-case e.g. '.res' %.res.o : %.res windres --use-temp-file -I res -O coff -i $< -o $@ In both cases, I link as follows: ihsnodll.exe : $(a_bunch_of_dependencies) $(CXX) \ -o $@ \ $(objects) \ myresources.res.o \ $(CXXFLAGS) $(LIBS) $(LDFLAGS) \ Greg Chicares wrote: > > My program compiles and links without errors, but > when I try to run it I see: > > ...a message box: > Error Starting Program > The C:\TEST\PMGCC1.EXE file appears to be corrupt. > Reinstall the file, and then try again. > > ...on the command line: > The program is in an invalid format, and cannot be run. > It may be damaged. > > ...when trying to run it in gdb: > Starting program: C:\test/pmgcc1.exe > Error creating process C:\test/pmgcc1.exe, (error 11) > > What should I do to fix this? > > Background info: > > Unmodified gcc2.95.2 (crtdll version) Same problem with 2.95.2-1 (msvcrt version) > win95 OSR2 > > Static linked--the only DLLs used are part of the OS > > Program compiles and runs correctly using borland C++ 5.02 > > Source is about 100 KLOC; binary is 6.6MB On Thu, 23 Mar 2000 20:43:33 -0800, "Bruce Dodson" <bru...@bi...> wrote: > > I recently added a VERSIONINFO resource to one of my programs, > and just noticed that QuickView is now able to read the EXE > correctly. Take out the resource, and it's garbled. Add it > back in, and it's fixed. Perhaps some others could try this > on their apps and see if it is just a coincidence? I have no VERSIONINFO resource, and the QuickView display of my .exe is not garbled. |