mwarning / p2p-gui

A remote web interface for MLdonkey, aMule, rTorrent, Transmission and giFT.
http://p2p-gui.sourceforge.net/
15 stars 3 forks source link

Help needed with building #2

Open puigru opened 8 months ago

puigru commented 8 months ago

Hello! I've recently run into this project and indeed found it contain a lot of interesting code.

I was mainly interested in it as a replacement for aMule's own web interface which doesn't work very well in my experience. I understand that this codebase is really old, so it might not be much of an improvement. However, I wanted to give it a try, if anything to learn about aMule's EC protocol. The binary releases are, of course, really old so they're no good for a modern Linux install, as they're linked with ancient versions of shared libraries. So anyway, I started ~blasting~ building.

I came across a good set of instructions on how to set up a D1 build environment with Tango here: https://www.dsource.org/projects/tango/wiki/ManualLinuxInstall

I've been using a Dockerfile for this based on Debian Bookworm, with the latest release of D1 to avoid certain compiler bugs and the latest Tango trunk. This allows for compilation of p2p-gui's master (almost), I have to remove a single private access modifier in api/File.d, but after that it works... until it gets to linking, and here's where I get stuck with this:

#6 3.554 dmd -ofp2p-gui-linux webserver/HttpServer.d webserver/HttpResponse.d webserver/HttpRequest.d utils/Utils.d utils/GeoIP.d utils/Timer.d utils/Selector.d utils/Storage.d utils/Debug.d utils/json/JsonAdditional.d utils/json/JsonParser.d utils/json/JsonBuilder.d webcore/Main.d webcore/MainUser.d webcore/UserManager.d webcore/DiskFile.d webcore/Webroot.d webcore/SettingsWrapper.d webcore/Dictionary.d webcore/JsonRPC.d webcore/Session.d webcore/SessionManager.d webcore/ClientManager.d webcore/Logger.d  api/Client.d api/Host.d api/Node.d api/Node_.d api/File.d api/File_.d api/Meta.d api/Setting.d api/Connection.d api/User.d api/User_.d api/Search.d api/Search_.d  clients/mldonkey/MLDonkey.d clients/mldonkey/InBuffer.d clients/mldonkey/OutBuffer.d clients/mldonkey/MLUtils.d clients/mldonkey/model/MLConsoleLine.d clients/mldonkey/model/MLTags.d clients/mldonkey/model/MLAddr.d clients/mldonkey/model/MLFileInfo.d clients/mldonkey/model/MLNetworkInfo.d clients/mldonkey/model/MLFileFormat.d clients/mldonkey/model/MLServerInfo.d clients/mldonkey/model/MLClientInfo.d clients/mldonkey/model/MLClientKind.d clients/mldonkey/model/MLClientState.d clients/mldonkey/model/MLSearch.d clients/mldonkey/model/MLResult.d clients/mldonkey/model/MLSharedFile.d clients/mldonkey/model/MLSetting.d clients/mldonkey/model/MLPartFile.d  clients/amule/aMule.d clients/amule/ECPacket.d clients/amule/ECTag.d clients/amule/ECCodes.d clients/amule/RLE_Data.d clients/amule/Utf8_Numbers.d clients/amule/model/AFileInfo.d clients/amule/model/AServerInfo.d clients/amule/model/AResultInfo.d clients/amule/model/ASearchInfo.d clients/amule/model/APreference.d clients/amule/model/AClientInfo.d  clients/rtorrent/rTorrent.d clients/rtorrent/XmlOutput.d clients/rtorrent/XmlInput.d clients/rtorrent/rDownload.d clients/rtorrent/rSetting.d clients/rtorrent/rTracker.d clients/rtorrent/rPeer.d  clients/gift/giFT.d clients/gift/giFTParser.d clients/gift/model/giFTFile.d clients/gift/model/giFTSearch.d clients/gift/model/giFTResult.d clients/gift/model/giFTNetwork.d  clients/transmission/Transmission.d clients/transmission/TTorrent.d clients/transmission/TTracker.d clients/transmission/TFile.d clients/transmission/TPeer.d clients/transmission/TSetting.d  webguis/plex/PlexGui.d webguis/plex/HtmlElement.d webguis/plex/HtmlUtils.d webguis/plex/HtmlSettings.d webguis/plex/HtmlFileBrowser.d webguis/plex/HtmlDownloads.d webguis/plex/HtmlServers.d webguis/plex/HtmlClients.d webguis/plex/HtmlTitlebar.d webguis/plex/HtmlConsole.d webguis/plex/HtmlContainer.d webguis/plex/HtmlSearches.d webguis/plex/HtmlPageRefresh.d webguis/plex/HtmlUserManagement.d webguis/plex/HtmlClientSettings.d webguis/plex/HtmlModuleSettings.d webguis/plex/HtmlUserSettings.d webguis/plex/HtmlAddLinks.d webguis/plex/HtmlUploads.d webguis/plex/HtmlQuickConnect.d webguis/plex/HtmlTranslator.d webguis/plex/HtmlLogout.d  webguis/jay/JayGui.d  webguis/clutch/ClutchGui.d    -version=Tango -version=JAY_GUI -version=PLEX_GUI -version=CLUTCH_GUI -version=MLDONKEY -version=AMULE -version=RTORRENT -version=GIFT -version=TRANSMISSION -L-L/usr/lib -I/usr/include -L-lz -L-lssl
#6 3.943 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-io-stream-Zlib-release.o): in function `_D5tango2io6stream4Zlib9ZlibInput4readMFAvZm':
#6 3.943 ./tango/io/stream/Zlib.d:(.text._D5tango2io6stream4Zlib9ZlibInput4readMFAvZm+0x94): undefined reference to `inflate'
#6 3.943 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-io-stream-Zlib-release.o): in function `_D5tango2io6stream4Zlib9ZlibInput7kill_zsMFZv':
#6 3.943 ./tango/io/stream/Zlib.d:(.text._D5tango2io6stream4Zlib9ZlibInput7kill_zsMFZv+0x1a): undefined reference to `inflateEnd'
#6 3.943 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-io-stream-Zlib-release.o): in function `_D5tango2io6stream4Zlib10ZlibOutput5writeMFAvZm':
#6 3.943 ./tango/io/stream/Zlib.d:(.text._D5tango2io6stream4Zlib10ZlibOutput5writeMFAvZm+0x56): undefined reference to `deflate'
#6 3.943 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-io-stream-Zlib-release.o): in function `_D5tango2io6stream4Zlib10ZlibOutput6commitMFZv':
#6 3.943 ./tango/io/stream/Zlib.d:(.text._D5tango2io6stream4Zlib10ZlibOutput6commitMFZv+0x56): undefined reference to `deflate'
#6 3.943 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-io-stream-Zlib-release.o): in function `_D5tango2io6stream4Zlib10ZlibOutput7kill_zsMFZv':
#6 3.943 ./tango/io/stream/Zlib.d:(.text._D5tango2io6stream4Zlib10ZlibOutput7kill_zsMFZv+0x1a): undefined reference to `deflateEnd'
#6 3.943 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-util-compress-c-zlib-release.o): in function `_D5tango4util8compress1c4zlib11deflateInitFPS5tango4util8compress1c4zlib8z_streamiZi':
#6 3.944 ./tango/util/compress/c/zlib.d:(.text._D5tango4util8compress1c4zlib11deflateInitFPS5tango4util8compress1c4zlib8z_streamiZi+0x23): undefined reference to `deflateInit_'
#6 3.944 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-util-compress-c-zlib-release.o): in function `_D5tango4util8compress1c4zlib11inflateInitFPS5tango4util8compress1c4zlib8z_streamZi':
#6 3.944 ./tango/util/compress/c/zlib.d:(.text._D5tango4util8compress1c4zlib11inflateInitFPS5tango4util8compress1c4zlib8z_streamZi+0x18): undefined reference to `inflateInit_'
#6 3.944 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-util-compress-c-zlib-release.o): in function `_D5tango4util8compress1c4zlib12deflateInit2FPS5tango4util8compress1c4zlib8z_streamiiiiiZi':
#6 3.944 ./tango/util/compress/c/zlib.d:(.text._D5tango4util8compress1c4zlib12deflateInit2FPS5tango4util8compress1c4zlib8z_streamiiiiiZi+0x34): undefined reference to `deflateInit2_'
#6 3.944 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-util-compress-c-zlib-release.o): in function `_D5tango4util8compress1c4zlib12inflateInit2FPS5tango4util8compress1c4zlib8z_streamiZi':
#6 3.944 ./tango/util/compress/c/zlib.d:(.text._D5tango4util8compress1c4zlib12inflateInit2FPS5tango4util8compress1c4zlib8z_streamiZi+0x23): undefined reference to `inflateInit2_'
#6 3.944 /usr/bin/ld: /opt/dmd/bin/../lib/libtango.a(tango-util-compress-c-zlib-release.o): in function `_D5tango4util8compress1c4zlib15inflateBackInitFPS5tango4util8compress1c4zlib8z_streamiPhZi':
#6 3.945 ./tango/util/compress/c/zlib.d:(.text._D5tango4util8compress1c4zlib15inflateBackInitFPS5tango4util8compress1c4zlib8z_streamiPhZi+0x24): undefined reference to `inflateBackInit_'
#6 3.945 collect2: error: ld returned 1 exit status
#6 3.945 --- errorlevel 1
#6 3.950 make: *** [Makefile:183: dmd-linux] Error 1

At a glance, it seems easy enough. Surely ld is just unable to find zlib, but nope. If we add -L--verbose to dmd's flags in dmd.conf, we see the following:

#6 4.193 attempt to open /usr/lib/libz.so failed
#6 4.193 attempt to open /usr/lib/libz.a failed
#6 4.193 attempt to open /opt/dmd/bin/../lib/libz.so failed
#6 4.193 attempt to open /opt/dmd/bin/../lib/libz.a failed
#6 4.193 attempt to open /usr/lib/gcc/x86_64-linux-gnu/12/libz.so failed
#6 4.193 attempt to open /usr/lib/gcc/x86_64-linux-gnu/12/libz.a failed
#6 4.193 attempt to open /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libz.so succeeded
#6 4.193 /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libz.so

Which seems to indicate that it is in fact finding the right object file for it, and -lz is the very last of DMD's linker options in the Makefile, which is supported by the advice I was able to find online, so I'm very much stumped here.

I have considered the fact that perhaps the zlib function definitions that Tango is trying to import have changed between the version it references (1.2.3) and the latest version (1.2.13). Unfortunately, I wasn't able to spot any significant changes in zlib.h. In addition, manually installing zlib1g and zlib1g-dev 1.2.3 from archive.debian.org didn't make a difference.

This is the aforementioned Dockerfile I'm using: https://gist.github.com/puigru/608f94da8079b3e2d6d169bf62d16641

I've also tried to build it with both the DMD and LDC bundles of the latest version of Tango (0.99.9): http://downloads.dsource.org/projects/tango/0.99.9/tango-0.99.9-bin-linux-with-dmd.1.056.tar.gz (with a 32-bit toolchain) http://downloads.dsource.org/projects/tango/0.99.9/tango-0.99.9-bin-linux64-with-ldc.1.056.tar.gz This requires a version of p2p-gui prior to ca3c57cd5fc3777d692996ade0c543b2a01db735. Sadly, the end result was the same.

As a last ditch effort, I replaced /usr/bin/ld with a copy of lld. This actually resulted in a binary file. However, it immedially segfaults, inspecting it with nm reveals that many imported symbols (including those of zlib) are not linked properly, output. So the segfault is not very surprising.

I'd really appreciate if you could take a look and share any insight. This is my first time attempting to build a D project (interesting pick, I know).

Thank you!

mwarning commented 8 months ago

Hi, this is a blast from the past. :-)

I suspect that Tango might need to be compiled with some flag. But it has been a long time ago. I can try in the evening.

mwarning commented 8 months ago

hm, I cannot get it to compile. If you figure it out, please let me know.

rodin-andrei commented 5 months ago

Hello, puigru I wrote message to instagram and Facebook. Read pls.