flightaware / speedtables

Speed tables is a high-performance memory-resident database. The speed table compiler reads a table definition and generates a set of C access routines to create, manipulate and search tables containing millions of rows. Currently oriented towards Tcl.

Home Page:https://flightaware.github.io/speedtables/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error when trying to compile example file

LordPraslea opened this issue · comments

Hi.

I get the following error when trying to compile the example Speed Table definition, i've searched on the net on a way to fix it and all I encounter are pointers to freebsd.. I've updated my glibc but still nothing.. see extra details below

Error:

In file included from stobj/include/ctable.h:37:0,
from stobj/Animinfo/Animinfo-1.1.c:24:
stobj/include/shared.c: In function ‘map_file’:
stobj/include/shared.c:228:17: error: ‘MAP_NOCORE’ undeclared (first use in this function)
stobj/include/shared.c:228:17: note: each undeclared identifier is reported only once for each function it appears in
stobj/include/shared.c: In function ‘parse_flags’:
stobj/include/shared.c:1544:19: error: ‘MAP_NOCORE’ undeclared (first use in this function)
stobj/include/shared.c: In function ‘shareCmd’:
stobj/include/shared.c:1783:32: error: ‘MAP_NOCORE’ undeclared (first use in this function)

Linux details: Linux Mint 11
Linux Arsenie 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

GCC details:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.5.2/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.5.2-8ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.5/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.5 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.5 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-gold --enable-ld=default --with-plugin-ld=ld.gold --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)

Currently compiled speedtables for both TCL 8.5.11 and 8.6b2.. i get the same error in both versions

Also I couldn"t get it to compile using the --with-pgsql command so I gave up.

Thanks in advance:).

I was going to say "of course the only code that refers to MAP_NOCORE was
inside an #ifdef guard for MAP_NOCORE".

But I thought "let me check on that" and lo and behold, looks like there's
been a bit of a regression.

I'm having firewall issues getting in to github from here, so I'll have to
check it in when I get home, in the meantime here's a patch.

diff --git a/ctables/shared/shared.c b/ctables/shared/shared.c
index 77d0d9f..0dbbab9 100644
--- a/ctables/shared/shared.c
+++ b/ctables/shared/shared.c
@@ -119,13 +119,18 @@ void shared_perror(char *text) {

#ifdef MAP_NOSYNC
-# define DEFAULT_FLAGS (MAP_SHARED|MAP_NOSYNC|MAP_NOCORE)
+# ifdef MAP_NOCORE
+# define DEFAULT_FLAGS (MAP_SHARED|MAP_NOSYNC|MAP_NOCORE)
+# else
+# define DEFAULT_FLAGS (MAP_SHARED|MAP_NOSYNC)
+# endif

define WITH_FLAGS 1

#else
-# define DEFAULT_FLAGS (MAP_SHARED|MAP_NOCORE)

ifdef MAP_NOCORE

+# define DEFAULT_FLAGS (MAP_SHARED|MAP_NOCORE)

define WITH_FLAGS 1

else

+# define DEFAULT_FLAGS (MAP_SHARED)

define WITH_FLAGS 0

endif

#endif

Hi LordPraslea, I've committed an update, 8f6a144, that should allow speedtables to compile on operating systems whose mmap doesn't support MAP_NOCORE.

Please give it a try.

Hi, it compiled perfectly, and the example worked:)

Thanks for the very quick fix. And keep up the good work, speedtables seems very promising I'm amazed by the things it does just by going through the files and browsing the documentation and it looks like an answer for many problems.