Source: maxima-sage
Version: 5.35.1-1

Hi Maintainer

Building maxima-sage with LDFLAGS containing more than one flag results in warnings similar to the following:

;      - Loading binary file "binary-ecl/init-cl.fas"
;;; Loading "/<<PKGBUILDDIR>>/src/binary-ecl/init-cl.fas"
;  - Providing system maxima
/usr/bin/ld: warning: -z relro -Wl ignored.
/usr/bin/ld: warning: -z now -Wl ignored.
/usr/bin/ld: warning: -z relro -Wl ignored.
/usr/bin/ld: warning: -z now -Wl ignored.

To reproduce, add either or both of the following lines to debian/rules:

export DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

In Ubuntu, the build fails with an error instead of a warning:

; - Loading binary file "binary-ecl/init-cl.fas"
;;; Loading "/<<PKGBUILDDIR>>/src/binary-ecl/init-cl.fas"
;  - Providing system maxima
/usr/bin/ld: unrecognized option '-Bsymbolic-functions -Wl'
/usr/bin/ld: use the --help option for usage information
collect2: error: ld returned 1 exit status
An error occurred during initialization:
Error code 1 when executing
(RUN-PROGRAM "gcc" ("-o" "binary-ecl/maxima.fas" "-L/usr/lib/"
                    "/tmp/eclinitH7b3lL.o" "binary-ecl/maxima-package.o"
"binary-ecl/ecl-port.o" "binary-ecl/autoconf-variables.o"
                    ...
                    "binary-ecl/init-cl.o"
"-Wl,-Bsymbolic-functions -Wl,-z,relro" "-shared" "-lecl"
                    "-lgmp" "-lgc" "-lffi" "-lpthread" "-ldl" "-lm")).
Makefile:1253: recipe for target 'binary-ecl/maxima' failed

The attached patch clears the warnings and errors, but I am no lisp programmer. The split-string function was copied straight from lisp-utils/defsystem-lisp.

Regards
Graham

--- a/src/maxima.system
+++ b/src/maxima.system
@@ -59,6 +59,19 @@
     (and (apply #'compile-file file :output-file object-output args)
 	 (c:build-fasl output :lisp-files (list object-output)))))
 
+(defun split-string (string &key (item #\space) (test #'char=))
+  ;; Splits the string into substrings at spaces.
+  (let ((len (length string))
+	(index 0) result)
+    (dotimes (i len
+		(progn (unless (= index len)
+			 (push (subseq string index) result))
+		       (reverse result)))
+      (when (funcall test (char string i) item)
+	(unless (= index i);; two spaces in a row
+	  (push (subseq string index i) result))
+	(setf index (1+ i))))))
+
 #+ecl
 (defun build-maxima-lib ()
   (labels ((list-all-objects (module)
@@ -80,12 +93,12 @@
 			  :ld-flags
 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
 							      (find-package "MAXIMA")))))
-			    (if (and x (not (string= x ""))) (list x))))
+			    (if (and x (not (string= x ""))) (split-string x))))
 	(c::build-program "binary-ecl/maxima" :lisp-files obj
 			  :ld-flags
 			  (let ((x (symbol-value (find-symbol "*AUTOCONF-LD-FLAGS*"
 							      (find-package "MAXIMA")))))
-			    (if (and x (not (string= x ""))) (list x)))
+			    (if (and x (not (string= x ""))) (split-string x)))
 			  :epilogue-code '(progn (require :defsystem)
 					         (cl-user::run)))))))
 

Reply via email to