MaddTheSane / NetHack-Mac-OS-X

Native NetHack Mac OS X (Cocoa) port for 10.5 (Leopard) and upwards
14 stars 7 forks source link

Build fails with linker error: undefined symbols "_gzclose", "_gzopen", etc #2

Closed danielthompson closed 7 years ago

danielthompson commented 7 years ago

First, thanks for taking the time to update this app for NetHack 3.6! I've been meaning to get into it for a while but just hadn't.

Anyway, the issue I'm running into is that cloning the repo and executing the installation instructions, i.e.

cd sys/unix
sh setup.sh hints/macosx-cocoa
cd ../..
make all

results in a lot of output, then:

gcc  -o nethack monst.o objects.o allmain.o alloc.o apply.o artifact.o attrib.o ball.o bones.o botl.o cmd.o dbridge.o decl.o detect.o dig.o display.o dlb.o do.o do_name.o do_wear.o dog.o dogmove.o dokick.o dothrow.o drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o extralev.o files.o fountain.o hack.o hacklib.o invent.o light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o monstr.o mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o role.o rumors.o save.o shk.o shknam.o sit.o sounds.o sp_lev.o spell.o sys.o steal.o steed.o teleport.o timeout.o topten.o track.o trap.o u_init.o uhitm.o vault.o vision.o vis_tab.o weapon.o were.o wield.o windows.o wizard.o worm.o worn.o write.o zap.o posixregex.o  ioctl.o unixmain.o unixtty.o unixunix.o unixres.o DirectionWindowController.o NSImage+FlippedDrawing.o EquipmentView.o NetHackCocoaAppDelegate.o ExtCommandWindowController.o NotesWindowController.o FlippedView.o PlayerSelectionWindowController.o InputWindowController.o StatsView.o MainView.o TooltipWindow.o MainWindowController.o YesNoWindowController.o MenuWindowController.o MessageWindowController.o wincocoa.o Action.o NhItem.o NSIndexPath+Z.o NhItemGroup.o NSString+NetHack.o NhMapWindow.o NSString+Z.o NhMenuWindow.o NhCommand.o NhObject.o NhEventQueue.o NhStatusWindow.o NhInventory.o NhWindow.o inventory.o CocoaMain.o tile.o WinCocoaAdditions.o SwiftNetHack\ bridge.o NhEvent.o TileSet.o NhTextInputEvent.o ZDirection.o NhYnQuestion.o  version.o -framework Cocoa -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/ -rpath /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/ -rpath @executable_path/../Frameworks  
Undefined symbols for architecture x86_64:
  "_gzclose", referenced from:
      _docompress_file in files.o
  "_gzopen", referenced from:
      _docompress_file in files.o
  "_gzread", referenced from:
      _docompress_file in files.o
  "_gzwrite", referenced from:
      _docompress_file in files.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [Sysunix] Error 1
make: *** [nethack] Error 2

Full output here: nethackcocoa make.txt

I'm on OSX 10.11.5 with swiftc 3.0.2 and xcode 8.2.1:

[~/Downloads/NetHack-Mac-OS-X-madds-1] => swiftc -v
Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9
[~/Downloads/NetHack-Mac-OS-X-madds-1] => gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I'm not really that familiar with c or swift, but another user on another project with (apparently) this same issue says that zlib needs to be referenced - link. What's the best way to fix this?

MaddTheSane commented 7 years ago

I mainly use the Xcode project to build source files.

For this specific problem, it looks like zlib isn’t being linked. I’ll look into it. On Jan 26, 2017, at 7:39 PM, Daniel A. Thompson notifications@github.com<mailto:notifications@github.com> wrote:

First, thanks for taking the time to update this app for NetHack 3.6! I've been meaning to get into it for a while but just hadn't.

Anyway, the issue I'm running into is that cloning the repo and executing the installation instructions, i.e.

cd sys/unix sh setup.sh hints/macosx-cocoa cd ../.. make all

results in a lot of output, then:

gcc -o nethack monst.o objects.o allmain.o alloc.o apply.o artifact.o attrib.o ball.o bones.o botl.o cmd.o dbridge.o decl.o detect.o dig.o display.o dlb.o do.o do_name.o do_wear.o dog.o dogmove.o dokick.o dothrow.o drawing.o dungeon.o eat.o end.o engrave.o exper.o explode.o extralev.o files.o fountain.o hack.o hacklib.o invent.o light.o lock.o mail.o makemon.o mapglyph.o mcastu.o mhitm.o mhitu.o minion.o mklev.o mkmap.o mkmaze.o mkobj.o mkroom.o mon.o mondata.o monmove.o monstr.o mplayer.o mthrowu.o muse.o music.o o_init.o objnam.o options.o pager.o pickup.o pline.o polyself.o potion.o pray.o priest.o quest.o questpgr.o read.o rect.o region.o restore.o rip.o rnd.o role.o rumors.o save.o shk.o shknam.o sit.o sounds.o sp_lev.o spell.o sys.o steal.o steed.o teleport.o timeout.o topten.o track.o trap.o u_init.o uhitm.o vault.o vision.o vis_tab.o weapon.o were.o wield.o windows.o wizard.o worm.o worn.o write.o zap.o posixregex.o ioctl.o unixmain.o unixtty.o unixunix.o unixres.o DirectionWindowController.o NSImage+FlippedDrawing.o EquipmentView.o NetHackCocoaAppDelegate.o ExtCommandWindowController.o NotesWindowController.o FlippedView.o PlayerSelectionWindowController.o InputWindowController.o StatsView.o MainView.o TooltipWindow.o MainWindowController.o YesNoWindowController.o MenuWindowController.o MessageWindowController.o wincocoa.o Action.o NhItem.o NSIndexPath+Z.o NhItemGroup.o NSString+NetHack.o NhMapWindow.o NSString+Z.o NhMenuWindow.o NhCommand.o NhObject.o NhEventQueue.o NhStatusWindow.o NhInventory.o NhWindow.o inventory.o CocoaMain.o tile.o WinCocoaAdditions.o SwiftNetHack\ bridge.o NhEvent.o TileSet.o NhTextInputEvent.o ZDirection.o NhYnQuestion.o version.o -framework Cocoa -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/ -rpath /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/ -rpath @executable_path/../Frameworks Undefined symbols for architecture x86_64: "_gzclose", referenced from: _docompress_file in files.o "_gzopen", referenced from: _docompress_file in files.o "_gzread", referenced from: _docompress_file in files.o "_gzwrite", referenced from: _docompress_file in files.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[1]: [Sysunix] Error 1 make: [nethack] Error 2

Full output here: nethackcocoa make.txthttps://github.com/MaddTheSane/NetHack-Mac-OS-X/files/734288/nethackcocoa.make.txt

I'm on OSX 10.11.5 with swiftc 3.0.2 and xcode 8.2.1:

[~/Downloads/NetHack-Mac-OS-X-madds-1] => swiftc -v Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1) Target: x86_64-apple-macosx10.9 [~/Downloads/NetHack-Mac-OS-X-madds-1] => gcc -v Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.0.0 (clang-800.0.42.1) Target: x86_64-apple-darwin15.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I'm not really that familiar with c or swift, but another user on another project with (apparently) this same issue says that libz needs to be referenced - linkhttps://groups.google.com/forum/#!topic/minisat/IjuttJjYvL4. What's the best way to fix this?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/MaddTheSane/NetHack-Mac-OS-X/issues/2, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AAr6hHwUwGTEQvt7nO-OqEXZbhYRrxqBks5rWVjxgaJpZM4LvYhU.

danielthompson commented 7 years ago

Ah, didn't see the Xcode project. Opening it in Xcode does build and run successfully!

One note, the initial tileset is a little bit off:

screen shot 2017-01-27 at 09 31 14

Switching to the others seems to be fine though. Thanks!