使用jdk javac& amp;从cygwin中的源代码构建Erlang OTP R15B jar,cygwin make,install,gcc和ld

时间:2012-05-23 01:21:13

标签: erlang makefile cygwin ld

有谁知道如何在cygwin中构建Erlang?

我在我的cygwin安装中下载了Erlang OTP R15B源 Gunzipped并解密了源头。
然后我做了./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

中使用以下脚本,我能够解决javac路径问题
$ 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" "$@"
exec "$JAVAC_EXEC" "$@"

还添加/usr/bin/jar.exe如下:

$ 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" "$@"
exec "$JAR_EXEC" "$@"

此外,修改后的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-d001239.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

有谁知道如何通过这一步? 提前致谢。

1 个答案:

答案 0 :(得分:0)

我认为你错了。如果你读得更好,你应该看到这一行: javac: directory not found: /home/Dragos/erlang/otp_src_R15B/lib/jinterface/priv/

根据我的理解,以下错误消息只是因为编译堆栈的展开。

目录是否真的存在? 请提供更多信息!