Subject: [clisp-list] dirkey on linux?

From: Pascal J.Bourguignon <[email-masked]>
Date: Fri Feb 13 02:27:01 2004

I can't compile  clisp-2.32 with dirkey.  It insists  on including and
using MS-Windows stuff...

executing /local/src/clisp-2.32/src/configure --with-export-syscalls --with-dynamic-modules --prefix=/local/languages/clisp/ --with-module=regexp --with-module=clx/new-clx --with-module=queens --with-module=syscalls --with-module=dirkey --with-module=wildcard --with-module=bindings/glibc --cache-file=config.cache

...

checking ldap.h usability... yes
checking ldap.h presence... yes
checking for ldap.h... yes

...

    cd src
    ./makemake --with-dynamic-ffi  --with-export-syscalls --with-dynamic-modules --prefix=/local/languages/clisp/ --with-module=regexp --with-module=clx/new-clx --with-module=queens --with-module=syscalls --with-module=dirkey --with-module=wildcard --with-module=bindings/glibc --hyperspec=http://thalssa.informatimago.com/local/lisp/www.lispworks.com/reference/HyperSpec/   > Makefile
    make config.lisp
    emacsclient config.lisp
    make

test -d dirkey || ./lndir ../modules/dirkey dirkey
if test -f dirkey/configure -a '!' -f dirkey/config.status ; then cd dirkey ; ./configure --cache-file=`echo dirkey/ | sed -e 's,[^/][^/]*//*,../,g'`config.cache ; fi
configure: loading cache ../config.cache
configure:  * Dirkey (Tools):
checking for gcc... (cached) gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... (cached) o
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ANSI C... (cached) none needed
checking how to run the C preprocessor... (cached) gcc -E
configure:  * Dirkey (Headers):
checking for egrep... (cached) grep -E
checking for ANSI C header files... (cached) yes
checking for sys/types.h... (cached) yes
checking for sys/stat.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for memory.h... (cached) yes
checking for strings.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for unistd.h... (cached) yes
checking ldap.h usability... yes
checking ldap.h presence... yes
checking for ldap.h... yes
checking gnome.h usability... no
checking gnome.h presence... no
checking for gnome.h... no
configure:  * Dirkey (Output):
updating cache ../config.cache
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
configure:  * Dirkey (Done)
CLISP="`pwd`/lisp.run -M `pwd`/lispinit.mem -B `pwd` -N `pwd`/locale -Efile UTF-8 -Eterminal UTF-8 -norc" ; cd dirkey ; dots=`echo dirkey/ | sed -e 's,[^/][^/]*//*,../,g'` ; make clisp-module CC="gcc" CFLAGS="-W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type  -Wno-sign-compare -O2 -fexpensive-optimizations -DUNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -DNO_SIGSEGV -fPIC" INCLUDES="$dots" LISPBIBL_INCLUDES=" ${dots}lispbibl.c ${dots}fsubr.c ${dots}subr.c ${dots}pseudofun.c ${dots}constsym.c ${dots}constobj.c ${dots}unix.c ${dots}xthread.c ${dots}libcharset.h" CLFLAGS="-x none -Wl,-export-dynamic" LIBS="libcharset.a libavcall.a libcallback.a -lreadline -lncurses -ldl   " RANLIB="ranlib" CLISP="$CLISP -q"
make[1]: Entering directory `/local/src/clisp-2.32/src/dirkey'
/local/src/clisp-2.32/src/lisp.run -M /local/src/clisp-2.32/src/lispinit.mem -B /local/src/clisp-2.32/src -N /local/src/clisp-2.32/src/locale -Efile UTF-8 -Eterminal UTF-8 -norc -q ../modprep.fas dirkey.c
;; MODPREP: "dirkey.c" --> #P"dirkey.m.c"
;; MODPREP: reading "dirkey.c": 32,027 bytes, 883 lines

;; MODPREP: 18 objects, 12 DEFUNs
;; packages: ("LDAP")
MODPREP: wrote #P"dirkey.m.c" (38,915 bytes)

Real time: 0.701425 sec.
Run time: 0.19 sec.
Space: 569032 Bytes
GC: 1, GC time: 0.03 sec.
gcc -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type  -Wno-sign-compare -O2 -fexpensive-optimizations -DUNICODE -DDYNAMIC_FFI -DDYNAMIC_MODULES -DNO_SIGSEGV -fPIC -I../ -c dirkey.m.c -o dirkey.o
In file included from dirkey.c:10:
config.h:38:1: warning: "PACKAGE_BUGREPORT" redefined
In file included from dirkey.c:8:
../clisp.h:124:1: warning: this is the location of the previous definition
In file included from dirkey.c:10:
config.h:41:1: warning: "PACKAGE_NAME" redefined
In file included from dirkey.c:8:
../clisp.h:125:1: warning: this is the location of the previous definition
In file included from dirkey.c:10:
config.h:44:1: warning: "PACKAGE_STRING" redefined
In file included from dirkey.c:8:
../clisp.h:126:1: warning: this is the location of the previous definition
In file included from dirkey.c:10:
config.h:47:1: warning: "PACKAGE_TARNAME" redefined
In file included from dirkey.c:8:
../clisp.h:127:1: warning: this is the location of the previous definition
In file included from dirkey.c:10:
config.h:50:1: warning: "PACKAGE_VERSION" redefined
In file included from dirkey.c:8:
../clisp.h:128:1: warning: this is the location of the previous definition
dirkey.c:28:22: windows.h: No such file or directory
dirkey.c: In function `C_subr_ldap_dir_key_close':
dirkey.c:227: error: `errno' undeclared (first use in this function)
dirkey.c:227: error: (Each undeclared identifier is reported only once
dirkey.c:227: error: for each function it appears in.)
dirkey.c: In function `fehler_ldap':
dirkey.c:359: warning: implicit declaration of function `CLSTEXT'
dirkey.c:359: warning: assignment makes pointer from integer without a cast
dirkey.c: In function `C_subr_ldap_dir_key_subkeys':
dirkey.c:533: error: `LONG' undeclared (first use in this function)
dirkey.c:533: error: parse error before "status"
dirkey.c:533: error: `DWORD' undeclared (first use in this function)
dirkey.c:533: error: `HKEY' undeclared (first use in this function)
dirkey.c:533: error: `status' undeclared (first use in this function)
dirkey.c:533: warning: implicit declaration of function `RegQueryInfoKey'
dirkey.c:533: error: `hkey' undeclared (first use in this function)
dirkey.c:533: error: `n_obj' undeclared (first use in this function)
dirkey.c:533: error: `maxlen' undeclared (first use in this function)
dirkey.c:533: error: `ERROR_SUCCESS' undeclared (first use in this function)
dirkey.c:533: warning: implicit declaration of function `SetLastError'
dirkey.c:533: error: parse error before "len"
dirkey.c:533: warning: implicit declaration of function `RegEnumKey'
dirkey.c:533: error: `len' undeclared (first use in this function)
dirkey.c: In function `C_subr_ldap_dir_key_attributes':
dirkey.c:541: error: `LONG' undeclared (first use in this function)
dirkey.c:541: error: parse error before "status"
dirkey.c:541: error: `DWORD' undeclared (first use in this function)
dirkey.c:541: error: `HKEY' undeclared (first use in this function)
dirkey.c:541: error: `status' undeclared (first use in this function)
dirkey.c:541: error: `hkey' undeclared (first use in this function)
dirkey.c:541: error: `n_obj' undeclared (first use in this function)
dirkey.c:541: error: `maxlen' undeclared (first use in this function)
dirkey.c:541: error: `ERROR_SUCCESS' undeclared (first use in this function)
dirkey.c:541: error: parse error before "len"
dirkey.c:541: warning: implicit declaration of function `RegEnumValue'
dirkey.c:541: error: `len' undeclared (first use in this function)
dirkey.c: In function `init_iteration_node':
dirkey.c:650: warning: implicit declaration of function `open_reg_key'
dirkey.c:650: error: `HKEY' undeclared (first use in this function)
dirkey.c:650: error: parse error before ')' token
dirkey.c:652: error: `DWORD' undeclared (first use in this function)
dirkey.c:652: error: parse error before "k_size"
dirkey.c:653: warning: implicit declaration of function `SYSCALL_WIN32'
dirkey.c:653: error: `k_size' undeclared (first use in this function)
dirkey.c:654: error: `a_size' undeclared (first use in this function)
dirkey.c:654: error: `d_size' undeclared (first use in this function)
dirkey.c: In function `state_next_key':
dirkey.c:682: error: `DWORD' undeclared (first use in this function)
dirkey.c:682: error: parse error before "status"
dirkey.c:684: error: `status' undeclared (first use in this function)
dirkey.c:684: error: `ERROR_SUCCESS' undeclared (first use in this function)
dirkey.c:688: warning: implicit declaration of function `RegCloseKey'
dirkey.c:688: error: `HKEY' undeclared (first use in this function)
dirkey.c: In function `C_subr_ldap_dkey_search_next_att':
dirkey.c:760: error: `DWORD' undeclared (first use in this function)
dirkey.c:760: error: parse error before "type"
dirkey.c:766: error: `status' undeclared (first use in this function)
dirkey.c:766: error: `ERROR_SUCCESS' undeclared (first use in this function)
dirkey.c:769: warning: implicit declaration of function `registry_value_to_object'
dirkey.c:769: error: `type' undeclared (first use in this function)
dirkey.c:769: error: `size' undeclared (first use in this function)
dirkey.c:769: warning: assignment makes pointer from integer without a cast
dirkey.c: In function `C_subr_ldap_dir_key_value':
dirkey.c:825: error: `DWORD' undeclared (first use in this function)
dirkey.c:825: error: parse error before "status"
dirkey.c:825: error: `HKEY' undeclared (first use in this function)
dirkey.c:825: error: parse error before "hk"
dirkey.c:825: error: `status' undeclared (first use in this function)
dirkey.c:825: warning: implicit declaration of function `RegQueryValueEx'
dirkey.c:825: error: `hk' undeclared (first use in this function)
dirkey.c:825: error: `size' undeclared (first use in this function)
dirkey.c:825: error: `ERROR_SUCCESS' undeclared (first use in this function)
dirkey.c:825: error: `ERROR_FILE_NOT_FOUND' undeclared (first use in this function)
dirkey.c:825: error: `type' undeclared (first use in this function)
dirkey.c:825: error: `BYTE' undeclared (first use in this function)
dirkey.c:825: error: parse error before ')' token
dirkey.c:825: warning: assignment makes pointer from integer without a cast
dirkey.c: In function `C_subr_ldap_set_dkey_value':
dirkey.c:836: error: `HKEY' undeclared (first use in this function)
dirkey.c:836: error: parse error before "hk"
dirkey.c:859: warning: implicit declaration of function `RegSetValueEx'
dirkey.c:859: error: `hk' undeclared (first use in this function)
dirkey.c:859: error: `REG_SZ' undeclared (first use in this function)
dirkey.c:859: error: `BYTE' undeclared (first use in this function)
dirkey.c:859: error: parse error before ')' token
dirkey.c:859: error: `DWORD' undeclared (first use in this function)
dirkey.c:859: error: parse error before "word"
dirkey.c:859: error: `REG_DWORD' undeclared (first use in this function)
dirkey.c:859: error: parse error before ')' token
dirkey.c:859: error: `word' undeclared (first use in this function)
dirkey.c:859: error: `REG_BINARY' undeclared (first use in this function)
dirkey.c: In function `C_subr_ldap_dir_key_subkey_delete':
dirkey.c:875: warning: implicit declaration of function `RegDeleteKey'
dirkey.c:875: error: `HKEY' undeclared (first use in this function)
dirkey.c: In function `C_subr_ldap_dir_key_value_delete':
dirkey.c:879: warning: implicit declaration of function `RegDeleteValue'
dirkey.c:879: error: `HKEY' undeclared (first use in this function)
dirkey.c: In function `C_subr_ldap_dkey_info':
dirkey.c:890: error: `HKEY' undeclared (first use in this function)
dirkey.c:890: error: parse error before "hkey"
dirkey.c:892: error: `DWORD' undeclared (first use in this function)
dirkey.c:892: error: parse error before "class_length"
dirkey.c:900: error: `FILETIME' undeclared (first use in this function)
dirkey.c:901: error: `hkey' undeclared (first use in this function)
dirkey.c:901: error: `class_length' undeclared (first use in this function)
dirkey.c:908: error: `num_sub_keys' undeclared (first use in this function)
dirkey.c:908: error: `max_sub_key_length' undeclared (first use in this function)
dirkey.c:909: error: `max_class_length' undeclared (first use in this function)
dirkey.c:910: error: `num_values' undeclared (first use in this function)
dirkey.c:910: error: `max_value_name_length' undeclared (first use in this function)
dirkey.c:911: error: `max_value_length' undeclared (first use in this function)
dirkey.c:912: error: `security_descriptor' undeclared (first use in this function)
dirkey.c:913: error: `write_time' undeclared (first use in this function)
dirkey.c:926: warning: implicit declaration of function `to_time_t_'
make[1]: *** [dirkey.o] Error 1
make[1]: Leaving directory `/local/src/clisp-2.32/src/dirkey'
make: *** [dirkey] Error 2

-- 
__Pascal_Bourguignon__                     http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/

---

From: Sam Steingold <[email-masked]>
Date: Fri Feb 13 05:28:02 2004

> * Pascal J.Bourguignon <[email-masked]> [2004-02-13 09:26:45 +0100]:
>

the only dirkey type supported at this time is :win32.
gnome-config and ldap have not been implemented yet.
would you like to work on this?

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Programming is like sex: one mistake and you have to support it for a lifetime.

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Fri Feb 13 06:42:04 2004

> would you like to work on this?

On OpenLDAP, probably!

But I'm wondering if a module is needed.  I'd rather do it with FFI or
UFFI to the OpenLDAP library.

---

From: Sam Steingold <[email-masked]>
Date: Fri Feb 13 06:58:03 2004

> * Pascal J.Bourguignon <[email-masked]> [2004-02-13 15:41:07 +0100]:
>
> Sam Steingold writes:
good!

> But I'm wondering if a module is needed.

I think that LDAP API is insufficiently Lispy, so C glue will be needed.

> I'd rather do it with FFI or

C module is faster than FFI.
My rule of thumb is that when you have zillions of functions each of
which will be called infrequently, one should use FFI (e.g.,
clisp/modules/bindings/glibc), but when you have relatively few
functions which will be called over and over again, it pays to write a C
module (like LDAP).

Another important consideration is that C module approach is more
robust. E.g., if the C library to which you are interfacing changes a
struct layout of a #define value, a C module would need to be
recompiled - but the FFI module will require source code modifications
to reflect the changes.

> UFFI to the OpenLDAP library.

UFFI does not support CLISP.
Would you like to work on that too?
(UFFI takes priority over dirkey!)

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
Life is like a diaper -- short and loaded.

---

From: Pascal J.Bourguignon <[email-masked]>
Date: Fri Feb 13 07:04:07 2004

> recompiled - but the FFI module will require source code modifications

But an important  (to me) considation is that a  FFI based solution is
written in Lisp :-) while a module is written in C :-(.

> (UFFI takes priority over dirkey!)

I already started to implement  a UFFI package over FFI.  An important
part that  is missing  is dlopen et  al. Reading the  documentation of
SYS::DYNLOAD-MODULES I got  the impression that it would  not serve to
load random libraries. I guess a dl module would be in order.

---

From: Sam Steingold <[email-masked]>
Date: Fri Feb 13 07:33:03 2004

> * Pascal J.Bourguignon <[email-masked]> [2004-02-13 16:03:05 +0100]:
>

I understand this.
Unfortunately, DTRT sometimes requires doing some C.
It's not hard, trust me.

> load random libraries. I guess a dl module would be in order.

see FFI::FOREIGN-LIBRARY (clisp/src/foreign.d)
and DEF-C-VAR & DEF-CALL-OUT :LIBRARY options.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.honestreporting.com>
If you think big enough, you'll never have to do it.