先下载最新的newlisp代码,解压后进入目录
创建文件CMakeLists.txt, 内容如下:
cmake_minimum_required (VERSION 2.6) include_directories(${CMAKE_SOURCE_DIR}) project(newlisp) set(NEWLISP_SRC newlisp newlisp.c nl-symbol.c nl-math.c nl-list.c nl-liststr.c nl-string.c nl-filesys.c nl-sock.c nl-import.c nl-xml.c nl-web.c nl-matrix.c nl-debug.c pcre.c) add_executable(newlisp ${NEWLISP_SRC}) #add_library(newlisp SHARED ${NEWLISP_SRC}) if(UNIX) add_definitions("-DLINUX") endif(UNIX) if(WIN) add_definitions("-DWIN_32") endif(WIN) if(APPLE) add_definitions("-DMAC_OSX") endif(APPLE) TARGET_LINK_LIBRARIES(newlisp ffi m dl readline ncurses)
cmake . make VERBOSE=1复制到/usr/bin目录下
cp newlisp /usr/bin/
[root@hadoopMaster newlisp-10.6.0]# newlisp newLISP v.10.6.0 32-bit on Linux IPv4/6, options: newlisp -h
首先,终端下设置环境变量:
export CFLAGS=-m64然后再运行cmake .
现在编译的时候可以看到-m64参数有了,但是还是没有效果。可能是gcc版本太老了。
根据这篇文章,将gcc升级到4.7
http://ask.xmodulo.com/upgrade-gcc-centos.html
还是没有解决问题,依然是32 bit, 下面是编译过程。
[root@hadoopMaster newlisp-10.6.0]# make VERBOSE=1 /usr/bin/cmake -H/opt/newlisp-10.6.0 -B/opt/newlisp-10.6.0 --check-build-system CMakeFiles/Makefile.cmake 0 /usr/bin/cmake -E cmake_progress_start /opt/newlisp-10.6.0/CMakeFiles /opt/newlisp-10.6.0/CMakeFiles/progress.make make -f CMakeFiles/Makefile2 all make[1]: Entering directory `/opt/newlisp-10.6.0‘ make -f CMakeFiles/newlisp.dir/build.make CMakeFiles/newlisp.dir/depend make[2]: Entering directory `/opt/newlisp-10.6.0‘ cd /opt/newlisp-10.6.0 && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0 /opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/DependInfo.cmake --color= Dependee "/opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/DependInfo.cmake" is newer than depender "/opt/newlisp-10.6.0/CMakeFiles/newlisp.dir/depend.internal". Scanning dependencies of target newlisp make[2]: Leaving directory `/opt/newlisp-10.6.0‘ make -f CMakeFiles/newlisp.dir/build.make CMakeFiles/newlisp.dir/build make[2]: Entering directory `/opt/newlisp-10.6.0‘ /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 1 [ 7%] Building C object CMakeFiles/newlisp.dir/newlisp.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/newlisp.c.o -c /opt/newlisp-10.6.0/newlisp.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 2 [ 14%] Building C object CMakeFiles/newlisp.dir/nl-symbol.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-symbol.c.o -c /opt/newlisp-10.6.0/nl-symbol.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 3 [ 21%] Building C object CMakeFiles/newlisp.dir/nl-math.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-math.c.o -c /opt/newlisp-10.6.0/nl-math.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 4 [ 28%] Building C object CMakeFiles/newlisp.dir/nl-list.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-list.c.o -c /opt/newlisp-10.6.0/nl-list.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 5 [ 35%] Building C object CMakeFiles/newlisp.dir/nl-liststr.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-liststr.c.o -c /opt/newlisp-10.6.0/nl-liststr.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 6 [ 42%] Building C object CMakeFiles/newlisp.dir/nl-string.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-string.c.o -c /opt/newlisp-10.6.0/nl-string.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 7 [ 50%] Building C object CMakeFiles/newlisp.dir/nl-filesys.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-filesys.c.o -c /opt/newlisp-10.6.0/nl-filesys.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 8 [ 57%] Building C object CMakeFiles/newlisp.dir/nl-sock.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-sock.c.o -c /opt/newlisp-10.6.0/nl-sock.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 9 [ 64%] Building C object CMakeFiles/newlisp.dir/nl-import.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-import.c.o -c /opt/newlisp-10.6.0/nl-import.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 10 [ 71%] Building C object CMakeFiles/newlisp.dir/nl-xml-json.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-xml-json.c.o -c /opt/newlisp-10.6.0/nl-xml-json.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 11 [ 78%] Building C object CMakeFiles/newlisp.dir/nl-web.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-web.c.o -c /opt/newlisp-10.6.0/nl-web.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 12 [ 85%] Building C object CMakeFiles/newlisp.dir/nl-matrix.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-matrix.c.o -c /opt/newlisp-10.6.0/nl-matrix.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 13 [ 92%] Building C object CMakeFiles/newlisp.dir/nl-debug.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/nl-debug.c.o -c /opt/newlisp-10.6.0/nl-debug.c /usr/bin/cmake -E cmake_progress_report /opt/newlisp-10.6.0/CMakeFiles 14 [100%] Building C object CMakeFiles/newlisp.dir/pcre.c.o /opt/centos/devtoolset-1.1/root/usr/bin/gcc -DLINUX -m64 -I/opt/newlisp-10.6.0 -o CMakeFiles/newlisp.dir/pcre.c.o -c /opt/newlisp-10.6.0/pcre.c Linking C executable newlisp /usr/bin/cmake -E cmake_link_script CMakeFiles/newlisp.dir/link.txt --verbose=1 /opt/centos/devtoolset-1.1/root/usr/bin/gcc -m64 -fPIC CMakeFiles/newlisp.dir/newlisp.c.o CMakeFiles/newlisp.dir/nl-symbol.c.o CMakeFiles/newlisp.dir/nl-math.c.o CMakeFiles/newlisp.dir/nl-list.c.o CMakeFiles/newlisp.dir/nl-liststr.c.o CMakeFiles/newlisp.dir/nl-string.c.o CMakeFiles/newlisp.dir/nl-filesys.c.o CMakeFiles/newlisp.dir/nl-sock.c.o CMakeFiles/newlisp.dir/nl-import.c.o CMakeFiles/newlisp.dir/nl-xml-json.c.o CMakeFiles/newlisp.dir/nl-web.c.o CMakeFiles/newlisp.dir/nl-matrix.c.o CMakeFiles/newlisp.dir/nl-debug.c.o CMakeFiles/newlisp.dir/pcre.c.o -o newlisp -rdynamic -lffi -lm -ldl -lreadline -lncurses
CentOS 5.9 编译newlisp,布布扣,bubuko.com
原文地址:http://blog.csdn.net/csfreebird/article/details/25425527