ciao-lang/ciaopp

Build fails at ciaopp_client when using system-wide installation

ony opened this issue · 3 comments

ony commented

It looks like ciaopp.ciaopp_client build attempts to install ciaopp-client at CIAOROOT location

Output of ciao get ciaopp:

   fetching ciaopp source (master) from https://github.com/ciao-lang/ciaopp/archive/master.tar.gz
=> ciaopp: preparing build [bin]
=> ciaopp: building [bin]
   compiled src/ (105 modules)
   compiled domains/ (65 modules)
   compiled lib/ (7 modules)
   compiled spec/ (43 modules)
   compiled batch/ (7 modules)
   compiling ciaopp-dump (command)
   compiling ciaopp-batch (command)
   compiling ciaopp_master (command)
   compiling ciaopp_batch_report (command)
=> ciaopp.cmds: building [bin]
   compiling ciaopp (command)
=> ciaopp.ciaopp_client: building [bin]
{ERROR: system:$throw_errno/1, arg 2 - could not open: /nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1/ciao/1.21.0/build/bin/ciaopp-client}

I guess caused by

% TODO: strange target, only for installation, define in another way?
'$builder_hook'(item_nested(ciaopp_client)).
'$builder_hook'(ciaopp_client:cmd('ciao-client', [main='NONE_AUTOGEN', shscript])).
'$builder_hook'(ciaopp_client:build_bin) :- % (override build)
% (we just copy the script from the builder)
cmd_build_copy(core, shscript, ~ciaopp_client_sh, 'ciaopp-client').

And setting INSTALL_CIAOROOT doesn't seem to affect it.

jfmc commented

System-wide (instead of local) installation may be the source of the problem. Could you provide us more details about the selected Ciao installation options?

ony commented

Ciao was configured/built/installed with:

./ciao-boot.sh configure --instype=global --prefix=$prefix
./ciao-boot.sh build
./ciao-boot.sh install

Where $prefix pointing somewhere to /nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1.

/nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1/ciao/1.21.0/build/bundlereg/builder.bundlecfg:

bundle_flag(builder,configuration_mode,basic).
bundle_flag(builder,verbose_build,no).
bundle_flag(builder,with_docs,yes).
bundle_flag(builder,gen_asr,yes).
bundle_flag(builder,parallel,no).
bundle_flag(builder,instype,global).
bundle_flag(builder,registration_type,all).
bundle_flag(builder,prefix,'/nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1').
bundle_flag(builder,install_ciaoroot_base,'/nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1/ciao').
bundle_flag(builder,bindir,'/nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1/bin').
bundle_flag(builder,mandir,'/nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1/share/man').
bundle_flag(builder,infodir,'/nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1/share/info').
bundle_flag(builder,execmode,'775').
bundle_flag(builder,datamode,'664').
bundle_flag(builder,installgroup,'').
bundle_flag(builder,gmake_cmd,'/nix/store/kn7cpvjs5769qfdnbn1k4j3pmnvh5557-gnumake-4.3/bin/make').
bundle_flag(builder,gtar_cmd,'/nix/store/vkxbycfq51ipgczbjhzpsgzkwli0xhjl-gnutar-1.34/bin/tar').

/nix/store/0dglpvf6vzyddjzk1g6mgs1zrd794qnd-ciao-1.21.0-m1/ciao/1.21.0/build/bundlereg/core.bundlecfg:

bundle_flag(core,update_shell,no).
bundle_flag(core,itf_format,f).
bundle_flag(core,runtime_checks,no).
bundle_flag(core,rtchecks_level,inner).
bundle_flag(core,rtchecks_trust,yes).
bundle_flag(core,rtchecks_entry,yes).
bundle_flag(core,rtchecks_exit,yes).
bundle_flag(core,rtchecks_test,no).
bundle_flag(core,rtchecks_asrloc,yes).
bundle_flag(core,rtchecks_predloc,yes).
bundle_flag(core,rtchecks_callloc,predicate).
bundle_flag(core,rtchecks_namefmt,long).
bundle_flag(core,install_prolog_name,yes).
bundle_flag(core,custom_cc,'').
bundle_flag(core,custom_ld,'').
bundle_flag(core,extra_cflags,'').
bundle_flag(core,extra_ldflags,'').
bundle_flag(core,os,'LINUX').
bundle_flag(core,m32,no).
bundle_flag(core,m64,no).
bundle_flag(core,arch,x86_64).
bundle_flag(core,use_threads,yes).
bundle_flag(core,and_parallel_execution,no).
bundle_flag(core,par_back,no).
bundle_flag(core,tabled_execution,yes).
bundle_flag(core,optim_level,optimized).
bundle_flag(core,debug_level,nodebug).

User have no access to update those locations.

I'm new to Ciao and its build system. But I would expect that it should be:

     cmd_build_copy(ciaopp, shscript, ~ciaopp_client_sh, 'ciaopp-client').   % <-- replaced core with ciaopp bundle

I already tried it and it finished build with ~/.ciao/build/bin/ciaopp-client present. Though it seems that produced ciaopp still attempts to do something in core/builder bundles:

{ERROR: No handle found for thrown error error(system_error,system:make_directory/2-1)}

Right before writing that message it tries to create folder /nix/store/hcb96l79qhz0vcf0gz316698alydwbpm-ciao-1.21.0-m1/ciao/1.21.0/build/data with full access (0777) and obviously fails.

ony commented

For that second issue it looks like there might be need to override deploy_data_root_dir/1.

After peeking into ensure_datadir/2 use example, here is a crude prototype of changes that make ciaopp buildable and usable (ciaopp -V works) with system-wide installed ciao/builder bundles:

diff --git a/Manifest/ciaopp.hooks.pl b/Manifest/ciaopp.hooks.pl
index ea40f81..9951fb8 100644
--- a/Manifest/ciaopp.hooks.pl
+++ b/Manifest/ciaopp.hooks.pl
@@ -22,7 +22,7 @@ ciaopp_client_sh := ~bundle_path(ciaopp, 'cmds/ciaopp-client.bash').
 '$builder_hook'(ciaopp_client:cmd('ciao-client', [main='NONE_AUTOGEN', shscript])).
 '$builder_hook'(ciaopp_client:build_bin) :- % (override build)
     % (we just copy the script from the builder)
-    cmd_build_copy(core, shscript, ~ciaopp_client_sh, 'ciaopp-client').
+    cmd_build_copy(ciaopp, shscript, ~ciaopp_client_sh, 'ciaopp-client').
 
 % ===========================================================================
 
diff --git a/batch/db_analysis.pl b/batch/db_analysis.pl
index 3de9f2c..2274359 100644
--- a/batch/db_analysis.pl
+++ b/batch/db_analysis.pl
@@ -4,6 +4,11 @@
 :- doc(author, "Isabel Garcia-Contreras").
 :- doc(module, "This module manages the analysis database for ciaopp_batch.").
 
+:- multifile deploy_data_root_dir/1.
+deploy_data_root_dir(D):- !,
+  D = '/tmp/ciaopp', % TODO: use XDG spec for user local cache files instead
+  make_dir_nofail(D).
+
 :- use_module(ciaopp_batch(ciaopp_batch_aux), [newer/2, dump_file/4, make_dir_nofail/1]).
 
 :- use_module(library(system), [file_exists/1, touch/1, directory_files/2]).