diasurgical / devilution

Diablo devolved - magic behind the 1996 computer game
Other
8.79k stars 920 forks source link

diabloui.lib file not recognized: File truncated #46

Closed cengiz-io closed 6 years ago

cengiz-io commented 6 years ago

Hello,

I'm getting a linker error with MSYS2 on Windows 10.

Here are the last lines from make output:

...
i686-w64-mingw32-gcc -c -fpermissive -Wno-write-strings -o Source/scrollrt.o Source/scrollrt.cpp
i686-w64-mingw32-gcc -c -fpermissive -Wno-write-strings -o 3rdParty/PKWare/implode.o 3rdParty/PKWare/implode.cpp
i686-w64-mingw32-gcc -c -fpermissive -Wno-write-strings -o 3rdParty/PKWare/explode.o 3rdParty/PKWare/explode.cpp
i686-w64-mingw32-gcc -L./ -o devilution.exe Source/init.o Source/drlg_l4.o Source/stores.o Source/diablo.o Source/dead.o Source/encrypt.o Source/error.o Source/towners.o Source/town.o Source/trigs.o Source/drlg_l1.o Source/setmaps.o Source/help.o Source/effects.o Source/inv.o Source/logging.o Source/sync.o Source/missiles.o Source/player.o Source/minitext.o Source/plrmsg.o Source/nthread.o Source/msg.o Source/automap.o Source/fault.o Source/appfat.o Source/cursor.o Source/monster.o Source/lighting.o Source/quests.o Source/mpqapi.o Source/capture.o Source/track.o Source/sound.o Source/engine.o Source/portal.o Source/themes.o Source/palette.o Source/gamemenu.o Source/sha.o Source/spells.o Source/debug.o Source/loadsave.o Source/restrict.o Source/pack.o Source/world.o Source/multi.o Source/wave.o Source/drlg_l3.o Source/msgcmd.o Source/objects.o Source/dthread.o Source/doom.o Source/items.o Source/path.o Source/dx.o Source/textdat.o Source/pfile.o Source/movie.o Source/codec.o Source/gmenu.o Source/tmsg.o Source/mainmenu.o Source/gendung.o Source/control.o Source/drlg_l2.o Source/interfac.o Source/scrollrt.o 3rdParty/PKWare/implode.o 3rdParty/PKWare/explode.o diabloui.lib storm.lib -lgdi32 -lversion -ldiabloui -lstorm
diabloui.lib: file not recognized: File truncated
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:10: devilution.exe] Error 1

I've followed the instructions from Support/INSTALL_windows.md.

$ uname -a
MINGW32_NT-10.0 <HOSTNAME> 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys

$ gcc -v
Using built-in specs.
COLLECT_GCC=C:\msys64\mingw32\bin\gcc.exe
COLLECT_LTO_WRAPPER=C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/7.3.0/lto-wrapper.exe
Target: i686-w64-mingw32
Configured with: ../gcc-7.3.0/configure --prefix=/mingw32 --with-local-prefix=/mingw32/local --build=i686-w64-mingw32 --host=i686-w64-mingw32 --target=i686-w64-mingw32 --with-native-system-header-dir=/mingw32/i686-w64-mingw32/include --libexecdir=/mingw32/lib --enable-bootstrap --with-arch=i686 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --enable-libstdcxx-filesystem-ts=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw32 --with-mpfr=/mingw32 --with-mpc=/mingw32 --with-isl=/mingw32 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld --disable-sjlj-exceptions --with-dwarf2
Thread model: posix
gcc version 7.3.0 (Rev2, Built by MSYS2 project)

Any ideas?

cengiz-io commented 6 years ago

I have copied my DiabloUI.dll into the working directory and it seems to be the correct DLL

$ file diabloui.dll
diabloui.dll: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
cengiz-io commented 6 years ago

Two findings after creating this issue:

  1. diabloui.lib and storm.lib are created as empty files whenever dlltool fails. Had to remove them to retry creating them.

  2. dlltool can not find as binary, that seems to be the actual problem.

    $ i686-w64-mingw32-dlltool -v -d 3rdParty/Storm/Source/storm_gcc.def -D storm.dll -l storm.lib
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: Using file: C:\msys64\usr\bin\i686-w64-mingw32-as
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: Processing def file: 3rdParty/Storm/Source/storm_gcc.def
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: LIBRARY: Storm base: ffffffff
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: Processed def file
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: Processing definitions
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: Processed definitions
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: Creating library file: storm.lib
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: run: C:\msys64\usr\bin\i686-w64-mingw32-as   -o dqwkh.o dqwkh.s
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: No such file or directory
    C:\msys64\usr\bin\i686-w64-mingw32-dlltool.exe: CreateProcess

Maybe we should also link i686-w64-mingw32-as.exe to /usr/bin ?

Saibamen commented 6 years ago

https://stackoverflow.com/questions/5713894/file-not-recognized-file-truncated-gcc-error

Saibamen commented 6 years ago

And try to update your GCC/MSYS

cengiz-io commented 6 years ago

@Saibamen thanks for the suggestion. However it's not related to GCC version nor MSYS version.

silverhammermba commented 6 years ago

The symlink fixed it for me, though I see this is now mentioned in the windows install file.