2025-07-21 01:22 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002673Spring engineGeneralpublic2011-10-02 18:37
Reporterdansan 
Assigned Toabma 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version0.82.7.1 
Target VersionFixed in Version 
Summary0002673: bundled zlib (minizip) breakage on gentoo
DescriptionNot sure this is a spring bug, or a gentoo one -> please help clarify. If it's a gentoo bug, I'll contact the package maintainers.

Because of https://bugs.gentoo.org/show_bug.cgi?id=383179 the ON and OF macros of zlib where made internal by a gentoo maintainer. Spring bundels parts of zlib (minizip?), but still links against system-zlib. That results in breakage:

--------------------------------------------------------------

Scanning dependencies of target minizip
[ 33%] Building C object rts/lib/minizip/CMakeFiles/minizip.dir/unzip.c.o
In file included from /gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/unzip.h:57:0,
                 from /gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/unzip.c:42:
/gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/ioapi.h:38:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OF'
/gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/ioapi.h:39:34: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OF'
/gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/ioapi.h:40:35: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'OF'
[..]
/gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/unzip.c:341:34: error: 'zlib_filefunc_def' has no member named 'zseek_file'
/gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/unzip.c:341:69: error: 'zlib_filefunc_def' has no member named 'opaque'
[..]
/gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/unzip.c:1557:30: error: 'zlib_filefunc_def' has no member named 'zread_file'
/gentoo/tmp/build/working/portage/games-strategy/spring-0.82.7.1/work/spring_0.82.7.1/rts/lib/minizip/unzip.c:1557:59: error: 'zlib_filefunc_def' has no member named 'opaque'
make[2]: *** [rts/lib/minizip/CMakeFiles/minizip.dir/unzip.c.o] Error 1
make[1]: *** [rts/lib/minizip/CMakeFiles/minizip.dir/all] Error 2
make: *** [all] Error 2

--------------------------------------------------------------

Question: is "SpanKY" right, and "ON" and "OF" macros should not be used? Or should spring bundle complete zlib or don't bundle it at all?
Steps To Reproduce$ emerge '>=sys-libs/zlib-1.2.5.1-r1'
$ emerge games-strategy/spring

If you're not using gentoo:
$ sed -i -r 's:\<(O[FN])\>:_Z_\1:g' /usr/include/zconf.h /usr/include/zlib.h
Additional Informationdaniel@maya ~ $ diff /usr/portage/sys-libs/zlib/zlib-1.2.5.1.ebuild /usr/portage/sys-libs/zlib/zlib-1.2.5.1-r1.ebuild
3c3
< # $Header: /var/cvsroot/gentoo-x86/sys-libs/zlib/zlib-1.2.5.1.ebuild,v 1.1 2011/09/11 18:49:38 vapier Exp $
---
> # $Header: /var/cvsroot/gentoo-x86/sys-libs/zlib/zlib-1.2.5.1-r1.ebuild,v 1.1 2011/09/16 21:40:42 vapier Exp $
69a70,73
>
> # clean up namespace a little #383179
> # we do it here so we only have to tweak 2 files
> sed -i -r 's:\<(O[FN])\>:_Z_\1:g' "${D}"/usr/include/*.h
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0007432

hoijui (reporter)

jk's idea for the fix (using the system supplied minizip library and include dir, if available):
https://github.com/spring/spring/commit/ec2e0e1c82e1378dc3c376f70e7159b374fb1d30

it is relatively likely that there are bugs in the implementation, as i was not able to test it (did not yet update gentoo.. too tired ;-) ).
i guess jk will test it soon, if you (dansan) are faster, it would not hurt either. ;-)
.. but these bugs should be small, and easy to fix.

~0007435

dansan (reporter)

Seems it compiles, but doesn't link:

daniel@maya /Media/tmp/spring-git $ make -k spring
[ 2%] Built target sound
[ 9%] Built target streflop
[ 11%] Built target lua
[ 11%] Built target 7zip
[ 11%] Built target oscpack
[ 11%] Built target md5
[ 11%] Built target lobby
[ 22%] Built target assimp
Linking CXX executable ../../../spring
CMakeFiles/engine-default.dir/__/__/Lua/LuaZip.cpp.o: In function `LuaZipFileWriter::meta_write(lua_State*)':
/Media/tmp/spring-git/rts/Lua/LuaZip.cpp:212: undefined reference to `zipWriteInFileInZip'
CMakeFiles/engine-default.dir/__/__/Lua/LuaZip.cpp.o: In function `LuaZipFileWriter::meta_gc(lua_State*)':
/Media/tmp/spring-git/rts/Lua/LuaZip.cpp:169: undefined reference to `zipClose'
CMakeFiles/engine-default.dir/__/__/Lua/LuaZip.cpp.o: In function `LuaZipFileWriter::meta_open(lua_State*)':
/Media/tmp/spring-git/rts/Lua/LuaZip.cpp:188: undefined reference to `zipOpenNewFileInZip'
CMakeFiles/engine-default.dir/__/__/Lua/LuaZip.cpp.o: In function `LuaZipFileWriter::PushNew(lua_State*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, void*)':
/Media/tmp/spring-git/rts/Lua/LuaZip.cpp:138: undefined reference to `zipOpen'
CMakeFiles/engine-default.dir/__/__/Sim/Path/Default/PathEstimator.cpp.o: In function `CPathEstimator::WriteFile(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/Media/tmp/spring-git/rts/Sim/Path/Default/PathEstimator.cpp:866: undefined reference to `zipOpen'
/Media/tmp/spring-git/rts/Sim/Path/Default/PathEstimator.cpp:869: undefined reference to `zipOpenNewFileInZip'
/Media/tmp/spring-git/rts/Sim/Path/Default/PathEstimator.cpp:872: undefined reference to `zipWriteInFileInZip'
/Media/tmp/spring-git/rts/Sim/Path/Default/PathEstimator.cpp:876: undefined reference to `zipWriteInFileInZip'
/Media/tmp/spring-git/rts/Sim/Path/Default/PathEstimator.cpp:879: undefined reference to `zipWriteInFileInZip'
/Media/tmp/spring-git/rts/Sim/Path/Default/PathEstimator.cpp:881: undefined reference to `zipCloseFileInZip'
/Media/tmp/spring-git/rts/Sim/Path/Default/PathEstimator.cpp:882: undefined reference to `zipClose'
CMakeFiles/engine-default.dir/__/__/System/LoadSave/LuaLoadSaveHandler.cpp.o: In function `CLuaLoadSaveHandler::SaveEntireFile(char const*, char const*, void const*, int, bool)':
/Media/tmp/spring-git/rts/System/LoadSave/LuaLoadSaveHandler.cpp:154: undefined reference to `zipOpenNewFileInZip'
/Media/tmp/spring-git/rts/System/LoadSave/LuaLoadSaveHandler.cpp:157: undefined reference to `zipWriteInFileInZip'
/Media/tmp/spring-git/rts/System/LoadSave/LuaLoadSaveHandler.cpp:160: undefined reference to `zipCloseFileInZip'
CMakeFiles/engine-default.dir/__/__/System/LoadSave/LuaLoadSaveHandler.cpp.o: In function `CLuaLoadSaveHandler::SaveGame(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/Media/tmp/spring-git/rts/System/LoadSave/LuaLoadSaveHandler.cpp:69: undefined reference to `zipOpen'
/Media/tmp/spring-git/rts/System/LoadSave/LuaLoadSaveHandler.cpp:79: undefined reference to `zipClose'
/Media/tmp/spring-git/rts/System/LoadSave/LuaLoadSaveHandler.cpp:99: undefined reference to `zipClose'
collect2: ld returned 1 exit status
make[3]: *** [spring] Error 1
make[3]: Target `rts/builds/default/CMakeFiles/engine-default.dir/build' not remade because of errors.
make[2]: *** [rts/builds/default/CMakeFiles/engine-default.dir/all] Error 2
[ 22%] Built target LegacyCpp-AIWrapper
[ 25%] Built target C-AIInterface
[ 27%] Built target Java-AIInterface-native
[ 27%] Built target Java-AIInterface-java
[ 27%] Built target Java-AIInterface
[ 29%] Built target AAI
[ 43%] Built target Cpp-AIWrapper
[ 43%] Built target JavaOO-AIWrapper-java
[ 43%] Built target JavaOO-AIWrapper
[ 43%] Built target NullOOJavaAI-SRC
[ 43%] Built target NullOOJavaAI-BIN
[ 43%] Built target NullOOJavaAI
[ 43%] Built target CppTestAI
[ 43%] Built target NullAI
[ 43%] Built target NullJavaAI-SRC
[ 43%] Built target NullJavaAI-BIN
[ 43%] Built target NullJavaAI
[ 45%] Built target RAI
[ 45%] Built target headlessStubs
[ 50%] Built target unitsync
Using build directory: /Media/tmp/spring-git/base/ ...
Creating spring/bitmaps.sdz
Creating springcontent.sdz
Creating maphelper.sdz
Creating cursors.sdz
[ 50%] Built target gamedata
make[2]: Target `rts/builds/default/CMakeFiles/spring.dir/all' not remade because of errors.
make[1]: *** [rts/builds/default/CMakeFiles/spring.dir/rule] Error 2
make[1]: Target `spring' not remade because of errors.
make: *** [spring] Error 2

~0007436

hoijui (reporter)

please try:
make -k spring VERBOSE=1

i hope that would give us a better idea for why it fails.

~0007437

dansan (reporter)

http://pastebin.com/Q20SwTXG

I don't see any "-l*zip*" (don't know what this should be exactly).

~0007438

dansan (reporter)

I found the "zipWriteInFileInZip" symbol in /usr/lib64/libminizip.so, so I just appended "-lminizip" to the very loooong link line (http://pastebin.com/Q20SwTXG line 97) and voil?í - the compile runs through without any further problem :)

~0007440

jK (developer)

do a:
make clean
cmake .

~0007441

dansan (reporter)

I did:

git pull
git pull --rebase (nothing happens)
make clean
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="${CFLAGS}"
cmake .
make spring

still missing "-lminizip" when linking spring executable

~0007442

hoijui (reporter)

jk, it worked for you?

maybe add some of these in cmake:
Message("VAR_NAME: ${VAR_NAME}")

eg. in rts/build/cmake/FindMiniZip.cmake and in rts/builds/default/CMakeLists.txt
mostly for SPRING_MINIZIP_LIBRARY, i guess.

~0007445

jK (developer)

Last edited: 2011-10-02 07:02

yup, first I had the same issue, but after deleting cmake cachefiles it worked fine

PS:
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="${CFLAGS}"
this is foobar, first spring overrides CXXFLAGS, second spring is very sensitive to such flags for syncing (that's the reason why it overrides them).

~0007446

hoijui (reporter)

ahh nice :-)

dansan, you should use:
git fetch
# This next line is optional, but gives you an idea
# of what was added since the commit you used so far
gitk develop origin/develop &
#git stash
git rebase origin/develop
#git stash pop
rm CMakeCache.txt
cmake .
make spring


the way you used "git pull" suggests you think it does what git fetch is actually doing.

as a little help (this is true if you remote tracking branch is origin/develop):
"git pull" == "git fetch && git merge origin/develop"
"git pull --rebase" == "git fetch && git rebase origin/develop"
rebase is recommended (there is some git way to make it the default), whenever the two involved branches have the same name (in this case, develop & origin/develop -> same name)

~0007452

spliff (reporter)

Last edited: 2011-10-02 16:28

Having the same issue building on gentoo with latest develop branch.

I've uploaded a verbose build log here: http://warriorhut.org/spring/testing/logs/zlib-build.log

~0007453

spliff (reporter)

in ./rts/lib/minizip/CMakeLists.txt:

        SetGlobal(SPRING_MINIZIP_INCLUDE_DIR ${MINIZIP_INCLUDE_DIR}")
        SetGlobal(SPRING_MINIZIP_LIBRARY ${MINIZIP_LIBRARY}")

Could those unmatched quotes be the problem?

~0007454

abma (administrator)

should work now, thanks spliff!

https://github.com/spring/spring/commit/410d4c426f81bc383fece5b5fff687559cc7b3a6
+Notes

-Issue History
Date Modified Username Field Change
2011-09-25 23:17 dansan New Issue
2011-09-29 00:29 hoijui Note Added: 0007432
2011-09-29 13:19 dansan Note Added: 0007435
2011-09-29 20:02 hoijui Note Added: 0007436
2011-09-29 22:07 dansan Note Added: 0007437
2011-09-29 22:17 dansan Note Added: 0007438
2011-09-30 16:58 jK Note Added: 0007440
2011-10-01 09:05 dansan Note Added: 0007441
2011-10-01 11:13 hoijui Note Added: 0007442
2011-10-02 07:00 jK Note Added: 0007445
2011-10-02 07:02 jK Note Edited: 0007445
2011-10-02 09:54 hoijui Note Added: 0007446
2011-10-02 16:19 spliff Note Added: 0007452
2011-10-02 16:28 spliff Note Edited: 0007452
2011-10-02 18:11 spliff Note Added: 0007453
2011-10-02 18:37 abma Note Added: 0007454
2011-10-02 18:37 abma Status new => resolved
2011-10-02 18:37 abma Resolution open => fixed
2011-10-02 18:37 abma Assigned To => abma
+Issue History