1

你能帮我在 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

在使用“编译”pre_hook 编辑rebar.config文件后sh -x,我看到的是:

$ ./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!
4

1 回答 1

0

eleveldbrebar.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.shc_src

我没有 Windows 机器来测试这个,所以我不会试图猜测如何解决这个问题. 其实,为什么不呢?

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

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

    • 失败:

      make: *** No targets specified and no makefile found.
      
  • 该脚本试图下载和构建依赖项,所以我猜“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!
      
于 2013-02-26T17:56:21.627 回答