Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error: /opt/local/bin/ocamlc: OCaml has been configured with -force-safe-string: -unsafe-string is not available #105

Closed
barracuda156 opened this issue Aug 8, 2024 · 15 comments

Comments

@barracuda156
Copy link
Contributor

--->  Configuring mldonkey
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_mldonkey/mldonkey/work/mldonkey-3-1-7-2" && ./configure --prefix=/opt/local --enable-gui=newgui2 
Running Autoconf (autoconf)...
configure.in:9: warning: The macro 'AC_CONFIG_HEADER' is obsolete.
configure.in:9: You should run autoupdate.
./lib/autoconf/status.m4:719: AC_CONFIG_HEADER is expanded from...
configure.in:9: the top level
configure.in:954: warning: The macro 'AC_TRY_LINK' is obsolete.
configure.in:954: You should run autoupdate.
./lib/autoconf/general.m4:2918: AC_TRY_LINK is expanded from...
configure.in:954: the top level
configure.in:994: warning: The macro 'AC_TRY_LINK' is obsolete.
configure.in:994: You should run autoupdate.
./lib/autoconf/general.m4:2918: AC_TRY_LINK is expanded from...
configure.in:994: the top level
configure.in:1027: warning: The macro 'AC_TRY_LINK' is obsolete.
configure.in:1027: You should run autoupdate.
./lib/autoconf/general.m4:2918: AC_TRY_LINK is expanded from...
configure.in:1027: the top level
configure.in:1065: warning: The macro 'AC_TRY_LINK' is obsolete.
configure.in:1065: You should run autoupdate.
./lib/autoconf/general.m4:2918: AC_TRY_LINK is expanded from...
lib/m4sugar/m4sh.m4:690: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
./lib/autoconf/general.m4:2270: AC_CACHE_CHECK is expanded from...
aclocal.m4:851: AM_ICONV_LINK is expanded from...
aclocal.m4:906: AM_ICONV is expanded from...
configure.in:1065: the top level
configure.in:1065: warning: The macro 'AC_TRY_COMPILE' is obsolete.
configure.in:1065: You should run autoupdate.
./lib/autoconf/general.m4:2845: AC_TRY_COMPILE is expanded from...
lib/m4sugar/m4sh.m4:690: _AS_IF_ELSE is expanded from...
lib/m4sugar/m4sh.m4:697: AS_IF is expanded from...
./lib/autoconf/general.m4:2249: AC_CACHE_VAL is expanded from...
aclocal.m4:906: AM_ICONV is expanded from...
configure.in:1065: the top level
configure.in:1072: warning: The macro 'AC_TRY_LINK' is obsolete.
configure.in:1072: You should run autoupdate.
./lib/autoconf/general.m4:2918: AC_TRY_LINK is expanded from...
configure.in:1072: the top level
configure.in:1091: warning: The macro 'AC_LANG_C' is obsolete.
configure.in:1091: You should run autoupdate.
./lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
aclocal.m4:937: ACX_PTHREAD is expanded from...
configure.in:1091: the top level
configure.in:1091: warning: The macro 'AC_TRY_LINK' is obsolete.
configure.in:1091: You should run autoupdate.
./lib/autoconf/general.m4:2918: AC_TRY_LINK is expanded from...
aclocal.m4:937: ACX_PTHREAD is expanded from...
configure.in:1091: the top level
configure.in:1587: warning: AC_OUTPUT should be used without arguments.
configure.in:1587: You should run autoupdate.
Running m4 to generate Makefile...
Arguments to configure:  '--enable-option-checking=fatal' '--prefix=/opt/local' '--enable-gui=newgui2' 'CC=ccache /opt/local/bin/gcc-mp-14' 'CFLAGS=-pipe -Os -arch ppc' 'LDFLAGS=-L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc' 'CPPFLAGS=-I/opt/local/include' 'CXX=ccache /opt/local/bin/g++-mp-14' 'CXXFLAGS=-pipe -Os -arch ppc'
checking for gcc... ccache /opt/local/bin/gcc-mp-14
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether ccache /opt/local/bin/gcc-mp-14 accepts -g... yes
checking for ccache /opt/local/bin/gcc-mp-14 option to enable C11 features... none needed
checking how to run the C preprocessor... ccache /opt/local/bin/gcc-mp-14 -E
checking build system type... powerpc-apple-darwin10.0.0d2
checking host system type... powerpc-apple-darwin10.0.0d2
checking for sed... sed

--------------------------------
     Checking system tools.
--------------------------------
checking for ranlib... ranlib
checking for gmake... gmake
checking for make... (cached) gmake
checking if gmake is GNU make ... yes
checking for bzip2... bzip2
checking for gzip... (cached) bzip2
checking for perl... /opt/local/bin/perl
checking for rpmbuild... no
checking for rpm... no
checking for wget... wget
----------------------------------------
     Checking system tools finished.
----------------------------------------

--------------------------------
     Checking OCaml compiler.
--------------------------------
checking for ocamlc.opt... no
checking for ocamlc... ocamlc
checking for camlp4... /opt/local/bin/camlp4
checking for ocamlopt.opt... no
checking for ocamlopt... no
checking for ocamldep... /opt/local/bin/ocamldep
checking for ocamllex.opt... no
checking for ocamllex... /opt/local/bin/ocamllex
checking for ocamlyacc... /opt/local/bin/ocamlyacc
checking for ocamldoc... /opt/local/bin/ocamldoc
checking for ocamlmktop... /opt/local/bin/ocamlmktop
checking for camlp4... (cached) /opt/local/bin/camlp4
checking for camlp4of... /opt/local/bin/camlp4of
-------------------------------------------
     Checking OCaml 4.14.1 finished.
-------------------------------------------
checking ocaml num library... found -I /opt/local/lib/ocaml/site-lib/num

----------------------------------
     Checking system headers.
----------------------------------
checking for ccache /opt/local/bin/gcc-mp-14 option to enable large file support... none needed
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking whether byte ordering is bigendian... yes
checking for setrlimit... yes
checking for getrlimit... yes
checking for strerror_r... yes
checking for strerror... yes
checking for posix_fallocate... no
checking for byteswap.h... no
checking for sys/utsname.h... yes
checking for arpa/inet.h... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... yes
checking for sys/resource.h... yes
checking for netinet/in_systm.h... yes
checking for netinet/in.h... yes
checking for netinet/ip.h... yes
checking for sys/poll.h... yes
checking for poll... yes
checking for sys/vfs.h... no
checking for sys/statvfs.h... yes
checking for sys/param.h... yes
checking for sys/mount.h... yes
-------------------------------------------
     Checking system headers finished.
-------------------------------------------

-----------------------------------
     Checking system libraries.
-----------------------------------
----- checking zlib (required)
checking for inflate in -lz... yes
checking for zlib.h... yes
checking for zlibVersion in -lz... yes
----- checking bzlib (optional)
checking for bzlib.h... yes
checking for BZ2_bzReadOpen in -lbz2... yes
checking for BZ2_bzlibVersion in -lbz2... yes
----- checking libmagic (GNU file) (optional)
checking for ccache /opt/local/bin/gcc-mp-14 options needed to detect all undeclared functions... none needed
checking for magic.h... yes
checking for magic_file in -lmagic... yes
checking whether MAGIC_ERROR is declared... yes
----- checking gd (optional)
checking for gdlib-config... no
checking for gd.h... yes
checking for gdImageCreate in -lgd... no
configure: not found, trying another method
checking for gdImageCreate in -lgd... yes
checking for libpng-config... libpng-config
checking for png_create_read_struct  in -lpng... yes
checking for gdImagePng in -lgd... no
configure: not found, trying another method
checking for gdImagePng in -lgd... yes
checking for png support in libgd... yes
checking for png_access_version_number in -lpng... yes
checking for jpeg_CreateCompress in -ljpeg... yes
checking for gdImageJpeg in -lgd... no
configure: not found, trying another method
checking for gdImageJpeg in -lgd... yes
checking for jpeg support in libgd... yes
----- checking iconv (optional)
checking for ld used by GCC... /opt/local/bin/ld
checking if the linker (/opt/local/bin/ld) is GNU ld... no
checking for shared library run path origin... done
checking for iconv... yes
checking how to link with libiconv... -liconv
checking for iconv declaration... 
         extern size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
checking for locale_charset... yes
checking for locale_charset in -lcharset... yes
checking for libcharset.h... yes
checking for langinfo.h... yes
checking for locale.h... yes
----- checking thread support (optional, strongly advised)
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... -D_THREAD_SAFE
checking for cc_r... ccache /opt/local/bin/gcc-mp-14
---------------------------------------------
     Checking system libraries finished.
---------------------------------------------

--------------------------------------
     Checking activated networks.
--------------------------------------
checking eDonkey... yes
checking whether the compiler supports GNU C++... yes
checking whether ccache /opt/local/bin/g++-mp-14 accepts -g... yes
checking for ccache /opt/local/bin/g++-mp-14 option to enable C++11 features... none needed
checking for ccache... ccache /opt/local/bin/g++-mp-14
checking eMule SUI... yes
checking whether ccache /opt/local/bin/g++-mp-14 accepts -fno-omit-frame-pointer... yes
checking whether ccache /opt/local/bin/g++-mp-14 accepts -mno-omit-leaf-frame-pointer... no
checking BitTorrent... yes
checking FileTP... yes
checking Fasttrack... yes
checking DirectConnect... yes
-----------------------------------------------
     Checking activated networks finished.
-----------------------------------------------
---------------------------------------------------------
Checking the libraries required to build the GTK GUI.
---------------------------------------------------------
checking for GTK+ - version >= 2.4.0... yes
checking for librsvg - version >= 2.4.0... yes
checking for native code lablgtk2... no
Do you want this script to try to download and install lablgtk2
LOCALLY in mldonkey directory ?
./configure: line 10456: read: read error: 0: Bad file descriptor
configure: creating ./config.status
config.status: creating Makefile.config
config.status: creating mldonkey.rc
config.status: creating ../src/utils/lib/autoconf.ml.new
config.status: creating ../src/utils/lib/gAutoconf.ml.new
config.status: creating ../src/utils/bitstring/bitstring.ml
config.status: creating ../src/utils/lib/magic.ml
config.status: creating ../src/networks/donkey/donkeySui.ml
config.status: creating ../src/daemon/driver/driverGraphics.ml
config.status: creating ../packages/rpm/mldonkey.spec
config.status: creating ../packages/rpm/Makefile
config.status: creating ../packages/slackware/mldonkey.options
config.status: creating config.h

Building dependencies (if it blocks, try 'gmake depend' to see the problem)
Building dependencies fails: try: 'gmake depend'

Configuring MLDonkey 3.1.7 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     enabled

Compilers:
 - OCaml version     4.14.1 - byte code
 - ccache /opt/local/bin/gcc-mp-14 version       14.2.0
 - ccache /opt/local/bin/g++-mp-14 version       14.2.0


Now execute 'gmake' to start compiling. Good luck!

To compile a static code execute:     gmake mlnet.byte.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.
--->  Building mldonkey
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_mldonkey/mldonkey/work/mldonkey-3-1-7-2" && /usr/bin/make -j6 -w all 
make: Entering directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_mldonkey/mldonkey/work/mldonkey-3-1-7-2'
ocamlc -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 -I /opt/local/lib/ocaml/site-lib/num -c tools/ocamlpp.ml
/opt/local/bin/ocamlc: OCaml has been configured with -force-safe-string: -unsafe-string is not available.
Usage: ocamlc <options> <files>
Try 'ocamlc --help' for more information.
make: *** [tools/ocamlpp.cmo] Error 2
@ygrek
Copy link
Owner

ygrek commented Aug 8, 2024

this is 3.1.7 release afaics
use latest git

@barracuda156
Copy link
Contributor Author

@ygrek Could you make a new release? I will test a build from the master locally today, but for updating it in MacPorts release is preferable.

@ygrek
Copy link
Owner

ygrek commented Aug 9, 2024

ironing out remaining issues, more confirmation that it builds would help to build confidence to make new release :)

@barracuda156
Copy link
Contributor Author

@ygrek From b9a1237 commit, the build fails here:

:info:build /opt/local/bin/camlp4of build/bitstring.cma src/utils/bitstring/bitstring_persistent.cmo src/utils/bitstring/pa_bitstring.cmo -impl src/networks/bittorrent/bTUdpTracker.mlp -o src/networks/bittorrent/bTUdpTracker.ml
:info:build /opt/local/bin/camlp4of build/bitstring.cma src/utils/bitstring/bitstring_persistent.cmo src/utils/bitstring/pa_bitstring.cmo -impl src/networks/donkey/donkeyNodesDat.mlp -o src/networks/donkey/donkeyNodesDat.ml
:info:build ocamlc -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60-70   -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 -I /opt/local/lib/ocaml/site-lib/num -c src/daemon/common/giftDecoding.ml
:info:build ocamlc -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60-70   -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 -I /opt/local/lib/ocaml/site-lib/num -c src/networks/bittorrent/bTUdpTracker.ml
:info:build ocamlc -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60-70   -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 -I /opt/local/lib/ocaml/site-lib/num -c src/networks/donkey/donkeyNodesDat.ml
:info:build File "src/networks/donkey/donkeyNodesDat.mlp", line 3, characters 5-18:
:info:build 3 | open CommonOptions
:info:build          ^^^^^^^^^^^^^
:info:build Error: Unbound module CommonOptions
:info:build make: *** [src/networks/donkey/donkeyNodesDat.cmo] Error 2
:info:build make: *** Waiting for unfinished jobs....

There is also this, though it does not make the build err out:

:info:configure checking for native code lablgtk2... no
:info:configure Do you want this script to try to download and install lablgtk2
:info:configure LOCALLY in mldonkey directory ?
:info:configure ./configure: line 10301: read: read error: 0: Bad file descriptor
:info:configure configure: creating ./config.status
:info:configure config.status: creating Makefile.config

@barracuda156
Copy link
Contributor Author

@ygrek The log from trying to build from the latest commit:
main-3.log

@FabioLolix
Copy link

more confirmation that it builds would help to build confidence to make new release :)

@ygrek some days ago mldonkey builded fine from git master since many months, thanks!

@barracuda156
Copy link
Contributor Author

It would be cool if bytecode build also works. (Though at the moment I do not know if the failure is specific to bytecode target.)

@lulol
Copy link

lulol commented Aug 14, 2024

@barracuda156 How and where are you calling configure?

There is also this, though it does not make the build err out:

This should just skip building the GUI due to missing LABLGTK2.

:info:configure checking for native code lablgtk2... no
:info:configure Do you want this script to try to download and install lablgtk2
:info:configure LOCALLY in mldonkey directory ?
:info:configure ./configure: line 10301: read: read error: 0: Bad file descriptor
:info:configure configure: creating ./config.status
:info:configure config.status: creating Makefile.config

When LABLGTK2 is not installed, that error is generated while reading stdin for user input and fail if was previously redirected and not available (like when using nohup).

if test "$BATCH" = "no"; then read i <&1; else i=yes; fi

For this you could try preinstalling these packages available for your MacOS release, but don't know if it will be enough since for ubuntu needs liblablgtk2-ocaml-dev liblablgtk2-gl-ocaml-devand liblablgtk2-gnome-ocaml-dev

@barracuda156
Copy link
Contributor Author

@ygrek lablgtk2 is available, but byte code one. It looks to me like a wrong syntax rather than a missing dep, though I can mistake here.

How and where are you calling configure

The port does not do anything fancy: https://github.com/macports/macports-ports/blob/1403a20ac7e8a1b0ea144bf0da9ca8232cd5f400/net/mldonkey/Portfile (I have updated the version locally and fixed compiler choice, but otherwise it is the same).
So it will run ./configure from extracted directory. That should be reflected in the build log, which I shared above.

@lulol
Copy link

lulol commented Aug 14, 2024

@barracuda156 The syntax is correct. The error is due to stdin not being readable for the configure script. Adding the required dependencies would just skip the user input request avoiding this issue. But since lablgtk2 dev is not available for your system the only option is to download and build them.

I'm not familiar with your build chain, but since it's not interactive my guess is that you should set the --enable-batch switch because while building the configure script won't be able to accept the user input expected. That way won't request any user input (always assume yes) and hopefully will download and build the required dependencies without asking.
That won't solve the other issue above though.

@lulol
Copy link

lulol commented Aug 15, 2024

@barracuda156 @ygrek

File "src/networks/donkey/donkeyNodesDat.ml", line 3, characters 5-18:
3 | open CommonOptions
         ^^^^^^^^^^^^^
Error: Unbound module CommonOptions

Those errors disappear when telling make to use only one job (-j1). #48

JFTR building the current master with a github workflow job and linux runner with 2 cores (several times) without any modification, never found any such issue though.

@ygrek
Copy link
Owner

ygrek commented Aug 15, 2024

oh, i didn't notice it is make -j6, thanks @lulol
indeed, see #48, parallel builds are not officially supported (and I am not going to work on it, better switch to dune eventually and get parallel builds for free)

@barracuda156
Copy link
Contributor Author

@lulol @ygrek Thanks, I will try building on a single core.

@barracuda156
Copy link
Contributor Author

Okay, from b9a1237 and with parallel build disabled, compilation succeeds (with some warning along the way):

ocamlc -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60-70  -a -o build/driver.cma     src/utils/cdk/gdstubs.o     -ccopt "-L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -I/opt/local/include" -cclib "-lcharset -lz  -liconv" -cclib -lbz2 -ccopt "-D_THREAD_SAFE "     src/utils/cdk/gd.cmo    src/daemon/driver/driverGraphics_gd.cmo    src/daemon/driver/driverGraphics.cmo    src/daemon/driver/driverInteractive.cmo    src/daemon/driver/driverCommands.cmo    src/daemon/driver/driverControlers.cmo    src/daemon/driver/driverInterface.cmo    src/daemon/driver/driverMain.cmo  
ocamlc -w +a-3-4-6-27-29-32-35-37-41-44-45-48-60-70  -linkall -o mlnet.byte \
	     -custom bigarray.cma unix.cma str.cma -I /opt/local/lib/ocaml/site-lib/num nums.cma -ccopt "-L/opt/local/lib -Wl,-headerpad_max_install_names -arch ppc -I/opt/local/include" -cclib "-lcharset -lz  -liconv" -cclib -lbz2 -ccopt "-D_THREAD_SAFE " \
	  \
	 -cclib "-lgd -lpng16 -ljpeg" -ccopt "" \
	 -cc 'ccache /opt/local/bin/g++-mp-14 -pipe -Os -arch ppc' -ccopt '-fno-omit-frame-pointer' \
	 -cclib -lmagic \
	  \
	  \
	-I build    build/extlib.cma    build/cdk.cma    build/bitstring.cma    build/magic.cma    build/common.cma    build/client.cma    build/core.cma    build/driver.cma        src/daemon/common/commonMain.cmo  
make: Leaving directory `/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_net_mldonkey/mldonkey/work/mldonkey-b9a1237bba932c3ecdbb3b1766b8bb93e9931174'

@barracuda156
Copy link
Contributor Author

I close the issue as completed. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants