Cross-compilation of the Guile bindings
Hello! I'm trying to cross build gnutls
with guile-3.0.4
, but I get an error:
GEN modules/gnutls.scm
GUILEC modules/gnutls.go
GUILEC modules/gnutls/extra.go
Backtrace:
In ice-9/psyntax.scm:
1241:36 19 (expand-top-sequence ((define-module (gnutls extra) *)) *)
1233:19 18 (parse _ (("placeholder" placeholder)) ((top) #(# # *)) *)
285:10 17 (parse _ (("placeholder" placeholder)) (()) _ c&e (# #) #)
In ice-9/eval.scm:
293:34 16 (_ #<module (#{ g97}#) 7fe40b3bac80>)
In ice-9/boot-9.scm:
3380:4 15 (define-module* _ #:filename _ #:pure _ #:version _ # _ *)
2565:24 14 (call-with-deferred-observers #<procedure 7fe40b9b1050 *>)
3393:24 13 (_)
222:17 12 (map1 (((gnutls))))
3297:17 11 (resolve-interface (gnutls) #:select _ #:hide _ #:prefix *)
In ice-9/threads.scm:
390:8 10 (_ _)
In ice-9/boot-9.scm:
3223:13 9 (_)
In ice-9/threads.scm:
390:8 8 (_ _)
In ice-9/boot-9.scm:
3507:20 7 (_)
2806:4 6 (save-module-excursion #<procedure 7fe40a59d570 at ice-*>)
3527:26 5 (_)
In unknown file:
4 (primitive-load-path "gnutls" #<procedure 7fe40a50d240 *>)
In ice-9/eval.scm:
626:19 3 (_ #<directory (gnutls) 7fe40b3baaa0>)
223:20 2 (proc #<directory (gnutls) 7fe40b3baaa0>)
In unknown file:
1 (%resolve-variable (7 . protocol/ssl3) #<directory (gnu*>)
In ice-9/boot-9.scm:
1669:16 0 (raise-exception _ #:continuable? _)
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Unbound variable: protocol/ssl3
make[3]: *** [Makefile:2520: modules/gnutls/extra.go] Error 1
make[3]: *** Waiting for unfinished jobs....
Here's the patch I propose:
--- guile/modules/gnutls.in
+++ guile/modules/gnutls.in
@@ -566,20 +566,33 @@
;; Renaming.
-(define protocol/ssl-3 protocol/ssl3)
-(define protocol/tls-1.0 protocol/tls1-0)
-(define protocol/tls-1.1 protocol/tls1-1)
+(define protocol/ssl-3 #f)
+(define protocol/tls-1.0 #f)
+(define protocol/tls-1.1 #f)
;; Aliases.
-(define credentials/anonymous credentials/anon)
-(define cipher/rijndael-256-cbc cipher/aes-256-cbc)
-(define cipher/rijndael-128-cbc cipher/aes-128-cbc)
-(define cipher/rijndael-cbc cipher/aes-128-cbc)
-(define cipher/arcfour-128 cipher/arcfour)
-(define certificate-verify/allow-any-x509-v1-ca-certificate
- certificate-verify/allow-any-x509-v1-ca-crt)
-(define certificate-verify/allow-x509-v1-ca-certificate
- certificate-verify/allow-x509-v1-ca-crt)
+(define credentials/anonymous #f)
+(define cipher/rijndael-256-cbc #f)
+(define cipher/rijndael-128-cbc #f)
+(define cipher/rijndael-cbc #f)
+(define cipher/arcfour-128 #f)
+(define certificate-verify/allow-any-x509-v1-ca-certificate #f)
+(define certificate-verify/allow-x509-v1-ca-certificate #f)
+
+(eval-when (load eval)
+ (unless (getenv "GNUTLS_GUILE_CROSS_COMPILING")
+ (set! protocol/ssl-3 protocol/ssl3)
+ (set! protocol/tls-1.0 protocol/tls1-0)
+ (set! protocol/tls-1.1 protocol/tls1-1)
+ (set! credentials/anonymous credentials/anon)
+ (set! cipher/rijndael-256-cbc cipher/aes-256-cbc)
+ (set! cipher/rijndael-128-cbc cipher/aes-128-cbc)
+ (set! cipher/rijndael-cbc cipher/aes-128-cbc)
+ (set! cipher/arcfour-128 cipher/arcfour)
+ (set! certificate-verify/allow-any-x509-v1-ca-certificate
+ certificate-verify/allow-any-x509-v1-ca-crt)
+ (set! certificate-verify/allow-x509-v1-ca-certificate
+ certificate-verify/allow-x509-v1-ca-crt)))
;; Deprecated OpenPGP bindings.
(define-deprecated certificate-type/openpgp)
Edited by Evgeny Ermakov