ChezScheme
ChezScheme copied to clipboard
fatal error: 'uuid/uuid.h' file not found
I resolved this by installing uuid-dev (ubuntu 16 LTS).
Installation went well afterwards. I had no other trouble during installing. :+1:
If feasible, you may like to adjust ./configure such that it catches if uuid library is missing. Otherwise this issue is yet another marker for ppl who are trying to install chez and have this kind of trouble.
It seems like it might be possible to remove the dependency on libuuid entirely. As long as you have a good source of randomness like /dev/urandom, generating Type 4 UUIDs is not especially hard. Does Chez Scheme support platforms where ~that~ good randomness is not available?
#!r6rs
;; Generate Type 4 UUIDs in R6RS Scheme.
;; Ported from https://github.com/LiberalArtist/uuid/blob/master/main.rkt
(import (rnrs)
(rnrs bytevectors)
(rnrs arithmetic fixnums)
(rnrs io ports))
(define (bytevector-update! bv i proc)
(bytevector-u8-set! bv i (proc (bytevector-u8-ref bv i))))
(define (uuid)
(define bv
(let ([in (open-file-input-port "/dev/urandom")])
(dynamic-wind
(lambda () #t)
(lambda () (get-bytevector-n in 16))
(lambda () (close-port in)))))
;; version number
(bytevector-update! bv 6 (lambda (x)
(fxior #b01000000
(fxand #b00001111 x))))
;; variant
(bytevector-update! bv 8 (lambda (x)
;; but see https://www.rfc-editor.org/errata/eid5560
;; (not a big issue for version 4 uuids)
(fxior #b10000000
(fxand #b00111111 x))))
bv)
;; Example:
(write (uuid))
Windows for one certainly doesn't have /dev/urandom
Yes, but Chez Scheme already uses UuidCreate on Windows, and Windows also offers an interface to cryptographic-quality randomness, RtlGenRandom.
We mention that the header files and libraries for uuid are required in BUILDING, but it would be helpful if we could detect the absence in configure and give an informative error message. The same goes for nurses and Xwindows, I suppose. If you know how to do that in a simple, robust way, please submit a pull request.
libuuid-dev is convenient and readily available on Unix-like systems, so I'd prefer not to reproduce part of it for Chez Scheme using /dev/urandom.
EDIT: sorry for the noise! I needed llibuuid-devel, not uuid-devel. Build and install went just fine. Also I found someone has already made a Fedora RPM for Chez, only 2 patch versions out of date: https://copr.fedorainfracloud.org/coprs/superboum/chez-scheme/packages/
I am trying to build Chez on Fedora 35, and I installed uuid-devel, but the header file was installed to /usr/include/uuid.h and not /usr/include/uuid/uuid.h, which causes compilation to fail, because uuid/uuid.h does not exist and cannot be found.
I see that USE_NETBSD_UUID changes the #include <uuid/uuid.h> to #include <uuid.h>, but it seems like a bad idea to force that setting, given that I am definitely not using NetBSD.
Is there an appropriate workaround, other than patching the source code? I would ultimately like to try to package this properly in RPM format for Fedora, so in that case a patch isn't a big deal. But patching is messy and I'd prefer to avoid it if possible.
This is what I did:
./configure \
--threads \
--installprefix=$HOME/.opt/chez \
--installschemename=chez \
--installscriptname=chez-script
make install
The default build mode no longer uses uuid/uuid.h.