ygrek / mldonkey

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

fail build with ocaml 4.06.0 #27

Closed sl1pkn07 closed 4 years ago

sl1pkn07 commented 6 years ago
  ./configure \
    --prefix=/usr \
    --enable-minimum \
    --enable-upnp-natpmp \
    --enable-bzip2 \
    --enable-magic \
    --enable-donkeysui \
    --disable-rpath \
    --enable-checks \
    --enable-pthread
Configuring MLDonkey 3.1.6.git - SCM: release-3-1-6-1-g9faec66d completed.

Network modules:
 - eDonkey           enabled (eMule SUI enabled)
 - BitTorrent                disabled
 - FileTP (aka wget)         disabled
 - Fasttrack                 disabled
 - Gnutella                  disabled - unmaintained
 - Gnutella2                 disabled - unmaintained
 - Direct Connect            disabled
 - 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     enabled
 - graphical stats           disabled

Compilers:
 - OCaml version     4.06.0 
 - gcc version       7.3.1
 - g++ version       7.3.1

\nNow execute 'make' to start compiling. Good luck!
Compiling CryptoPP.cc can take several minutes, on slow machines up to half an hour.
/usr/bin/ocamlc.opt -unsafe-string -w -3 -linkall -o ocamlpp.byte \
     -custom bigarray.cma unix.cma str.cma nums.cma -ccopt "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -D_FORTIFY_SOURCE=2" -cclib "-lz  " -cclib -lbz2 -ccopt "-pthread" \
  \
  \
  \
  \
  \
  \
-I build         tools/ocamlpp.cmo  
File "_none_", line 1:
Error: Cannot find file nums.cma
make: *** [Makefile:3819: ocamlpp.byte] Error 2
ygrek commented 6 years ago

If you are using opam - install the library with opam install num, else if you don't need bittorrent - apply the above patch, else wait until all dependencies are decoupled and managed with opam.. (no eta)

sl1pkn07 commented 6 years ago

ok, fixed. install ocaml-num like you say, througth package manager, did the trick and now build without problems

greetings

olafhering commented 4 years ago

Was this change really runtime-tested?

For me only this works for 4.03..4.07:

--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -28,8 +28,12 @@ NO_LIBS_opt=
 NO_STATIC_LIBS_opt=
 NO_CMXA=

-LIBS_byte=-custom bigarray.cma unix.cma str.cma nums.cma
-LIBS_opt= bigarray.cmxa unix.cmxa str.cmxa nums.cmxa
+LIBS_byte=-custom bigarray.cma unix.cma str.cma
+LIBS_byte += -I +num
+LIBS_opt= bigarray.cmxa unix.cmxa str.cmxa
+LIBS_opt += -I +num
+LIBS_byte +=$(shell cd "`ocamlc -where`";for i in nums.cma  num/num.cma ;do test -f $$i||continue;echo "`basename $$i`";break;done)
+LIBS_opt  +=$(shell cd "`ocamlc -where`";for i in nums.cmxa num/num.cmxa;do test -f $$i||continue;echo "`basename $$i`";break;done)

 BIGARRAY_LIBS_opt=bigarray.cmxa
 BIGARRAY_LIBS_byte=bigarray.cma
@@ -93,7 +97,7 @@ SRC_FILETP=src/networks/fileTP
 SUBDIRS=$(EXTLIB) $(CDK) $(BITSTRING) $(LIB) $(RSS) $(XML) $(NET) tools \
    $(COMMON) $(DRIVER) $(MP3) src/config/$(OS_FILES)

-INCLUDES += $(foreach file, $(SUBDIRS), -I $(file)) -I +camlp4
+INCLUDES += $(foreach file, $(SUBDIRS), -I $(file)) -I +camlp4 -I +num

 CFLAGS:=$(CFLAGS) $(CONFIG_INCLUDES) $(GTKCFLAGS) $(GD_CFLAGS)
ygrek commented 4 years ago

It is change to build procedure, what do you mean runtime-tested? As a title suggests it was a fix for older ocaml, 4.08 was not present when this was implemented. Show your error details.

olafhering commented 4 years ago

Maybe my comment was not clear. Without any change, my pkg builds up to 4.05. With my change it builds up to 4.07. With this change I do not see how it would fix build with 4.06 and 4.07. Maybe just the very specific config of the OP.

I am not a used of mldonkey. Do users generally expect the BitTorrent protocol to be supported?

ygrek commented 4 years ago

Ok, thanks for clarification. Yes, BT is expected to work. What package/distro is this? Your patch doesn't look good, in particular -I +num will definitely break builds in newer OCaml. It would help to see your full ./configure and build log.

olafhering commented 4 years ago

This change will appear in packman for openSUSE, once Tumbleweed upgrades ocaml from 4.05 to something newer. With my change the package builds fine, up to 4.07.

olafhering commented 4 years ago

I'm not clear how a -I +num would break anything, the additional num package has to be present either way. It could be moved into a BitTorrent-only section, but it should not hurt other configurations AFAICS.

ygrek commented 4 years ago

I will look into this before next release, thanks for the patch!

ygrek commented 4 years ago

it does break build if include dir is not present..

Bad -I option: /home/ygrek/.opam/4.10.0+default-unsafe-string/lib/ocaml/num: No such file or directory

Apparently with different setups it is installed in different places.

Proper solution would be part of bigger issue of bundling all dependencies with opam bundle or such.

olafhering commented 4 years ago

More bundling is unlikely a proper fix.

Converting the thing to dune to lift this thing into 2020, and removing all bundes, would look like a proper fix.

ygrek commented 4 years ago

I will add the code to find include directory where num is installed and make a release, and deal with proper handling of dependencies after that

ygrek commented 4 years ago

@olafhering if you could test the above fix that would be great