2012-05-23 23 views
0

有沒有人知道如何在cygwin中構建Erlang?在cygwin中使用jdk構建Erlang OTP R15B javac&jar,cygwin make,install,gcc和ld

我在我的cygwin安裝中下載了Erlang OTP R15B源代碼。
對源碼進行壓縮和解壓。
然後,我做了./configure --prefix=/usr,然後make install

下面的所有步驟的屏幕截圖。

# wget the Erlang source (for UNIX systems) 
wget "http://www.erlang.org/download/otp_src_R15B.tar.gz" -O "$HOME/erlang/otp_src_R15B.tar.gz" 

# tar -zxvf the tarball 
tar -zxvf "$HOME/erlang/otp_src_R15B.tar.gz" 

# Go to the location of the code 
pushd "$HOME/erlang/otp_src_R15B" 

# Create perl5 symlink for perl 
ln -s /usr/bin/perl.exe perl5.exe 

# Configure the build 
./configure --prefix=/usr 
    ... 
    ********************************************************************* 
    ********************** APPLICATIONS INFORMATION ******************* 
    ********************************************************************* 

    wx    : wxWidgets not found, wx will NOT be usable 

    ********************************************************************* 
    ********************************************************************* 
    ********************** DOCUMENTATION INFORMATION ****************** 
    ********************************************************************* 

    documentation : 
        fop is missing. 
        Using fakefop to generate placeholder PDF files. 

    ********************************************************************* 

我能夠在/usr/bin/javac.exe

$ cat /usr/bin/javac.exe 
#!/bin/bash 
# 
# A wrapper for calling javac from Cygwin. 
# Tries to convert any arguments that are Unix-style paths into 
# Windows-style paths. This includes any arguments to classpath or 
# sourcepath or any arguments that begin with/. 
# 

ME="`basename $0`" 
JAVAC_EXEC="$JAVA_HOME/bin/javac" 
ARGS="" 

while [ -n "$1" ]; do 
    arg="$1" 
    shift 
    case "$arg" in 
     -cp | -classpath) 
     arg="$arg' '`cygpath -p -w "$1"`" 
     shift 
     ;; 
     -sourcepath) 
     arg="$arg' '`cygpath -p -w "$1"`" 
     shift 
     ;; 
     /*) 
     arg="`cygpath -p -w "$arg"`" 
     ;; 
    esac 
    ARGS="$ARGS '$arg'" 
done 

eval "set -- $ARGS" 
#echo "$JAVAC_EXEC" "[email protected]" 
exec "$JAVAC_EXEC" "[email protected]" 

還增加/usr/bin/jar.exe闖過javac的路徑問題,通過使用下面的腳本如下:

$ cat /usr/bin/jar.exe 
#!/bin/bash 
# 
# A wrapper for calling javac from Cygwin. 
# Tries to convert any arguments that are Unix-style paths into 
# Windows-style paths. This includes any arguments to classpath or 
# sourcepath or any arguments that begin with/. 
# 

ME="`basename $0`" 
JAR_EXEC="$JAVA_HOME/bin/jar" 
ARGS="" 

while [ -n "$1" ]; do 
    arg="$1" 
    shift 
    case "$arg" in 
     -cp | -classpath) 
     arg="$arg' '`cygpath -p -w "$1"`" 
     shift 
     ;; 
     -sourcepath) 
     arg="$arg' '`cygpath -p -w "$1"`" 
     shift 
     ;; 
     /*) 
     arg="`cygpath -p -w "$arg"`" 
     ;; 
    esac 
    ARGS="$ARGS '$arg'" 
done 

eval "set -- $ARGS" 
#echo "$JAR_EXEC" "[email protected]" 
exec "$JAR_EXEC" "[email protected]" 

此外,修改otp.mk文件設置CLASSPATH到預期的Windows路徑,如下所示:

Line 
172  .java.class: 
173   CLASSPATH=`cygpath -wp $(CLASSPATH)` $(JAVA) $(JAVA_OPTIONS) $< 
174  
175  
176  $(JAVA_DEST_ROOT)$(JAVA_CLASS_SUBDIR)%.class: %.java 
177   CLASSPATH=`cygpath -wp $(CLASSPATH)` $(JAVA) $(JAVA_OPTIONS) -d $(JAVA_DEST_ROOT) $< 

我終於準備做安裝

# Make 
make install 

... 
make[6]: Entering directory `/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src' 
ld -shared -o ../priv/lib/i686-pc-cygwin/trace_ip_drv.so ../priv/obj/i686-pc-cygwin/trace_ip_drv.o -lc -lutil -ldl -lm 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `my_alloc_binary': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:606: undefined reference to `driver_alloc_binary' 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:608: undefined reference to `__getreent' 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `write_until_done': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:632: undefined reference to `__getreent' 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `my_alloc': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:591: undefined reference to `driver_alloc' 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:593: undefined reference to `__getreent' 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `my_driver_select': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:916: undefined reference to `driver_select' 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `clean_que': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:736: undefined reference to `driver_free' 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:744: undefined reference to `driver_free' 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `close_unlink_port': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:820: undefined reference to `driver_free' 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:820: undefined reference to `driver_free' 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `trace_ip_ready_output': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:523: undefined reference to `driver_free' 
../priv/obj/i686-pc-cygwin/trace_ip_drv.o: In function `trace_ip_start': 
/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src/trace_ip_drv.c:371: undefined reference to `set_port_control_flags' 
/usr/lib/libc.a(t-d000779.o):fake:(.text+0x2): undefined reference to `_imp__close' 
/usr/lib/libc.a(t-d000994.o):fake:(.text+0x2): undefined reference to `_imp__fprintf' 
/usr/lib/libc.a(t-d000913.o):fake:(.text+0x2): undefined reference to `_imp__exit' 
/usr/lib/libc.a(t-d001041.o):fake:(.text+0x2): undefined reference to `_imp__fwrite' 
/usr/lib/libc.a(t-d001602.o):fake:(.text+0x2): undefined reference to `_imp__send' 
/usr/lib/libc.a(t-d000032.o):fake:(.text+0x2): undefined reference to `_imp____errno' 
/usr/lib/libc.a(t-d000934.o):fake:(.text+0x2): undefined reference to `_imp___fcntl64' 
/usr/lib/libc.a(t-d001300.o):fake:(.text+0x2): undefined reference to `_imp__memcpy' 
/usr/lib/libc.a(t-d000669.o):fake:(.text+0x2): undefined reference to `_imp__accept' 
/usr/lib/libc.a(t-d001513.o):fake:(.text+0x2): undefined reference to `_imp__read' 
/usr/lib/libc.a(t-d001304.o):fake:(.text+0x2): undefined reference to `_imp__memset' 
/usr/lib/libc.a(t-d001706.o):fake:(.text+0x2): undefined reference to `_imp__sscanf' 
/usr/lib/libc.a(t-d001690.o):fake:(.text+0x2): undefined reference to `_imp__socket' 
/usr/lib/libc.a(t-d001636.o):fake:(.text+0x2): undefined reference to `_imp__setsockopt' 
/usr/lib/libc.a(t-d000723.o):fake:(.text+0x2): undefined reference to `_imp__bind' 
/usr/lib/libc.a(t-d001119.o):fake:(.text+0x2): undefined reference to `_imp__getsockname' 
/usr/lib/libc.a(t-d0.o):fake:(.text+0x2): undefined reference to `_imp__listen' 
i686-pc-cygwin/Makefile:100: recipe for target `../priv/lib/i686-pc-cygwin/trace_ip_drv.so' failed 
make[6]: *** [../priv/lib/i686-pc-cygwin/trace_ip_drv.so] Error 1 
make[6]: Leaving directory `/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src' 
/home/Dragos/erlang/otp_src_R15B/make/run_make.mk:38: recipe for target `release_spec' failed 
make[5]: *** [release_spec] Error 2 
make[5]: Leaving directory `/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src' 
/home/Dragos/erlang/otp_src_R15B/make/otp_release_targets.mk:119: recipe for target `release' failed 
make[4]: *** [release] Error 2 
make[4]: Leaving directory `/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src' 
/home/Dragos/erlang/otp_src_R15B/make/run_make.mk:38: recipe for target `release' failed 
make[3]: *** [release] Error 2 
make[3]: Leaving directory `/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools/c_src' 
/home/Dragos/erlang/otp_src_R15B/make/otp_subdir.mk:28: recipe for target `release' failed 
make[2]: *** [release] Error 2 
make[2]: Leaving directory `/home/Dragos/erlang/otp_src_R15B/lib/runtime_tools' 
/home/Dragos/erlang/otp_src_R15B/make/otp_subdir.mk:28: recipe for target `release' failed 
make[1]: *** [release] Error 2 
make[1]: Leaving directory `/home/Dragos/erlang/otp_src_R15B/lib' 
Makefile:899: recipe for target `install.libs' failed 
make: *** [install.libs] Error 2 

有誰知道如何讓過去這一步呢?
在此先感謝。

回答

0

我認爲你錯了。如果你讀得更好,你應該看到下面這行: javac: directory not found: /home/Dragos/erlang/otp_src_R15B/lib/jinterface/priv/

從我所能理解的,下面的錯誤信息是簡單的存在的原因是編譯堆棧的解開。

該目錄是否真的存在? 請提供更多信息!

+0

你說得對。我應該看看錯誤信息的結尾。存在'/ home/Dragos/erlang/otp_src_R15B/lib/jinterface/priv /'目錄。我將嘗試手動運行javac命令,以查看是否需要更改某些內容。由於它不在cygwin中,因此可能有任何與JDK設置有關的問題。它在我的Windows PATH中(如C:\ Program Files \ Java \ jdk1.6.0_26 \ bin)和我的cygwin PATH(如/ cygdrive/c/Program Files/Java/jdk1.6.0_26/bin)。 –

+0

javac無法處理cygwin路徑(即'/ home/Dragos/erlang/otp_src_R15B/lib/jinterface/priv /')。有沒有辦法讓cygwin得到javac? –

+0

我想你只需要調整env變量:http://cs.nyu.edu/~yap/prog/cygwin/FAQs.html#execute –