Git Product home page Git Product logo

Comments (40)

mingodad avatar mingodad commented on July 28, 2024 1

I think that's better to fix trella itself to be 32bits compatible then compile to wasm is basically free (without system extensions).

from trealla.

mingodad avatar mingodad commented on July 28, 2024

It seems that my glibc doesn't provide it, any way to have an alternative for older systems ?

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

It doesn't solve the problem because the posix_spawn_file_actions_addchdir_np is not available on all libc versions (Ubuntu 18.04 for example).

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Maybe in the worst case throw an error if that functionality is used on a system that doesn't support it because it seems that it's not a fundamental functionality that prevent the general usage of trella as a prolog system.

from trealla.

pmoura avatar pmoura commented on July 28, 2024

Which gcc version are you using? IIRC correctly, the latest default version for Ubuntu 18 is gcc 9.

from trealla.

mingodad avatar mingodad commented on July 28, 2024

I have gcc-9:

gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-nrQql7/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~18.04) 

from trealla.

pmoura avatar pmoura commented on July 28, 2024

It's possible to install e.g. gcc 11 in Ubuntu 18.04. That may give the missing functionality.

from trealla.

mingodad avatar mingodad commented on July 28, 2024

I did this to be able to build it (it's not the best fix but at least build and let me use all other functionalities):

@@ -790,12 +790,15 @@ static bool fn_process_create_3(query *q)
 				bool detached = !CMP_STR_TO_CSTR(q, c+1, "detached");
 				posix_spawnattr_setflags(&attrp, POSIX_SPAWN_SETSID);
 
 			} else if (!CMP_STR_TO_CSTR(q, c, "cwd")) {
 				cwd = C_STR(q, name);
+#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 28
+                                return throw_error(q, c, c_ctx, "not available", "posix_spawn_file_actions_addchdir_np");
+#else
 				posix_spawn_file_actions_addchdir_np(&file_actions, cwd);
-
+#endif
 			} else if (!CMP_STR_TO_CSTR(q, c, "env") && is_list_or_nil(name)) {
 				LIST_HANDLER(name);
 				memset(environments, 0, sizeof(environments));
 				envs = 0;

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Some minor changes/fix to my previous fix:

@@ -789,13 +789,16 @@ static bool fn_process_create_3(query *q)
 			} else if (!CMP_STR_TO_CSTR(q, c, "detached")) {
 				bool detached = !CMP_STR_TO_CSTR(q, c+1, "detached");
 				posix_spawnattr_setflags(&attrp, POSIX_SPAWN_SETSID);
 
 			} else if (!CMP_STR_TO_CSTR(q, c, "cwd")) {
+#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 29))
+                                return throw_error(q, c, c_ctx, "not available", "posix_spawn_file_actions_addchdir_np");
+#else
 				cwd = C_STR(q, name);
 				posix_spawn_file_actions_addchdir_np(&file_actions, cwd);
-
+#endif
 			} else if (!CMP_STR_TO_CSTR(q, c, "env") && is_list_or_nil(name)) {
 				LIST_HANDLER(name);
 				memset(environments, 0, sizeof(environments));
 				envs = 0;

Obs: edited because it was a fault boolean test, see further comments.
Before ti was

+#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 28

from trealla.

mingodad avatar mingodad commented on July 28, 2024

And here is the output of the tests:

make test
./tests/run.sh
Running tests/tests/test000.pl ...
..
1c1
< Error: syntax error, unterminated quoted atom, /home/andrew/trealla/tests/tests/test038.pl:3
---
> Error: syntax error, unterminated quoted atom, trealla/tests/tests/test038.pl:3
Running tests/tests/test039.pl ...
..
1c1
< Error: syntax error, near 's', operator expected, /home/andrew/trealla/tests/issues-OLD/test020.pl:4
---
> Error: syntax error, near 's', operator expected, trealla/tests/issues-OLD/test020.pl:4
..
1c1
< Error: syntax error, near '?', operator expected, /home/andrew/trealla/tests/issues-OLD/test245.pl:4
---
> Error: syntax error, near '?', operator expected, trealla/tests/issues-OLD/test245.pl:4
...
1c1
< Error: syntax error, near '=/=', operator expected, /home/andrew/trealla/tests/issues-OLD/test254.pl:4
---
> Error: syntax error, near '=/=', operator expected, trealla/tests/issues-OLD/test254.pl:4
Running tests/issues-OLD/test271.pl ...
Running tests/issues-OLD/test289.pl ...
1c1
< Error: syntax error, parens needed around operator ':-', /home/andrew/trealla/tests/issues-OLD/test289.pl:2
---
> Error: syntax error, parens needed around operator ':-', trealla/tests/issues-OLD/test289.pl:2
...
Running tests/issues/test030.pl ...

============
TEST SUMMARY
============
Failed: 5
Succeeded: 144

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Oops! Here again is another small change/fix for my previous diff:

#if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 29

Noticed the __GLIBC__ <= 2, before it was __GLIBC__ == 2.

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Oops again! Sorry !

#if defined(__GLIBC__) && (__GLIBC__ <= 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 29))

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Not at all !
And sorry again ! Today it seems I'm not completely awake !

#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 29))

from trealla.

mingodad avatar mingodad commented on July 28, 2024

I'm testing on Ubuntu 14.04 32bits and there are some problems with it, the first one is the need to add -stc=c99.

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Here is the output on Ubuntu 14.04 32bits:

fatal: Not a git repository (or any of the parent directories): .git
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o tpl.o tpl.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/bags.o src/bags.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/base64.o src/base64.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/contrib.o src/contrib.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/control.o src/control.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/ffi.o src/ffi.c
src/ffi.c: In function ‘fn_sys_dlopen_3’:
src/ffi.c:81:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  make_uint(&tmp, (uint64_t)handle);
                  ^
src/ffi.c: In function ‘fn_sys_dlsym_3’:
src/ffi.c:98:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  void *ptr = dlsym((void*)handle, symbol);
                    ^
src/ffi.c:101:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  make_uint(&tmp, (uint64_t)ptr);
                  ^
src/ffi.c: In function ‘fn_sys_dlclose_1’:
src/ffi.c:114:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  return dlclose((void*)handle) ? false : true;
                 ^
src/ffi.c: In function ‘fn_sys_register_function_4’:
src/ffi.c:129:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  void *func = dlsym((void*)handle, symbol);
                     ^
src/ffi.c: In function ‘fn_sys_register_predicate_4’:
src/ffi.c:224:21: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  void *func = dlsym((void*)handle, symbol);
                     ^
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/format.o src/format.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/functions.o src/functions.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/history.o src/history.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/library.o src/library.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/module.o src/module.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/network.o src/network.c
src/network.c: In function ‘net_server’:
src/network.c:200:4: warning: implicit declaration of function ‘TLS_server_method’ [-Wimplicit-function-declaration]
    g_ctx = SSL_CTX_new(TLS_server_method());
    ^
src/network.c:200:24: warning: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast
    g_ctx = SSL_CTX_new(TLS_server_method());
                        ^
In file included from src/network.c:34:0:
/usr/include/openssl/ssl.h:1680:10: note: expected ‘const struct SSL_METHOD *’ but argument is of type ‘int’
 SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
          ^
src/network.c: In function ‘net_enable_ssl’:
src/network.c:270:3: warning: implicit declaration of function ‘TLS_client_method’ [-Wimplicit-function-declaration]
   g_ctx = SSL_CTX_new(is_server?TLS_server_method():TLS_client_method());
   ^
src/network.c:270:23: warning: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast
   g_ctx = SSL_CTX_new(is_server?TLS_server_method():TLS_client_method());
                       ^
In file included from src/network.c:34:0:
/usr/include/openssl/ssl.h:1680:10: note: expected ‘const struct SSL_METHOD *’ but argument is of type ‘int’
 SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth);
          ^
src/network.c:275:26: warning: passing argument 2 of ‘SSL_set_ssl_method’ makes pointer from integer without a cast
  SSL_set_ssl_method(ssl, is_server?TLS_server_method():TLS_client_method());
                          ^
In file included from src/network.c:34:0:
/usr/include/openssl/ssl.h:1912:5: note: expected ‘const struct SSL_METHOD *’ but argument is of type ‘int’
 int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
     ^
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/parser.o src/parser.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/posix.o src/posix.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/predicates.o src/predicates.c
src/predicates.c: In function ‘make_ptr’:
src/predicates.c:118:18: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  tmp->val_uint = (uint64_t)v;
                  ^
src/predicates.c: In function ‘fn_sys_alarm_1’:
src/predicates.c:6990:9: warning: missing braces around initializer [-Wmissing-braces]
  struct itimerval it = {0};
         ^
src/predicates.c:6990:9: warning: (near initialization for ‘it.it_interval’) [-Wmissing-braces]
src/predicates.c:6990:9: warning: missing initializer for field ‘it_value’ of ‘struct itimerval’ [-Wmissing-field-initializers]
In file included from src/predicates.c:6:0:
/usr/include/i386-linux-gnu/sys/time.h:112:20: note: ‘it_value’ declared here
     struct timeval it_value;
                    ^
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/print.o src/print.c
src/print.c: In function ‘print_variable’:
src/print.c:431:45: warning: signed and unsigned type in conditional expression [-Wsign-compare]
  pl_idx_t slot_idx = running ? e - q->slots : c->var_nbr;
                                             ^
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/prolog.o src/prolog.c
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/query.o src/query.c
src/query.c: In function ‘dump_id’:
src/query.c:424:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  uint64_t id = (uint64_t)k;
                ^
src/query.c: In function ‘find_key’:
src/query.c:527:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   map_app(tmp_idx, (void*)dbe->db_id, (void*)dbe);
                    ^
src/query.c: In function ‘push_choice’:
src/query.c:1013:2: warning: missing braces around initializer [-Wmissing-braces]
  *ch = (choice){0};
  ^
src/query.c:1013:2: warning: (near initialization for ‘(anonymous).st’) [-Wmissing-braces]
src/query.c:1013:2: warning: missing initializer for field ‘cgen’ of ‘choice’ [-Wmissing-field-initializers]
In file included from src/heap.h:3:0,
                 from src/query.c:7:
src/internal.h:550:11: note: ‘cgen’ declared here
  uint64_t cgen, frame_cgen, ugen;
           ^
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/skiplist.o src/skiplist.c
src/skiplist.c: In function ‘default_cmpkey’:
src/skiplist.c:57:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  int64_t i1 = (int64_t)p1;
               ^
src/skiplist.c:58:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  int64_t i2 = (int64_t)p2;
               ^
cc -std=c99 -Isrc -I/usr/local/include -DVERSION='""' -O3 -funsigned-char  -D_GNU_SOURCE -Wall -Wextra -Wno-deprecated-declarations -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -DUSE_FFI=1 -I/usr/local/OPT/LIBFFI/include -DUSE_OPENSSL=1   -c -o src/streams.o src/streams.c
src/streams.c: In function ‘fn_process_create_3’:
src/streams.c:791:38: error: ‘POSIX_SPAWN_SETSID’ undeclared (first use in this function)
     posix_spawnattr_setflags(&attrp, POSIX_SPAWN_SETSID);
                                      ^
src/streams.c:791:38: note: each undeclared identifier is reported only once for each function it appears in
src/streams.c: In function ‘fn_sys_read_term_from_chars_4’:
src/streams.c:3483:2: warning: missing braces around initializer [-Wmissing-braces]
  stream tmps = {0};
  ^
src/streams.c:3483:2: warning: (near initialization for ‘tmps.<anonymous>’) [-Wmissing-braces]
src/streams.c:3483:2: warning: missing initializer for field ‘sb_buf’ of ‘stream’ [-Wmissing-field-initializers]
In file included from src/heap.h:3:0,
                 from src/streams.c:38:
src/internal.h:575:16: note: ‘sb_buf’ declared here
  string_buffer sb_buf;
                ^
src/streams.c: In function ‘fn_read_term_from_chars_3’:
src/streams.c:3563:2: warning: missing braces around initializer [-Wmissing-braces]
  stream tmps = {0};
  ^
src/streams.c:3563:2: warning: (near initialization for ‘tmps.<anonymous>’) [-Wmissing-braces]
src/streams.c:3563:2: warning: missing initializer for field ‘sb_buf’ of ‘stream’ [-Wmissing-field-initializers]
In file included from src/heap.h:3:0,
                 from src/streams.c:38:
src/internal.h:575:16: note: ‘sb_buf’ declared here
  string_buffer sb_buf;
                ^
src/streams.c: In function ‘fn_read_term_from_atom_3’:
src/streams.c:3634:2: warning: missing braces around initializer [-Wmissing-braces]
  stream tmps = {0};
  ^
src/streams.c:3634:2: warning: (near initialization for ‘tmps.<anonymous>’) [-Wmissing-braces]
src/streams.c:3634:2: warning: missing initializer for field ‘sb_buf’ of ‘stream’ [-Wmissing-field-initializers]
In file included from src/heap.h:3:0,
                 from src/streams.c:38:
src/internal.h:575:16: note: ‘sb_buf’ declared here
  string_buffer sb_buf;
                ^
make: *** [src/streams.o] Error 1

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

It seems that most of the problems are on system extensions not related to prolog itself, probably would be a good idea to separate then at least at build time so people only interested on the prolog part can continue using it without the system extensions that are platform dependent.

from trealla.

mingodad avatar mingodad commented on July 28, 2024

And with multilib installed you can also test 32bits build passing -m32.

from trealla.

mingodad avatar mingodad commented on July 28, 2024

By the way my interested on check trella again came while reading this article Codebase as Database: Turning the IDE Inside Out with Datalog https://petevilter.me/post/datalog-typechecking/

from trealla.

guregu avatar guregu commented on July 28, 2024

It seems that most of the problems are on system extensions not related to prolog itself, probably would be a good idea to separate then at least at build time so people only interested on the prolog part can continue using it without the system extensions that are platform dependent.

The WASM port attempts to do this. You can try passing -D__wasi__ to see if it helps. The WASM stuff in the upstream (here) is a little outdated though, I have a fork that I'm hacking on until we stabilize support. Maybe we should use a different symbol instead of __wasi__?

from trealla.

guregu avatar guregu commented on July 28, 2024

By the way my interested on check trella again came while reading this article Codebase as Database: Turning the IDE Inside Out with Datalog https://petevilter.me/post/datalog-typechecking/

I think trealla-js would be perfect for this :-)
Also a bit unstable at the moment... but rapidly approaching v1.

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Here are possible fixes for src/ffi.c to work in both 32bits and 64bits:

@@ -76,39 +76,39 @@ USE_RESULT bool fn_sys_dlopen_3(query *q)
 
 	int flag = get_smallint(p2);
 	void *handle = dlopen(filename2, !flag ? RTLD_LAZY | RTLD_GLOBAL : flag);
 	if (!handle) return false;
 	cell tmp;
-	make_uint(&tmp, (uint64_t)handle);
+	make_uint(&tmp, (size_t)handle);
 	tmp.flags |= FLAG_INT_HANDLE | FLAG_HANDLE_DLL;
 	free(filename2);
 	return unify(q, p3, p3_ctx, &tmp, q->st.curr_frame);
 }
 
 USE_RESULT bool fn_sys_dlsym_3(query *q)
 {
 	GET_FIRST_ARG(p1,integer);
 	GET_NEXT_ARG(p2,atom);
 	GET_NEXT_ARG(p3,var);
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 	const char *symbol = C_STR(q, p2);
 
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
 		return throw_error(q, p1, p1_ctx, "existence_error", "handle");
 
 	void *ptr = dlsym((void*)handle, symbol);
 	if (!ptr) return false;
 	cell tmp;
-	make_uint(&tmp, (uint64_t)ptr);
+	make_uint(&tmp, (size_t)ptr);
 	tmp.flags |= FLAG_INT_HANDLE | FLAG_INT_OCTAL;
 	return unify(q, p3, p3_ctx, &tmp, q->st.curr_frame);
 }
 
 USE_RESULT bool fn_sys_dlclose_1(query *q)
 {
 	GET_FIRST_ARG(p1,integer);
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
 		return throw_error(q, p1, p1_ctx, "existence_error", "handle");
 
 	return dlclose((void*)handle) ? false : true;
@@ -122,11 +122,11 @@ USE_RESULT bool fn_sys_register_function_4(query *q)
 	GET_NEXT_ARG(p4,atom);
 
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
 		return throw_error(q, p1, p1_ctx, "existence_error", "handle");
 
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 	const char *symbol = C_STR(q, p2);
 	void *func = dlsym((void*)handle, symbol);
 	if (!func) return false;
 
 	uint8_t arg_types[MAX_ARITY], ret_type = 0;
@@ -217,11 +217,11 @@ USE_RESULT bool fn_sys_register_predicate_4(query *q)
 	GET_NEXT_ARG(p4,atom);
 
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
 		return throw_error(q, p1, p1_ctx, "existence_error", "handle");
 
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 	const char *symbol = C_STR(q, p2);
 	void *func = dlsym((void*)handle, symbol);
 	if (!func) return false;
 
 	uint8_t arg_types[MAX_ARITY], ret_type = 0;

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Here are some possible fixes to build in 32bits:

    Some fixes to build on 32bits

----------------------------------- Makefile -----------------------------------
index 1cf061a2..4be46c54 100644
@@ -1,6 +1,6 @@
 GIT_VERSION := "$(shell git describe --abbrev=4 --dirty --always --tags)"
 
-CFLAGS = -Isrc -I/usr/local/include -DVERSION='$(GIT_VERSION)' -O3 \
+CFLAGS = -std=c99 -Isrc -I/usr/local/include -DVERSION='$(GIT_VERSION)' -O3 \
 	-funsigned-char $(OPT) -D_GNU_SOURCE -Wall -Wextra \
 	-Wno-deprecated-declarations \
 	-Wno-unused-function -Wno-unused-parameter \
@@ -113,7 +113,7 @@ all: tpl
 tpl: $(OBJECTS) Makefile README.md LICENSE
 	rm src/version.o
 	$(CC) $(CFLAGS) -o src/version.o -c src/version.c
-	$(CC) -o tpl $(OBJECTS) $(OPT) $(LDFLAGS)
+	$(CC) $(CFLAGS) -o tpl $(OBJECTS) $(OPT) $(LDFLAGS)
 
 profile:
 	$(MAKE) 'OPT=$(OPT) -O0 -pg -DDEBUG'

---------------------------------- src/ffi.c ----------------------------------
index e02061ae..0928e00c 100644
@@ -78,7 +78,7 @@ USE_RESULT bool fn_sys_dlopen_3(query *q)
 	void *handle = dlopen(filename2, !flag ? RTLD_LAZY | RTLD_GLOBAL : flag);
 	if (!handle) return false;
 	cell tmp;
-	make_uint(&tmp, (uint64_t)handle);
+	make_uint(&tmp, (size_t)handle);
 	tmp.flags |= FLAG_INT_HANDLE | FLAG_HANDLE_DLL;
 	free(filename2);
 	return unify(q, p3, p3_ctx, &tmp, q->st.curr_frame);
@@ -89,7 +89,7 @@ USE_RESULT bool fn_sys_dlsym_3(query *q)
 	GET_FIRST_ARG(p1,integer);
 	GET_NEXT_ARG(p2,atom);
 	GET_NEXT_ARG(p3,var);
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 	const char *symbol = C_STR(q, p2);
 
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
@@ -98,7 +98,7 @@ USE_RESULT bool fn_sys_dlsym_3(query *q)
 	void *ptr = dlsym((void*)handle, symbol);
 	if (!ptr) return false;
 	cell tmp;
-	make_uint(&tmp, (uint64_t)ptr);
+	make_uint(&tmp, (size_t)ptr);
 	tmp.flags |= FLAG_INT_HANDLE | FLAG_INT_OCTAL;
 	return unify(q, p3, p3_ctx, &tmp, q->st.curr_frame);
 }
@@ -106,7 +106,7 @@ USE_RESULT bool fn_sys_dlsym_3(query *q)
 USE_RESULT bool fn_sys_dlclose_1(query *q)
 {
 	GET_FIRST_ARG(p1,integer);
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
 		return throw_error(q, p1, p1_ctx, "existence_error", "handle");
@@ -124,7 +124,7 @@ USE_RESULT bool fn_sys_register_function_4(query *q)
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
 		return throw_error(q, p1, p1_ctx, "existence_error", "handle");
 
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 	const char *symbol = C_STR(q, p2);
 	void *func = dlsym((void*)handle, symbol);
 	if (!func) return false;
@@ -219,7 +219,7 @@ USE_RESULT bool fn_sys_register_predicate_4(query *q)
 	if (!(p1->flags & FLAG_INT_HANDLE) && !(p1->flags & FLAG_HANDLE_DLL))
 		return throw_error(q, p1, p1_ctx, "existence_error", "handle");
 
-	uint64_t handle = get_smalluint(p1);
+	size_t handle = get_smalluint(p1);
 	const char *symbol = C_STR(q, p2);
 	void *func = dlsym((void*)handle, symbol);
 	if (!func) return false;

-------------------------------- src/internal.h --------------------------------
index 6538607c..1ae4ea9b 100644
@@ -416,7 +416,7 @@ typedef struct {
 } uuid;
 
 struct clause_ {
-	uint64_t dgen_created, dgen_erased;
+	size_t dgen_created, dgen_erased;
 	pl_idx_t allocated_cells, cidx;
 	uint32_t nbr_vars;
 	uint16_t nbr_temporaries;
@@ -440,7 +440,7 @@ struct db_entry_ {
 
 	union {
 		db_entry *dirty;
-		uint64_t db_id;
+		size_t db_id;
 	};
 
 	uuid u;
@@ -516,7 +516,7 @@ struct slot_ {
 
 struct frame_ {
 	cell *prev_cell;
-	uint64_t ugen, cgen;
+	size_t ugen, cgen;
 	pl_idx_t prev_frame, base, overflow;
 	uint32_t initial_slots, actual_slots;
 	uint16_t mid;
@@ -547,7 +547,7 @@ struct prolog_state_ {
 
 struct choice_ {
 	prolog_state st;
-	uint64_t cgen, frame_cgen, ugen;
+	size_t cgen, frame_cgen, ugen;
 	pl_idx_t overflow;
 	uint32_t initial_slots, actual_slots;
 	bool is_tail_rec:1;

------------------------------- src/predicates.c -------------------------------
index 993c3ff9..81683724 100644
@@ -115,7 +115,7 @@ void make_ptr(cell *tmp, void *v)
 	*tmp = (cell){0};
 	tmp->tag = TAG_INTEGER;
 	tmp->nbr_cells = 1;
-	tmp->val_uint = (uint64_t)v;
+	tmp->val_uint = (size_t)v;
 }
 
 void make_struct(cell *tmp, pl_idx_t offset, void *fn, unsigned arity, pl_idx_t extra_cells)

--------------------------------- src/prolog.c ---------------------------------
index fd997de9..5fcebaf4 100644
@@ -400,7 +400,7 @@ void pl_destroy(prolog *pl)
 prolog *pl_create()
 {
 	//printf("*** sizeof(cell) = %u bytes\n", (unsigned)sizeof(cell));
-	assert(sizeof(cell) == 24);
+	//assert(sizeof(cell) == 24);
 
 	prolog *pl = calloc(1, sizeof(prolog));
 

--------------------------------- src/query.c ---------------------------------
index 4c9a9fdd..a564e034 100644
@@ -421,9 +421,9 @@ bool is_next_key(query *q)
 const char *dump_id(const void *k, const void *v, const void *p)
 {
 	const query *q = (query*)p;
-	uint64_t id = (uint64_t)k;
+	size_t id = (size_t)k;
 	static char tmpbuf[1024];
-	sprintf(tmpbuf, "%llu", (unsigned long long)id);
+	sprintf(tmpbuf, "%zd", id);
 	return tmpbuf;
 }
 

--------------------------------- src/query.h ---------------------------------
index 12ddc90f..743e2c07 100644
@@ -133,7 +133,7 @@ inline static pl_idx_t queuen_used(const query *q) { return q->qp[q->st.qnbr]; }
 inline static cell *get_queuen(query *q) { return q->queue[q->st.qnbr]; }
 inline static cell *take_queuen(query *q) { cell *save = q->queue[q->st.qnbr]; q->queue[q->st.qnbr] = NULL; return save; }
 
-inline static bool can_view(uint64_t ugen, const db_entry *dbe)
+inline static bool can_view(size_t ugen, const db_entry *dbe)
 {
 	if (dbe->cl.is_deleted)
 		return false;

-------------------------------- src/skiplist.c --------------------------------
index 69e9ff92..d6abeaa1 100644
@@ -5,6 +5,7 @@
 #include <stdio.h>
 #include <stdbool.h>
 #include <time.h>
+#include <stddef.h>
 
 #include "skiplist.h"
 
@@ -54,8 +55,8 @@ inline static slnode_t *new_node_of_level(unsigned x)
 
 static int default_cmpkey(const void *p1, const void *p2, __attribute__((unused)) const void *p, void *l)
 {
-	int64_t i1 = (int64_t)p1;
-	int64_t i2 = (int64_t)p2;
+	ptrdiff_t i1 = (ptrdiff_t)p1;
+	ptrdiff_t i2 = (ptrdiff_t)p2;
 	return i1 < i2 ? -1 : i1 > i2 ? 1 : 0;
 }
 

-------------------------------- src/streams.c --------------------------------
index a0d8bba9..b60a8a5f 100644
@@ -787,8 +787,12 @@ static bool fn_process_create_3(query *q)
 				ppid_ctx = name_ctx;
 
 			} else if (!CMP_STR_TO_CSTR(q, c, "detached")) {
+#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 26))
+				return throw_error(q, c, c_ctx, "not available", "posix_spawnattr_setflags");
+#else
 				bool detached = !CMP_STR_TO_CSTR(q, c+1, "detached");
 				posix_spawnattr_setflags(&attrp, POSIX_SPAWN_SETSID);
+#endif
 
 			} else if (!CMP_STR_TO_CSTR(q, c, "cwd")) {
 #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 29))

But then after building on Ubuntu 14.04 32bits with make NOSSL=1 and comparing the output of make test we have a bit more fails:

./tests/run.sh
Running tests/tests/test000.pl ...
...
Running tests/tests/test038.pl ...
1c1
< Error: syntax error, unterminated quoted atom, /home/andrew/trealla/tests/tests/test038.pl:3
---
> Error: syntax error, unterminated quoted atom, /home/mingo/dev/trealla/tests/tests/test038.pl:3
Running tests/tests/test039.pl ...

...
Running tests/tests/test066.pl ...
1,2c1,2  /////<<<<!!!! only on 32bits
< 3.141592653589793
< 2.718281828459045
---
> 3.14159265358979
> 2.718281828459
Running tests/tests/test067.pl ...

...
Running tests/tests/test079.pl ...
2c2
< 1.8816763723536579e+78
---
> 1.88167637235366e+78
Running tests/tests/test080.pl ...

...
Running tests/issues-OLD/test020.pl ...
1c1
< Error: syntax error, near 's', operator expected, /home/andrew/trealla/tests/issues-OLD/test020.pl:4
---
> Error: syntax error, near 's', operator expected, /home/mingo/dev/trealla/tests/issues-OLD/test020.pl:4
Running tests/issues-OLD/test023.pl ...
...
Running tests/issues-OLD/test056.pl ...
1c1  /////<<<<!!!! only on 32bits
< "5feceb66ffc86f38d952786c6d696c79c2dbc239dd4e91b46729d73a27fb57e9"
---
>    error(existence_error(procedure,crypto_data_hash/3),main/0).
Running tests/issues-OLD/test058.pl ...
...
Running tests/issues-OLD/test081.pl ...
1,2c1,2
< [[4.0000000074505806,0.0],[2.9999999925494194,0.0],[1.9999999925494194,0.0],[1.0000000074505806,0.0]]
< [[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999623,1.0000000000000036]]
---
> [[4.00000000745058,0.0],[2.99999999254942,0.0],[1.99999999254942,0.0],[1.00000000745058,0.0]]
> [[3.0,2.0],[5.0,0.999999999999993],[-5.77315972805081e-15,1.0],[1.0,1.0]]
Running tests/issues-OLD/test082.pl ...
...
Running tests/issues-OLD/test245.pl ...
1c1
< Error: syntax error, near '?', operator expected, /home/andrew/trealla/tests/issues-OLD/test245.pl:4
---
> Error: syntax error, near '?', operator expected, /home/mingo/dev/trealla/tests/issues-OLD/test245.pl:4
Running tests/issues-OLD/test246.pl ...
Running tests/issues-OLD/test252.pl ...
Running tests/issues-OLD/test254.pl ...
1c1
< Error: syntax error, near '=/=', operator expected, /home/andrew/trealla/tests/issues-OLD/test254.pl:4
---
> Error: syntax error, near '=/=', operator expected, /home/mingo/dev/trealla/tests/issues-OLD/test254.pl:4
Running tests/issues-OLD/test271.pl ...
Running tests/issues-OLD/test289.pl ...
1c1
< Error: syntax error, parens needed around operator ':-', /home/andrew/trealla/tests/issues-OLD/test289.pl:2
---
> Error: syntax error, parens needed around operator ':-', /home/mingo/dev/trealla/tests/issues-OLD/test289.pl:2
Running tests/issues-OLD/test297.pl ...
...
Running tests/issues-OLD/test585.pl ...
1,2c1,2
< 'https://josd.github.io/eye/ns#roots'([[1,0],[-10,0],[35,0],[-50,0],[24,0]],[[4.0000000074505806,0.0],[2.9999999925494194,0.0],[1.9999999925494194,0.0],[1.0000000074505806,0.0]]).
< 'https://josd.github.io/eye/ns#roots'([[1,0],[-9,-5],[14,33],[24,-44],[-26,0]],[[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999623,1.0000000000000036]]).
---
> 'https://josd.github.io/eye/ns#roots'([[1,0],[-10,0],[35,0],[-50,0],[24,0]],[[4.00000000745058,0.0],[2.99999999254942,0.0],[1.99999999254942,0.0],[1.00000000745058,0.0]]).
> 'https://josd.github.io/eye/ns#roots'([[1,0],[-9,-5],[14,33],[24,-44],[-26,0]],[[3.0,2.0],[5.0,0.999999999999993],[-5.77315972805081e-15,1.0],[1.0,1.0]]).
Running tests/issues-OLD/test601.pl ...
Running tests/issues-OLD/test605.pl ...
Running tests/issues-OLD/test617.pl ...
Running tests/issues-OLD/test619.pl ...
Running tests/issues/test030.pl ...

============
TEST SUMMARY
============
Failed: 10
Succeeded: 139

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

For the TLS_server_method compatibility this allow to compile on Ubuntu 14.04 32 bits:

diff --git a/src/network.c b/src/network.c
index dc703a1d..de2bbb42 100644
--- a/src/network.c
+++ b/src/network.c
@@ -41,6 +41,14 @@
 #if USE_OPENSSL
 static int g_ctx_use_cnt = 0;
 static SSL_CTX *g_ctx = NULL;
+#if OPENSSL_VERSION_NUMBER > 0x10100000L
+#define SSL_SERVER_METHOD_FUNC TLS_server_method
+#define SSL_CLIENT_METHOD_FUNC TLS_client_method
+#else
+#warning "TLS is not available, falling back to SSL23 (deprecated)"
+#define SSL_SERVER_METHOD_FUNC SSLv23_server_method
+#define SSL_CLIENT_METHOD_FUNC SSLv23_client_method
+#endif
 #endif
 
 int net_domain_connect(const char *name, bool udp)
@@ -197,7 +205,7 @@ int net_server(const char *hostname, unsigned port, bool udp, const char *keyfil
 	if (keyfile) {
 		if (!g_ctx_use_cnt++) {
 			SSL_load_error_strings();
-			g_ctx = SSL_CTX_new(TLS_server_method());
+			g_ctx = SSL_CTX_new(SSL_SERVER_METHOD_FUNC());
 			SSL_CTX_set_options(g_ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
 		}
 
@@ -267,12 +275,12 @@ void *net_enable_ssl(int fd, const char *hostname, bool is_server, int level, co
 #if USE_OPENSSL
 	if (!g_ctx_use_cnt++) {
 		SSL_load_error_strings();
-		g_ctx = SSL_CTX_new(is_server?TLS_server_method():TLS_client_method());
+		g_ctx = SSL_CTX_new(is_server?SSL_SERVER_METHOD_FUNC():SSL_CLIENT_METHOD_FUNC());
 		//SSL_CTX_set_cipher_list(g_ctx, DEFAULT_CIPHERS);
 	}
 
 	SSL *ssl = SSL_new(g_ctx);
-	SSL_set_ssl_method(ssl, is_server?TLS_server_method():TLS_client_method());
+	SSL_set_ssl_method(ssl, is_server?SSL_SERVER_METHOD_FUNC():SSL_CLIENT_METHOD_FUNC());
 	//SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
 	//SSL_set_verify(ssl, SSL_VERIFY_NONE, 0);

from trealla.

mingodad avatar mingodad commented on July 28, 2024

On Android with termux it fails to compile due to usage of posix_spawn* not available.

from trealla.

mingodad avatar mingodad commented on July 28, 2024

With the changes shown bellow and installing vim to have xxd available I could build on Android 32 bits under termux:

diff --git a/src/streams.c b/src/streams.c
index 024ee6dc..e7340d5d 100644
--- a/src/streams.c
+++ b/src/streams.c
@@ -12,7 +12,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 
-#if !defined(_WIN32) && !defined(__wasi__)
+#if !defined(_WIN32) && !defined(__wasi__) && !defined(__ANDROID__)
 #include <spawn.h>
 #include <sys/wait.h>
 #endif
@@ -884,7 +884,7 @@ static bool fn_popen_4(query *q)
 
 extern char **g_envp;
 
-#if !defined(_WIN32) && !defined(__wasi__)
+#if !defined(_WIN32) && !defined(__wasi__) && !defined(__ANDROID__)
 static bool fn_process_create_3(query *q)
 {
 	GET_FIRST_ARG(p1,atom);
@@ -6687,7 +6687,7 @@ builtins g_files_bifs[] =
 	{"$capture_error_to_chars", 1, fn_sys_capture_error_to_chars_1, "-chars", false, false, BLAH},
 	{"$capture_error_to_atom", 1, fn_sys_capture_error_to_atom_1, "-atom", false, false, BLAH},
 
-#if !defined(_WIN32) && !defined(__wasi__)
+#if !defined(_WIN32) && !defined(__wasi__) && !defined(__ANDROID__)
 	{"process_create", 3, fn_process_create_3, "+atom,+args,+opts", false, false, BLAH},
 	{"process_wait", 2, fn_process_wait_2, "+pid,-status", false, false, BLAH},
 	{"process_wait", 1, fn_process_wait_1, "+pid", false, false, BLAH},

And here is the tests that fail:

make test
./tests/run.sh
Running tests/tests/test000.pl ...
...
Running tests/issues-OLD/test081.pl ...
2c2
< [[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999623,1.0000000000000036]]
---
> [[3.000000000000004,2.0000000000000013],[5.0000000000000062,0.99999999999999312],[-6.2172489379008766e-15,1.0000000000000022],[0.999999999999996,1.0000000000000033]]
Running tests/issues-OLD/test082.pl ...
...
Running tests/issues-OLD/test252.pl ...
1,3c1
< _3-_4=s-t
< _3-_4=s-t
< -'Ö'-'Œ'+'.'+'A'
---
> Error: syntax error, near 'Œ', operator expected, tests/issues-OLD/test252.pl:4
Running tests/issues-OLD/test254.pl ...
...
Running tests/issues-OLD/test585.pl ...
2c2
< 'https://josd.github.io/eye/ns#roots'([[1,0],[-9,-5],[14,33],[24,-44],[-26,0]],[[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999623,1.0000000000000036]]).
---
> 'https://josd.github.io/eye/ns#roots'([[1,0],[-9,-5],[14,33],[24,-44],[-26,0]],[[3.000000000000004,2.0000000000000013],[5.0000000000000062,0.99999999999999312],[-6.2172489379008766e-15,1.0000000000000022],[0.999999999999996,1.0000000000000033]]).
Running tests/issues-OLD/test601.pl ...
...
Running tests/issues/test066.pl ...

============
TEST SUMMARY
============
Failed: 3
Succeeded: 149

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Here is the output of Ubuntu 14.04 32 bits running on VirtualBox:

./tests/run.sh
Running tests/tests/test000.pl ...
...
Running tests/tests/test066.pl ...
1,2c1,2
< 3.141592653589793
< 2.718281828459045
---
> 3.1415926535897931
> 2.7182818284590451
Running tests/tests/test067.pl ...
...
Running tests/issues-OLD/test081.pl ...
2c2
< [[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999623,1.0000000000000036]]
---
> [[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999645,1.0000000000000036]]
Running tests/issues-OLD/test082.pl ...
...
Running tests/issues-OLD/test585.pl ...
2c2
< 'https://josd.github.io/eye/ns#roots'([[1,0],[-9,-5],[14,33],[24,-44],[-26,0]],[[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999623,1.0000000000000036]]).
---
> 'https://josd.github.io/eye/ns#roots'([[1,0],[-9,-5],[14,33],[24,-44],[-26,0]],[[3.0000000000000036,2.0000000000000009],[5.0000000000000053,0.99999999999999267],[-5.773159728050814e-15,1.0000000000000027],[0.99999999999999645,1.0000000000000036]]).
Running tests/issues-OLD/test601.pl ...
...
Running tests/issues/test066.pl ...

============
TEST SUMMARY
============
Failed: 3
Succeeded: 149

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Running make check on Ubuntu 18.04 64 bits:

Running tests/tests/test074.pl ...
==22262== Conditional jump or move depends on uninitialised value(s)
==22262==    at 0x118081: throw_error3.part.0 (in trealla/tpl)
==22262==    by 0x11637F: throw_error (in trealla/tpl)
==22262==    by 0x183807: fn_iso_term_variables_2 (in trealla/tpl)
==22262==    by 0x190182: start (in trealla/tpl)
==22262==    by 0x14B880: run (in trealla/tpl)
==22262==    by 0x13DFE8: load_fp (in trealla/tpl)
==22262==    by 0x13E4CF: load_file (in trealla/tpl)
==22262==    by 0x18A501: pl_consult (in trealla/tpl)
==22262==    by 0x114E04: main (in trealla/tpl)
==22262== 
...
Running tests/issues-OLD/test053.pl ...
==22400== Conditional jump or move depends on uninitialised value(s)
==22400==    at 0x118081: throw_error3.part.0 (in trealla/tpl)
==22400==    by 0x11637F: throw_error (in trealla/tpl)
==22400==    by 0x15BD36: fn_iso_univ_2 (in trealla/tpl)
==22400==    by 0x190182: start (in trealla/tpl)
==22400==    by 0x14B880: run (in trealla/tpl)
==22400==    by 0x13DFE8: load_fp (in trealla/tpl)
==22400==    by 0x13E4CF: load_file (in trealla/tpl)
==22400==    by 0x18A501: pl_consult (in trealla/tpl)
==22400==    by 0x114E04: main (in trealla/tpl)
==22400== 
...
Running tests/issues-OLD/test619.pl ...
==22530== Conditional jump or move depends on uninitialised value(s)
==22530==    at 0x118081: throw_error3.part.0 (in trealla/tpl)
==22530==    by 0x11637F: throw_error (in trealla/tpl)
==22530==    by 0x1A8DF7: do_read_term (in trealla/tpl)
==22530==    by 0x1AAED0: fn_read_term_from_chars_3 (in trealla/tpl)
==22530==    by 0x190182: start (in trealla/tpl)
==22530==    by 0x14B880: run (in trealla/tpl)
==22530==    by 0x13DFE8: load_fp (in trealla/tpl)
==22530==    by 0x13E4CF: load_file (in trealla/tpl)
==22530==    by 0x18A501: pl_consult (in trealla/tpl)
==22530==    by 0x114E04: main (in trealla/tpl)
==22530== 
Running tests/issues/test030.pl ...
Running tests/issues/test066.pl ...

============
TEST SUMMARY
============
Failed: 0
Succeeded: 152

On Ubuntu 14.04 32 bits no valgrind erros are reported, but see bellow:

Running tests/issues-OLD/test116.pl ...
1c1
< [] = "PASS".
---
> Warning: call(main) failed

from trealla.

mingodad avatar mingodad commented on July 28, 2024

Strange enough (maybe bug in valgrind) when compiling replacing -O3 by -g or only adding -g then no errors reported by valgrind.
When testing with a built from source newer valgrind no error at all:

#default valgrind
valgrind --version
valgrind-3.13.0
#compiled from source
myvalgrind --version
valgrind-3.17.0

from trealla.

infradig avatar infradig commented on July 28, 2024

from trealla.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.