ygrek / mldonkey

cross-platform multi-network p2p daemon (previously at http://mldonkey.sourceforge.net/)
Other
246 stars 45 forks source link

-unsafe-string usage #46

Closed HinTak closed 3 months ago

HinTak commented 4 years ago

Fedora 32's ocaml 4.10 was built with -force-safe-string and reject -unsafe-string as argument.

david-geiger commented 4 years ago

Hi,

Same issue here on Mageia Cauldron with ocaml 4.10 and if we remove '-unsafe-string' argument we get:

/usr/bin/ocamlc.opt -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60 -I src/utils/extlib -I src/utils/cdk -I src/utils/bitstring -I src/utils/lib -I src/utils/ocamlrss -I src/utils/xml-light -I src/utils/net -I tools -I src/daemon/common -I src/daemon/driver -I src/utils/mp3tagui -I src/config/unix -I src/gtk2/gui -I src/gtk2/gui/x11 -I src/gtk2/gui/win32 -I icons/rsvg -I +lablgtk2 -I src/networks/direct_connect -I src/networks/fasttrack -I src/networks/fileTP -I src/networks/bittorrent -I src/networks/donkey -I +camlp4 -c src/utils/lib/syslog.mli /usr/bin/ocamlopt.opt -inline 10 -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60 -I src/utils/extlib -I src/utils/cdk -I src/utils/bitstring -I src/utils/lib -I src/utils/ocamlrss -I src/utils/xml-light -I src/utils/net -I tools -I src/daemon/common -I src/daemon/driver -I src/utils/mp3tagui -I src/config/unix -I src/gtk2/gui -I src/gtk2/gui/x11 -I src/gtk2/gui/win32 -I icons/rsvg -I +lablgtk2 -I src/networks/direct_connect -I src/networks/fasttrack -I src/networks/fileTP -I src/networks/bittorrent -I src/networks/donkey -I +camlp4 -c src/utils/lib/syslog.ml File "src/utils/lib/syslog.ml", line 197, characters 50-53: 197 | ignore (write loginfo.fd str 0 (String.length str)); ^^^ Error: This expression has type bytes but an expression was expected of type string make: *** [Makefile:5443: src/utils/lib/syslog.cmx] Error 2 error: Bad exit status from /home/iurt/rpmbuild/tmp/rpm-tmp.E2Y86L (%build)

Regards, David

turulomio commented 3 years ago

Hi. I'm using Gentoo and I have the same problem. It crashes after configure script Any tips?. This is my console output Thank you

Configuring MLDonkey 3.1.7.git - SCM: release

-3-1-7-2-5-g333868a1 completed.

Network modules:

  • eDonkey enabled (eMule SUI enabled)
  • BitTorrent enabled
  • FileTP (aka wget) enabled
  • Fasttrack enabled
  • Gnutella disabled - unmaintained
  • Gnutella2 disabled - unmaintained
  • Direct Connect enabled
  • Open Napster disabled - currently not usable
  • Soulseek disabled - currently not usable
  • OpenFT disabled - currently not usable

Core features:

  • zlib (required) enabled
  • threads enabled
  • bzip2 enabled
  • iconv enabled
  • libmagic enabled
  • upnp & natpmp disabled
  • graphical stats enabled
    • png support enabled
    • jpg support disabled

Compilers:

  • OCaml version 4.11.1
  • x86_64-pc-linux-gnu-gcc version 10.2.0
  • x86_64-pc-linux-gnu-g++ version 10.2.0

\nNow execute 'gmake' to start compiling. Good luck!

To compile a static code execute: gmake mlnet.static To produce a release tarball execute: gmake release.mlnet.static To clean the build directory execute: gmake maintainerclean

Compiling CryptoPP.cc can take several minutes, on slow machines up to half an hour.

Source configured. Compiling source in /var/tmp/portage/net-p2p/mldonkey-9999/work/mldonkey-9999 ... /usr/bin/ocamlc.opt -unsafe-string -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60 -I src/utils/extlib -I src/utils/cdk -I src/utils/bitstring -I src/utils/lib -I src/utils/ocamlrss -I src/utils/xml-light -I src/utils/net -I tools -I src/daemon/common -I src/daemon/driver -I src/utils/mp3tagui -I src/config/unix -I src/networks/direct_connect -I src/networks/fasttrack -I src/networks/fileTP -I src/networks/bittorrent -I src/networks/donkey -I +camlp4 -c tools/ocamlpp.ml /usr/bin/ocamlc.opt: OCaml has been configured with -force-safe-string: -unsafe-string is not available.

turulomio commented 3 years ago

I could compile (Using Gentoo) Adding --disable-force-safe-string to ocaml-4.11.1 compilation. Here is my ebuild

bestlem commented 3 years ago

Same issue with macOS under macports (the released portfile has other issues but fixing them just gives this error re -unsafe-string)

HinTak commented 3 years ago

Fwiw, I have opted to let it download the older ocaml and build it, just before using it to build mldonkey : see https://github.com/ygrek/mldonkey/issues/49

HinTak commented 3 years ago

See also discussion in regarding future plans https://github.com/ygrek/mldonkey/pull/50

FabioLolix commented 1 year ago

Arch Linux have update OCaml to v5.0 and MLDonkey no longer build

/usr/bin/ocamlc.opt: -unsafe-string is not available since OCaml 5.0.

carlonluca commented 5 months ago

Is someone actively working on this in some branch? Or isn't this started yet?

carlonluca commented 3 months ago

Hello, I opened a branch to contribute a patch for this here: https://github.com/carlonluca/mldonkey/tree/immutable-strings.

With that patch I can build with immutable strings using ocaml up to version 4.14.1 and on debian bookworm, which uses ocaml 4.13.1.

Please note that I've never used ocaml before and that we are talking of a 2300-lines patch (https://github.com/carlonluca/mldonkey/compare/master...immutable-strings). It is impossible for me to test everything. I'm currently testing this build in my setup, on arm64, using my docker image based on debian bookworm (https://hub.docker.com/r/carlonluca/mldonkey). I'm testing the regular mldonkey webapp and my own angular client using the TCP interface (https://bugfreeblog.duckdns.org/2024/05/mldonkey-next.html).

If someone was interested in testing, please let me the know the result.

HinTak commented 3 months ago

@carlonluca thanks for the massive effort. For my part I just have a small update - with upgrade to fc40, the c compiler has gotten stricter, and some of the older warnings become fatal errors. So to build older ocaml (then use it to build mldonkey), one needs to add a "permissive" switch to allow buggy code to compiling without aborting. I am not comfortable going in that direction, so didn't post about it. To continue using older ocaml properly probably needs that looked at, so your work has come in the right time.

carlonluca commented 3 months ago

I drafted a PR in case someone wanted to discuss or report experiences. Unfortunately, I have other PRs open on this repo without answers, so I find it unlikely such a huge patch will ever be accepted. I will, however, merge it to my fork here shortly: https://github.com/carlonluca/mldonkey. Note that my fork also includes other patches, so use at your own risk.

dantefff commented 3 months ago

Your fork os the only one live code for mldonkey... So ...

ygrek commented 3 months ago

@carlonluca thanks a lot for the effort current status:

ygrek commented 3 months ago

pushed what I have to safe-string, will see how to combine these changes

carlonluca commented 3 months ago
  • my concern with your PR is that it patches vendored-in 3rd-party libraries, the proper solution would be to unvendor them altogether, next best solution is to re-vendor newer versions

Yes, I noticed some external projects were copy-pasted into mldonkey. I applied patches from upstream where possible.

  • and i really want to unvendor 3rd-party libs because it makes any changes much harder

I think this is more than reasonable. At the current state however, I'm not interested in doing any more work on my patch that is not a fix for a real bug I introduced. Anyone interested can however apply changes to my PR.

ygrek commented 3 months ago

please help to test #99

ygrek commented 3 months ago

fixed with #99