ciao-lang / ciao

Ciao is a modern Prolog implementation that builds up from a logic-based simple kernel designed to be portable, extensible, and modular.
https://ciao-lang.org
GNU Lesser General Public License v3.0
268 stars 20 forks source link

profiling not compiling #73

Closed ciaoyciao closed 1 year ago

ciaoyciao commented 1 year ago

After doing a first devenv compilation, which defaults to no profiling no debug, but works fine if i do not use profile predicate, i give it a second try, doing a clean, and a configure, selecting profile. but this does not compile profiling abilities in ciao. When i issue a ciao-emacs myprogram.pl, and load it to ciao shell i get this

Ciao 1.21.0 (2022-09-06 00:43:43 +0200) [LINUXx86_64] [profile] ?- use_module('blabla/myprogram.pl'). {ERROR: profiler_c:profile_init/0 - existence error: procedure:profiler_c:profile_init/0 does not exist}

aborted ?- use_module('blabla../myprogram.pl').

yes ?- p7. {ERROR: profiler_c:do_profile_reset/0 - existence error: procedure:profiler_c:do_profile_reset/0 does not exist}

aborted ?-
I tried to solve it editing profile.c profile.h and profile_c.c in the source directories, the problem remains profile_hooks switch, (after dealing with a pair of friendlier errors...). The ld linker could not link profiling to the exes --->> blabla...ciao/build/cache/ciaodbg.lib.profiler.profiler_c_LINUXx86_64.o:(.data+0x0): definiciones múltiples de `profile_hooks'; blabla...ciao/build/cache/ciaodbg.lib.profiler.profiler_LINUXx86_64.o:(.data+0x0): primero se definió aquí collect2: error: ld returned 1 exit status {Dynamic link failed} i observed that the switch is defined in profile.c and profile_c.c with two different datatypes.

ciaoyciao commented 1 year ago

Hi again, i think using extern declarations may solve the problem. Other problems i found are : a variable which name ends in hook, has to be renamed, ending in hok. and there is also a malformed fprintf, but to be honest, i have not enough knowledge about the ciao sources to recommend any solution, I reformed the fprintf making the files compile but it would be subjet for an expert in the sources to aprove it. Hope these findings help to correct the errors someone introduced, surely without knowing... Long live and ... ciao! by the way, AND parallelism and backtrack parallelism are also not compiling.

ciaoyciao commented 1 year ago

installed ciao 1.22, profiler compiled and profile predicate is working. Tnx

ciaoyciao commented 1 year ago

tnx.