使用cygwin在Windows上构建Eleveldb时出错

时间:2013-02-26 15:37:58

标签: gcc erlang cygwin riak otp

你能帮我在Cygwin上建立eleveldb吗?我的gcc是4.5.3,我是64位W7操作系统,安装了32位cygwin。我能够使用Microsoft SDK和msbuild程序构建leveldb。这是我的cygwin bash cli的输出:

user1@mycomputer ~/eleveldb
$ ./rebar compile
==> Entering directory `c:/cygwin/home/user1/eleveldb'
==> eleveldb (compile)
'c_src' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Command [compile] failed! <br/>

./rebar -vvv compile的输出如下:

$ ./rebar -vvv compile
DEBUG: Rebar location: "c:/cygwin/home/user1/eleveldb/rebar"
DEBUG: Consult config file "c:/cygwin/home/user1/eleveldb/rebar.config"
==> Entering directory `c:/cygwin/home/user1/eleveldb'
DEBUG: Consult config file "c:/cygwin/home/user1/eleveldb/rebar.config"
DEBUG: Available deps: []
DEBUG: Missing deps  : []
DEBUG: Predirs: []
==> eleveldb (compile)
INFO:  sh info:
        cwd: "C:/cygwin/home/user1/eleveldb"
        cmd: c_src/build_deps.sh
DEBUG:  opts: [{env,[{"REBAR_DEPS_DIR","c:/cygwin/home/user1/eleveldb/deps"},
                     {"ERL_LIBS","c:/cygwin/home/user1/eleveldb/deps"},
                     {"ALLUSERSPROFILE","C:\\ProgramData"},
                     {"ANT_HOME","C:\\Tools\\apache-ant-1.7.1"},
                     {"APPDATA","C:\\Users\\user1\\AppData\\Roaming"},
                     {"AR","ar.sh"},
                     {"CC","cc.sh"},
                     {"CFLAGS","-mno-cygwin -Wall -O3 -fPIC"},
                     {"CLASSPATH",
                      ".;F:\\SERVERS\\TimesTen\\tt70_64\\lib\\ttjdbc5.jar;C:\\TOOLS\\Win32\\JAVA\\jre6\\lib\\ext\\QTJava.zip"},
                     {"COMMONPROGRAMFILES",
                      "C:\\Program Files (x86)\\Common Files"},
                     {"COMPUTERNAME","mycomputer"},
                     {"COMSPEC","C:\\Windows\\system32\\cmd.exe"},
                     {"CVS_RSH","/bin/ssh"},
                     {"CXX","cc.sh"},
                     {"CXXFLAGS"," -Wall -O3 -fPIC"},
                     {"CommonProgramFiles(x86)",
                      "C:\\Program Files (x86)\\Common Files"},
                     {"CommonProgramW6432","C:\\Program Files\\Common Files"},
                     {"DISPLAY",":0.0"},
                     {"DRV_CC_TEMPLATE",
                      "cc.sh -c -mno-cygwin -Wall -O3 -fPIC -g -Wall -fPIC  -If:/Tools/erl5.9/lib/erl_interface-3.7.6/include -If:/Tools/erl5.9/erts-5.9/include   -O3 -Wall -I c_src/leveldb/include $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_CFLAGS",
                      "-g -Wall -fPIC  -If:/Tools/erl5.9/lib/erl_interface-3.7.6/include -If:/Tools/erl5.9/erts-5.9/include   -O3 -Wall -I c_src/leveldb/include"},
                     {"DRV_CXX_TEMPLATE",
                      "cc.sh -c  -Wall -O3 -fPIC -g -Wall -fPIC  -If:/Tools/erl5.9/lib/erl_interface-3.7.6/include -If:/Tools/erl5.9/erts-5.9/include   -O3 -Wall -I c_src/leveldb/include $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"DRV_LDFLAGS",
                      "-shared  -Lf:/Tools/erl5.9/lib/erl_interface-3.7.6/lib -lerl_interface -lei c_src/leveldb/libleveldb.a c_src/system/lib/libsnappy.a -lstdc++"},
                     {"DRV_LINK_TEMPLATE",
                      "cc.sh $PORT_IN_FILES $LDFLAGS -shared  -Lf:/Tools/erl5.9/lib/erl_interface-3.7.6/lib -lerl_interface -lei c_src/leveldb/libleveldb.a c_src/system/lib/libsnappy.a -lstdc++ -o $PORT_OUT_FILE"},
                     {"ERLANG_ARCH","32"},
                     {"ERLANG_TARGET","R15B-win32-32"},
                     {"ERL_CFLAGS",
                      " -If:/Tools/erl5.9/lib/erl_interface-3.7.6/include -If:/Tools/erl5.9/erts-5.9/include  "},
                     {"ERL_CONSOLE_MODE","tty:ccc"},
                     {"ERL_EI_LIBDIR",
                      "f:/Tools/erl5.9/lib/erl_interface-3.7.6/lib"},
                     {"ERL_LDFLAGS",
                      " -Lf:/Tools/erl5.9/lib/erl_interface-3.7.6/lib -lerl_interface -lei"},
                     {"ERL_TOP","/home/user1/otp_src_R13B04"},
                     {"EXE4J_JAVA_HOME","C:\\Tools\\x64\\Java\\jdk1.6.0_17"},
                     {"EXE_CC_TEMPLATE",
                      "cc.sh -c -mno-cygwin -Wall -O3 -fPIC -g -Wall -fPIC  -If:/Tools/erl5.9/lib/erl_interface-3.7.6/include -If:/Tools/erl5.9/erts-5.9/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_CFLAGS",
                      "-g -Wall -fPIC  -If:/Tools/erl5.9/lib/erl_interface-3.7.6/include -If:/Tools/erl5.9/erts-5.9/include  "},
                     {"EXE_CXX_TEMPLATE",
                      "cc.sh -c  -Wall -O3 -fPIC -g -Wall -fPIC  -If:/Tools/erl5.9/lib/erl_interface-3.7.6/include -If:/Tools/erl5.9/erts-5.9/include   $PORT_IN_FILES -o $PORT_OUT_FILE"},
                     {"EXE_LDFLAGS",
                      " -Lf:/Tools/erl5.9/lib/erl_interface-3.7.6/lib -lerl_interface -lei"},
                     {"EXE_LINK_TEMPLATE",
                      "cc.sh $PORT_IN_FILES $LDFLAGS  -Lf:/Tools/erl5.9/lib/erl_interface-3.7.6/lib -lerl_interface -lei -o $PORT_OUT_FILE"},
                     {"FP_NO_HOST_CHECK","NO"},
                     {"GRADLE_HOME","C:\\FRAMEWORKS\\gradle-1.3"},
                     {"HISTCONTROL","ignoredups"},
                     {"HISTIGNORE","[   ]*:&:bg:fg:exit"},
                     {"HOME","C:\\cygwin\\home\\user1"},
                     {"HOMEDRIVE","C:"},
                     {"HOMEPATH","\\Users\\user1"},
                     {"HOSTNAME","mycomputer"},
                     {"INCLUDE",
                      "f:\\Program Files (x86)\\Microsoft Visual Studio .NET 2003\\SDK\\v1.1\\include\\"},
                     {"INFOPATH","/usr/local/info:/usr/share/info:/usr/info:"},
                     {"JAVA_HOME","C:\\Tools\\x64\\Java\\jdk1.6.0_17"},
                     {"JAVA_HOME1","C:\\Tools\\Win32\\Java\\jdk1.5.0_17"},
                     {"JDK5","C:\\Tools\\Win32\\Java\\jdk1.5.0_17"},
                     {"JDK6_x64","C:\\Tools\\x64\\Java\\jdk1.6.0_17"},
                     {"LANG","en_US.UTF-8"},
                     {"LIB",
                      "f:\\Program Files (x86)\\Microsoft Visual Studio .NET 2003\\SDK\\v1.1\\Lib\\"},
                     {"LOCALAPPDATA","C:\\Users\\user1\\AppData\\Local"},
                     {"LOGONSERVER","\\\\mycomputer"},
                     {"M2_HOME","C:\\Tools\\apache-maven-3.0.4"},
                     {"MAKE_MODE","unix"},
                     {"MANPATH",
                      "/usr/local/man:/usr/share/man:/usr/man::/usr/ssl/man"},
                     {"MEDIAMALL","C:\\Program Files (x86)\\MediaMall\\"},
                     {"MEMBASE_NUM_VBUCKETS","256"},
                     {"NUMBER_OF_PROCESSORS","2"},
                     {"NVM_DIR","/home/user1/.nvm"},
                     {"OLDPWD","/home/user1/eleveldb/c_src"},
                     {"OPENRDA_INI",
                      "F:\\tools\\CA\\ERwin Data Modeler r7.3\\OpenAccess\\bin\\iwinnt\\openrda.ini"},
                     {"OS","Windows_NT"},
                     {"OVERRIDE_CONFIG_CACHE",
                      "/home/user1/otp_src_R13B04/erts/autoconf/win32.config.cache"},
                     {"OVERRIDE_TARGET","win32"},
                     {"PATH",
                      "F:\\Tools\\erl5.9\\erts-5.9\\bin;C:\\cygwin\\home\\user1\\otp_src_R13B04\\erts\\etc\\win32\\cygwin_tools\\vc;C:\\cygwin\\home\\user1\\otp_src_R13B04\\erts\\etc\\win32\\cygwin_tools;C:\\cygwin\\usr\\local\\bin;C:\\cygwin\\bin;C:\\cygwin\\bin;C:\\cygwin\\usr\\X11R6\\bin;C:\\Tools\\x64\\Java\\JDK16~1.0_1\\bin;C:\\cygwin\\bin;F:\\SERVERS\\TimesTen\\tt70_64\\bin;C:\\tools\\win32\\IMAGEM~1.1-Q;C:\\PHP\\PHP-52~1.9-1;C:\\SERVERS\\ORACLE\\oraclexe\\app\\oracle\\product\\102~1.0\\server\\bin;C:\\ruby\\bin;C:\\Perl\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\PROGRA~2\\COMMON~1\\DIVXSH~1;C:\\PROGRA~2\\MI3EDC~1\\90\\Tools\\binn;C:\\Windows\\System32\\WINDOW~1\\v1.0;C:\\Tools\\COLLAB~1;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;F:\\temp\\tools\\MKVTOO~1;C:\\PROGRA~2\\COMMON~1\\Acronis\\SnapAPI;C:\\PROGRA~2\\Toshiba\\BLUETO~1\\sys;C:\\PROGRA~2\\Toshiba\\BLUETO~1\\sys\\x64;C:\\PROGRA~1\\TORTOI~1\\bin;C:\\PROGRA~2\\QUICKT~1\\QTSystem;C:\\PROGRA~2\\Autodesk\\BACKBU~1;F:\\TOOLS\\scala\\bin;F:\\Tools\\sbt;C:\\PROGRA~2\\giter8;C:\\PROGRA~1\\MI3EDC~1\\110\\Tools\\Binn;C:\\FRAMEW~1\\gradle-1.3\\bin;C:\\Tools\\APACHE~1.4\\bin;C:\\Tools\\APACHE~1.1\\bin;C:\\SERVERS\\Sun\\APPSER~1\\bin;C:\\SERVERS\\MySQL5\\bin;C:\\SERVERS\\MAESTR~1.2\\maven\\bin;C:\\SERVERS\\MAESTR~1.2\\PROJEC~1\\bin;C:\\SERVERS\\MAESTR~1.2\\PROJEC~1\\bin\\WINDOW~1;C:\\Tools\\MERCUR~1;D:\\GNUstep\\GNUstep\\System\\Tools;D:\\GNUstep\\bin;F:\\Tools\\erl5.9\\bin;C:\\cygwin\\lib\\lapack"},
                     {"PATHEXT",
                      ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.RB;.RBW"},
                     {"PHPRC","C:\\PHP\\php-5.2.9-1-Win32\\"},
                     {"PRINTER","Canon MG3100 series Printer (Copy 2)"},
                     {"PROCESSOR_ARCHITECTURE","x86"},
                     {"PROCESSOR_ARCHITEW6432","AMD64"},
                     {"PROCESSOR_IDENTIFIER",
                      "Intel64 Family 6 Model 23 Stepping 6, GenuineIntel"},
                     {"PROCESSOR_LEVEL","6"},
                     {"PROCESSOR_REVISION","1706"},
                     {"PROGRAMFILES","C:\\Program Files (x86)"},
                     {"PS1",
                      "\\[\\e]0;\\w\\a\\]\\n\\[\\e[32m\\]\\u@\\h \\[\\e[33m\\]\\w\\[\\e[0m\\]\\n\\$ "},
                     {"PSModulePath",
                      "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules\\"},
                     {"PUBLIC","C:\\Users\\Public"},
                     {"PWD","/home/user1/eleveldb"},
                     {"ProgramData","C:\\ProgramData"},
                     {"ProgramFiles(x86)","C:\\Program Files (x86)"},
                     {"ProgramW6432","C:\\Program Files"},
                     {"QMAKESPEC","cygwin-g++"},
                     {"QTJAVA",
                      "C:\\TOOLS\\Win32\\JAVA\\jre6\\lib\\ext\\QTJava.zip"},
                     {"RANLIB","true"},
                     {"RUBYOPT","-rubygems"},
                     {"SBT_HOME","F:\\Tools\\sbt\\"},
                     {"SHLVL","1"},
                     {"SYSTEMDRIVE","C:"},
                     {"SYSTEMROOT","C:\\Windows"},
                     {"TEMP","C:\\cygwin\\home\\user1\\tmp"},
                     {"TERM","xterm"},
                     {"TMP","C:\\cygwin\\home\\user1\\tmp"},
                     {"TZ","America/Chicago"},
                     {"USER","user1"},
                     {"USERDOMAIN","mycomputer"},
                     {"USERNAME","user1"},
                     {"USERPROFILE","C:\\Users\\user1"},
                     {"VBOX_INSTALL_PATH","C:\\Tools\\Oracle\\VirtualBox\\"},
                     {"VS110COMNTOOLS",
                      "C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\Common7\\Tools\\"},
                     {"VS71COMNTOOLS",
                      "f:\\Program Files (x86)\\Microsoft Visual Studio .NET 2003\\Common7\\Tools\\"},
                     {"VS80COMNTOOLS",
                      "f:\\Program Files (x86)\\Microsoft Visual Studio 8\\Common7\\Tools\\"},
                     {"WINDIR","C:\\Windows"},
                     {"_","./rebar"},
                     {"_M2_HOME","c:\\tools\\apache-maven-2.0.10"},
                     {"asl.log","Destination=file"}]},
               {abort_on_error,"Command [compile] failed!\n"}]
'c_src' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Command [compile] failed!

user1@mycomputer ~/eleveldb

使用rebar.config编辑sh -x文件后,对于'compile'pre_hook,这是我看到的:

$ ./rebar compile
==> Entering directory 'c:/cygwin/home/user1/eleveldb'
==> eleveldb (compile)
++ uname -s
+ '[' CYGWIN_NT-6.1-WOW64 = SunOS -a '' '!=' true ']'
+ unset POSIX_SHELL
+ LEVELDB_VSN=1.3.0
+ SNAPPY_VSN=1.0.5
+ set -e
++ basename /home/user1/eleveldb
+ '[' eleveldb '!=' c_src ']'
+ cd c_src
+ BASEDIR=/home/user1/eleveldb/c_src
+ which gmake
+ MAKE=make
+ case "$1" in
+ '[' '!' -d snappy-1.0.5 ']'
+ cd snappy-1.0.5
+ make
make: *** No targets specified and no makefile found.  Stop.
ERROR: Command [compile] failed!

1 个答案:

答案 0 :(得分:0)

eleveldb的rebar.config告诉Rebar执行命令c_src/build_deps.sh。 Rebar使用open_port执行此操作(请参阅rebar_utils:sh/2),它使用本机命令运行工具而不是Cygwin。

但是,在DOS和Windows中的扩展名中,c_src/build_deps.sh表示“使用开关c_src”运行命令/build_deps.sh,这通常在斜杠之前用空格写入。 (参见this answer。)由于c_src是一个目录,因此它不是“内部或外部命令,可操作程序或批处理文件”。

我没有Windows机器来测试它,因此我不会试图猜测如何修复此。实际上,为什么不呢?

我将此答案标记为社区维基,所以任何人都应该随意进行更多猜测:

  • 尝试将"c_src/build_deps.sh"更改为"sh c_src/build_deps.sh"中的rebar.config。看起来你的PATH中有Cygwin程序,所以系统应该找到正确的sh

    • 失败:

      make: *** No targets specified and no makefile found.
      
  • 该脚本尝试download and build dependencies,所以我猜其中一个“make”失败了,但是它确实在哪里出错了。尝试将钩子更改为"sh -x c_src/build_deps.sh",这将显示正在执行的命令。

    • 失败:

      $ ./rebar compile
      ==> Entering directory c:/cygwin/home/user1/eleveldb'
      ==> eleveldb (compile)
      ++ uname -s
      + '[' CYGWIN_NT-6.1-WOW64 = SunOS -a '' '!=' true ']'
      + unset POSIX_SHELL
      + LEVELDB_VSN=1.3.0
      + SNAPPY_VSN=1.0.5
      + set -e
      ++ basename /home/user1/eleveldb
      + '[' eleveldb '!=' c_src ']'
      + cd c_src
      + BASEDIR=/home/user1/eleveldb/c_src
      + which gmake
      + MAKE=make
      + case "$1" in
      + '[' '!' -d snappy-1.0.5 ']'
      + cd snappy-1.0.5
      + make
      make: *** No targets specified and no makefile found. Stop.
      ERROR: Command [compile] failed!