scm-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Scm-discuss] compile->executable error


From: Karl Zhang
Subject: [Scm-discuss] compile->executable error
Date: Fri, 21 Oct 2016 11:35:23 +0800

Dear Aubrey,

I tried to compile a simple script but it failed.

############################################################
$ ./scm -rcompile -e '(compile->executable "ex1.scm")'
; Scheme (linux) script created by SLIB/batch Fri Oct 21 11:08:01 2016
; [-p linux]
; ================ Write file with C defines
(delete-file "scmflags.h")
(call-with-output-file
  "scmflags.h"
  (lambda (fp)
    (for-each
      (lambda (string) (write-line string fp))
      '("#define IMPLINIT \"Init5f2.scm\""
        "#define CCLO"
        "#define FLOATS"))))
; ================ Compile C source files
(system "gcc -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c eval.c sys.c subr.c debug.c unif.c rope.c")
scm.c: In function ‘process_signals’:
scm.c:176:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  wta(UNDEFINED, (char *)i, "");
                 ^
scm.c: In function ‘scmable_signal’:
scm.c:290:22: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       wta(UNDEFINED, (char *)i, "");
                      ^
scmmain.c: In function ‘main’:
scmmain.c:109:32: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
   if (0==argc) {argc = 1; argv = generic_name;} /* for macintosh */
                                ^
scmmain.c:119:16: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
     script_arg = argv[2]; /* Save for scm_find_execpath() call */
                ^
scmmain.c:120:5: warning: passing argument 1 of ‘script_count_argv’ from incompatible pointer type [enabled by default]
     nargc = script_count_argv(nargv);
     ^
In file included from scmmain.c:30:0:
scm.h:1080:17: note: expected ‘const char **’ but argument is of type ‘char **’
 SCM_EXPORT int  script_count_argv P((const char **argv));
                 ^
scmmain.c:122:15: warning: assignment from incompatible pointer type [enabled by default]
   else {nargv = argv; nargc = argc;}
               ^
scmmain.c:124:3: warning: passing argument 2 of ‘scm_find_execpath’ from incompatible pointer type [enabled by default]
   execpath = scm_find_execpath(nargc, nargv, script_arg);
   ^
In file included from scmmain.c:30:0:
scm.h:775:18: note: expected ‘const char * const*’ but argument is of type ‘char **’
 SCM_EXPORT char *scm_find_execpath P((int argc, const char * const *argv, const char *script_arg));
                  ^
scmmain.c:131:5: warning: passing argument 2 of ‘scm_init_from_argv’ from incompatible pointer type [enabled by default]
     scm_init_from_argv(nargc, nargv, script_arg, iverbose, buf0stdin);
     ^
In file included from scmmain.c:30:0:
scm.h:768:17: note: expected ‘const char * const*’ but argument is of type ‘char **’
 SCM_EXPORT void scm_init_from_argv P((int argc, const char * const *argv, char *script_arg,
                 ^
script.c: In function ‘find_impl_file’:
script.c:149:18: warning: initialization discards ‘const’ qualifier from pointer target type [enabled by default]
   char *extptr = exec_path + strlen(exec_path);
                  ^
script.c:165:10: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
   extptr = exec_path + strlen(exec_path);
          ^
script.c: In function ‘script_process_argv’:
script.c:362:12: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
   nargv[0] = argv[0];
            ^
script.c:377:22: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
       nargv[nargi++] = argv[argi++];
                      ^
script.c:380:39: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
   while (argi <= argc) nargv[nargi++] = argv[argi++];
                                       ^
repl.c: In function ‘handle_it’:
repl.c:1270:20: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     wta(UNDEFINED, (char *)i, ""); /* sends it to def_err_response */
                    ^
repl.c: In function ‘def_err_response’:
repl.c:2077:47: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     lputc((long)err_pos <= ARGn ? ' ' : '1' + (int)err_pos - ARG1, cur_errp);
                                               ^
repl.c:2080:23: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
   else lputs(errmsgs[((int)err_pos)-WNA].msg, cur_errp);
                       ^
repl.c: In function ‘everr’:
repl.c:2133:11: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
   err_pos = pos;
           ^
repl.c:2134:14: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
   err_s_subr = s_subr;
              ^
In file included from repl.c:21:0:
repl.c:2139:24: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     COOKIE(1) : COOKIE((int)pos));
                        ^
scm.h:260:21: note: in definition of macro ‘COOKIE’
 # define COOKIE(n) (n)
                     ^
; ================ Link C object files
(system "gcc -rdynamic -o ex1.scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -L/home/azc/build/scm/scm/ -lm -lc")
scl.o: In function `istr2flo':
scl.c:(.text+0x1593): undefined reference to `makflo'
collect2: error: ld returned 1 exit status
; ================ Link failed!
#############################################################################

My system is CentOS 7 64bit, and I also tested in Debian 8 64bit, same situation.

Would you have a look on it ?

Further more, the scm.spec your provides does not work in CentOS 7.
I've fixed it, hope it will help others.
#################################################
--- ./scm.spec  2015-01-15 10:26:49.000000000 +0800
+++ /home/azzhangc/git/RpmSpecs/scm.spec        2016-10-19 08:07:40.783355199 +0800
@@ -1,16 +1,15 @@
 %define name scm
 %define version 5f2
-%define release 1
-%define implpath %{prefix}/lib/scm
-%define slibpath %{prefix}/lib/slib
-%define dumparch setarch %{_target_cpu}
+%define release 2
+%define implpath %{prefix}/lib/scm/
+%define slibpath %{prefix}/lib/slib/
+%define dumparch setarch %{_target_cpu} -R
 # rpm seems to require all on one line, bleah.
 %define features cautious bignums arrays inexact dump dynamic-linking macro engineering-notation

 Name:         %{name}
 Release:      %{release}
 Version:      %{version}
-Packager:     Aubrey Jaffer <agj @ alum.mit.edu>

 License:      GPL
 Vendor:       Aubrey Jaffer <agj @ alum.mit.edu>
@@ -23,6 +22,7 @@
 URL:          http://people.csail.mit.edu/jaffer/SCM
 BuildRoot:    %{_tmppath}/%{name}-%{version}
 Prefix:       /usr
+Patch0:       scm-0001-Makefile.patch

 %description
 Scm conforms to Revised^5 Report on the Algorithmic Language Scheme and
@@ -40,13 +40,14 @@
 %setup -n scm -c -T
 cd ..
 unzip $RPM_SOURCE_DIR/scm-%{version}.zip
+%patch0

 %build
 # SLIB is required to build SCM.
 if [ -n "$SCHEME_LIBRARY_PATH" ]; then
   echo using SLIB $SCHEME_LIBRARY_PATH
 elif [ -d %{slibpath} ]; then
-  export SCHEME_LIBRARY_PATH=%{slibpath}/
+  export SCHEME_LIBRARY_PATH=%{slibpath}
 elif [ -d %{prefix}/share/slib ]; then
   export SCHEME_LIBRARY_PATH=%{prefix}/share/slib/
 fi
@@ -56,7 +57,7 @@

 # Build the executable.
 ./build -h system -o udscm5 --compiler-options="-O2" -l debug -s %{implpath} -F %{features}
-echo "(quit)" | ./udscm5 -no-init-file -r5 -o scm
+echo "(quit)" | %{dumparch} ./udscm5 -no-init-file -r5 -o scm
 # make check

 # Build dlls
@@ -84,25 +85,34 @@
 mkdir -p ${RPM_BUILD_ROOT}%{prefix}/bin
 mkdir -p ${RPM_BUILD_ROOT}%{prefix}/lib/scm
 mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man1
+
+# Assume SLIB is in %{prefix}/lib/slib, as installed by the slib rpm.
+cat > ${RPM_BUILD_ROOT}%{prefix}/lib/scm/require.scm <<EOF
+(set! library-vicinity (lambda () "%{prefix}/lib/slib/"))
+EOF
+
 make prefix=${RPM_BUILD_ROOT}%{prefix}/ \
      mandir=${RPM_BUILD_ROOT}%{_mandir}/ \
      infodir=${RPM_BUILD_ROOT}%{_infodir}/ \
      install
 rm -f ${RPM_BUILD_ROOT}%{prefix}/bin/scm
-cp udscm5 ${RPM_BUILD_ROOT}%{prefix}/bin/
+install -m 755 -s udscm5 ${RPM_BUILD_ROOT}%{prefix}/bin/

-# Assume SLIB is in %{prefix}/lib/slib, as installed by the slib rpm.
-cat > ${RPM_BUILD_ROOT}%{prefix}/lib/scm/require.scm <<EOF
-(set! library-vicinity (lambda () "%{prefix}/lib/slib/"))
-EOF
+# remove build root from
+#sed -i -e "s#${RPM_BUILD_ROOT}##g" \
+#      ${RPM_BUILD_ROOT}%{prefix}/lib/scm/slibcat \
+#      ${RPM_BUILD_ROOT}%{prefix}/lib/scm/implcat
+rm -f ${RPM_BUILD_ROOT}%{prefix}/lib/scm/slibcat \
+       ${RPM_BUILD_ROOT}%{prefix}/lib/scm/implcat \
+       ${RPM_BUILD_ROOT}%{_infodir}/dir

 %clean
 rm -rf $RPM_BUILD_ROOT

 %post
 echo "(quit)" | %{dumparch} %{prefix}/bin/udscm5 -no-init-file -r5 -o %{prefix}/bin/scm
-ln -s %{prefix}/bin/scm %{prefix}/local/bin/scm
-ln -s %{prefix}/lib/scm %{prefix}/local/lib/
+ln -snf %{prefix}/bin/scm %{prefix}/local/bin/scm
+ln -snf %{prefix}/lib/scm %{prefix}/local/lib/
 %{prefix}/bin/scm -br new-catalog

 %verifyscript
@@ -111,15 +121,13 @@
     %{prefix}/bin/scm -fr4rstest.scm -e'(test-sc4)(test-cont)(test-delay)(gc)')

 %preun
-rm -f %{prefix}/lib/scm/slibcat %{prefix}/lib/scm/implcat
-if [ -L %{prefix}/local/bin/scm ] && \
-    ls -l %{prefix}/local/bin/scm | grep -q "> %{prefix}/bin/scm"; then
-  rm -f %{prefix}/local/bin/scm
-fi
-if [ -L %{prefix}/local/lib/scm ] && \
-    ls -l %{prefix}/local/lib/scm | grep -q "> %{prefix}/lib/scm"; then
-  rm -f %{prefix}/local/lib/scm
-fi
+for sl in bin/scm lib/scm; do
+    if [ -L %{prefix}/local/$sl ] && \
+        [ "$(readlink %{prefix}/local/$sl)" = "%{prefix}/$sl" ]; then
+        rm -f %{prefix}/local/$sl
+    fi
+done
+
 rm -f %{prefix}/bin/scm

 %files
@@ -172,7 +180,7 @@
 %{_infodir}/Xlibscm.info.gz
 %{_infodir}/hobbit.info.gz
 %{_infodir}/scm.info.gz
-%{_infodir}/dir
+#%{_infodir}/dir
 %{_mandir}/man1/scm.1.gz

 %{prefix}/lib/libscm.a
##########################################################


Thanks in advance.

Karl.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]