Fixes for building erlang under windows

View: New views
7 Messages — Rating Filter:   Alert me  

Fixes for building erlang under windows

by Davide Marquês :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

Here are some fixes I picked up along the way while building erlang on a
fresh install of Windows.

Fix for cygwin environments that might have non-default cygdrive prefixes:

> $ERL_TOP/erts/configure.in:
> 3242:
>     open_ssl_default_dir=`cygpath "c:\OpenSSL"`
>     for dir in $extra_dir $open_ssl_default_dir \
> 3493:
>     kerberos_default_dir=`cygpath "c:\kerberos"`
>     SSL_KRB5_INCLUDE=
>     if test "x$ssl_krb5_enabled" = "xyes" ; then
>         AC_MSG_CHECKING(for krb5.h in standard locations)
>     for dir in $extra_dir $SSL_ROOT/include $SSL_ROOT/include/openssl \
>         $SSL_ROOT/include/kerberos $kerberos_default_dir/include \
>
>
> $ERL_TOP/erts/configure:
> 21867:
>     open_ssl_default_dir=`cygpath "c:\OpenSSL"`
>     for dir in $extra_dir $open_ssl_default_dir \
> 22235:
>     kerberos_default_dir=`cygpath "c:\kerberos"`
>     SSL_KRB5_INCLUDE=
>         if test "x$ssl_krb5_enabled" = "xyes" ; then
>             echo "$as_me:$LINENO: checking for krb5.h in standard
> locations" >&5
>     echo $ECHO_N "checking for krb5.h in standard locations... $ECHO_C" >&6
>         for dir in $extra_dir $SSL_ROOT/include $SSL_ROOT/include/openssl \
>             $SSL_ROOT/include/kerberos $kerberos_default_dir/include \
>

Needed changes for OpenSSL installations in non-default paths:

> Using the "--with-ssl" option in configure (EVEN IF OpenSSL is installed
> in a default location) will set the SSL_LIBDIR variable to an incorrect
> value
> and crypto and ssh compilation will fail.
>
>     - If OpenSSL is found in the default location:
>         $ ./otp_build configure
>         ...
>         $ grep "SSL_LIBDIR =" lib/crypto/c_src/win32/Makefile
>         SSL_LIBDIR = /c/OpenSSL/lib
>
>     - Otherwise if we provide the path to OpenSSL:
>         $ ./otp_build configure --with-ssl="/c/OpenSSL"
>         ...
>         $ grep "SSL_LIBDIR =" lib/crypto/c_src/win32/Makefile
>         SSL_LIBDIR = /c/OpenSSL/lib/VC
>
> $ERL_TOP/erts/configure:22139
> $ERL_TOP/erts/configure.in:3418
>     if test "x$MIXED_CYGWIN" = "xyes" -a -d "$with_ssl/lib/VC"; then
>         SSL_LIBDIR="$with_ssl/lib/VC"
> should include the additional tests:
>     if test "x$MIXED_CYGWIN" = "xyes" ; then
>         if test -f "$dir/lib/VC/ssleay32.lib" -o \
>             -f "$dir/lib/VC/openssl.lib"; then
>             SSL_LIBDIR="$dir/lib/VC"
>         elif test -f "$dir/lib/ssleay32.lib" -o \
>             -f "$dir/lib/openssl.lib"; then
>             SSL_LIBDIR="$dir/lib"
>         else
>             is_real_ssl=no
>         fi
> that are done when looking open OpenSSL in the default paths
> ($ERL_TOP/erts/configure.in:21867 and $ERL_TOP/erts/configure:3242).
>

Others...

> $ERL_TOP/erts/etc/win32/cygwin_tools/vc/mc.sh:
> 70:
>         if [ "X$MC_SH_DEBUG_LOG" != "X" ]; then
>             echo mc.sh "$SAVE" >>$MC_SH_DEBUG_LOG
>             echo $MCC $CMD >>$MC_SH_DEBUG_LOG
>         fi
>
> Comparing line 33 of $ERL_TOP/erts/etc/win32/cygwin_tools/vc/mc.sh:
>     if [ -n "`$p/mc.exe -? 2>&1 >/dev/null </dev/null \
>                  | grep -i \"message compiler\"`" ]; then
>         MCC=$p/mc.exe
>     fi
> with line 33 of $ERL_TOP/erts/etc/win32/cygwin_tools/vc/rc.sh:
>     if [ -n "`$p/rc.exe -? 2>&1 | grep -i "resource compiler"`" ]; then
>         RCC=$p/rc.exe
>     fi
> It seems the second one needs some escaping: \"resource compiler\".
>

That's it for now.

I'm rewriting a step-by-step
tutorial<http://github.com/davide/erl_interface-examples/tree/master/doc/>on
how to build erlang under windows
using Visual C++ Express 2008 which I'll share when complete (wxWidgets
and gs are still giving me an hard time).

Cheers,
:Davide

Re: Fixes for building erlang under windows

by Davide Marquês :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again!

The gs application build fails under windows due to a missing
binaries/win32.tar.gz.
The configure step does check to see whether the file exists but the
Makefile ignores
that test result and overrides/corrects the TCL_TAR value even if the file
is missing.

The fix:
$ERL_TOP/lib/gs/tcl/Makefile.in:36

Replace:
ifeq ($(TARGET),win32)
TCL_TAR = binaries/win32.tar.gz
else
TCL_TAR = @TCL_TAR@
endif

by:
TCL_TAR = @TCL_TAR@
ifneq ($(TCL_TAR),)
ifeq ($(TARGET),win32)
TCL_TAR = binaries/win32.tar.gz
endif
endif

One down, one (wxWidgets) to go.

Cheers,
:Davide

Re: Re: Fixes for building erlang under windows

by Mazen Harake-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What's wrong with wxWidgets?

/Mazen

Davide Marquês wrote:

> Hi again!
>
> The gs application build fails under windows due to a missing
> binaries/win32.tar.gz.
> The configure step does check to see whether the file exists but the
> Makefile ignores
> that test result and overrides/corrects the TCL_TAR value even if the file
> is missing.
>
> The fix:
> $ERL_TOP/lib/gs/tcl/Makefile.in:36
>
> Replace:
> ifeq ($(TARGET),win32)
> TCL_TAR = binaries/win32.tar.gz
> else
> TCL_TAR = @TCL_TAR@
> endif
>
> by:
> TCL_TAR = @TCL_TAR@
> ifneq ($(TCL_TAR),)
> ifeq ($(TARGET),win32)
> TCL_TAR = binaries/win32.tar.gz
> endif
> endif
>
> One down, one (wxWidgets) to go.
>
> Cheers,
> :Davide
>
>  


________________________________________________________________
erlang-patches mailing list. See http://www.erlang.org/faq.html
erlang-patches (at) erlang.org


Re: Re: Fixes for building erlang under windows

by Davide Marquês :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Mazen,
Simply going through the steps in README.win32 doesn't seem to be enough for
configure to pick up the wxWidgets installation/libraries.

These were the steps I took:
- run the wxWidgets-2.8.10 installer;
- edit <wxWidgets dir>/include/wx/msw/setup.h and enable:
- wxUSE_GLCANVAS
- wxUSE_POSTSCRIPT
- wxUSE_GRAPHICS_CONTEXT
- open <wxWidgets dir>/build/msw/wx.dsw (letting VC convert the projects)
- build the "Unicode Release" and "Unicode Debug" configurations
- open <wxWidgets dir>/contrib/build/stc/stc.dsw (letting VC convert the
projects)
- build the "Unicode Release" and "Unicode Debug" configurations
After which the C:\Program Files\wxWidgets-2.8.10\lib\vc_lib folder contais
195MB of .lib goodness (wxbase28d.lib, wxbase28u.lib, wxbase28d_net.lib,
wxbase28u_net.lib, ...).

This is the relevant part of the configure output:

> checking for debug build of WxWidgets... checking for wx-config... no

checking for standard build of WxWidgets... checking for wx-config...
> (cached) no

configure: WARNING:

                wxWidgets must be installed on your system.


>                 Please check that wx-config is in path, the directory

                where wxWidgets libraries are installed (returned by

                'wx-config --libs' or 'wx-config --static --libs' command)

                is in LD_LIBRARY_PATH or equivalent variable and

                wxWidgets version is 2.8.0 or above.

checking GL/gl.h usability... no

checking GL/gl.h presence... yes

configure: WARNING: GL/gl.h: present but cannot be compiled

configure: WARNING: GL/gl.h:     check for missing prerequisite headers?

configure: WARNING: GL/gl.h: see the Autoconf documentation

configure: WARNING: GL/gl.h:     section "Present But Cannot Be Compiled"

configure: WARNING: GL/gl.h: proceeding with the preprocessor's result

configure: WARNING: GL/gl.h: in the future, the compiler will take
> precedence

configure: WARNING:     ## ------------------------------------------ ##

configure: WARNING:     ## Report this to the AC_PACKAGE_NAME lists.  ##

configure: WARNING:     ## ------------------------------------------ ##

checking for GL/gl.h... yes

checking OpenGL/gl.h usability... no

checking OpenGL/gl.h presence... no

checking for OpenGL/gl.h... no

checking if wxwidgets have opengl support... no

checking for GLintptr... no

checking for GLintptrARB... no

checking for GLchar... no

checking for GLcharARB... no

checking for GLhalfARB... no

checking for GLint64EXT... no

checking GLU Callbacks uses Tiger Style... no

checking for wx/stc/stc.h... no

configure: WARNING: Can not find wx/stc/stc.h

checking if we can link wxwidgets programs... no

configure: WARNING: Can not link wx program are all developer packages
> installed?

configure: creating i686-pc-cygwin/config.status

config.status: creating config.mk

config.status: creating c_src/Makefile


The wx-config didn't exist at this point. As there was a wx-config.in file I
ran configure to create it. But that didn't help much.

Here are some of its outputs:

VC2008: wxWidgets-2.8.10 $ ./wx-config --libs-L/c/Progra~1/wxWidgets-2.8.10/lib
  -lwx_msw_richtext-2.8 -lwx_msw_aui-2.8 -lwx_msw_xrc-2.8 -lwx_msw_qa-2.8
-lwx_msw_html-2.8 -lwx_msw_adv-2.8 -lwx_msw_core-2.8 -lwx_base_xml-2.8
-lwx_base_net-2.8 -lwx_base-2.8

VC2008: wxWidgets-2.8.10 $ ./wx-config --static --libs

  Warning: No config found to match: ./wx-config --static --libs
           in /c/Progra~1/wxWidgets-2.8.10/lib/wx/config
  If you require this configuration, please install the desired
  library build.  If this is part of an automated configuration
  test and no other errors occur, you may safely ignore it.
  You may use wx-config --list to see all configs available in
  the default prefix.


VC2008: wx $ wx-config --unicode --debug=yes  Warning: No config found to
match: /c/Progra~1/wxWidgets-2.8.10/wx-config --unicode --debug=yes
           in /c/Progra~1/wxWidgets-2.8.10/lib/wx/config
  If you require this configuration, please install the desired
  library build.  If this is part of an automated configuration
  test and no other errors occur, you may safely ignore it.
  You may use wx-config --list to see all configs available in
  the default prefix.


The configure fails after this last check:

checking for debug build of WxWidgets... checking for wx-config...
/c/Progra~1/wxWidgets-2.8.10/wx-config
checking for wxWidgets version >= 2.8.0 (--unicode --debug=yes)... no
checking for standard build of WxWidgets... checking for wx-config...
(cached) /
c/Progra~1/wxWidgets-2.8.10/wx-config
checking for wxWidgets version >= 2.8.0 (--unicode --debug=no)... no
configure: WARNING:
                wxWidgets must be installed on your system.

                Please check that wx-config is in path, the directory
                where wxWidgets libraries are installed (returned by
                'wx-config --libs' or 'wx-config --static --libs' command)
                is in LD_LIBRARY_PATH or equivalent variable and
                wxWidgets version is 2.8.0 or above.


I'm obviously clueless. Any tips? :)

Cheers,
:Davide

Re: Re: Fixes for building erlang under windows

by Dan Gudmundsson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


 From the README.win32
=>  Get and unpack wxWidgets-2.8.9 or higher to /opt/local/pgm inside cygwin
                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The configure script only looks there on windows when building with VC++
We didn't try anything fancy for the windows build there are so few building
from the source on that platform.

/Dan

Davide Marquês wrote:

> Hi Mazen,
> Simply going through the steps in README.win32 doesn't seem to be enough for
> configure to pick up the wxWidgets installation/libraries.
>
> These were the steps I took:
> - run the wxWidgets-2.8.10 installer;
> - edit <wxWidgets dir>/include/wx/msw/setup.h and enable:
> - wxUSE_GLCANVAS
> - wxUSE_POSTSCRIPT
> - wxUSE_GRAPHICS_CONTEXT
> - open <wxWidgets dir>/build/msw/wx.dsw (letting VC convert the projects)
> - build the "Unicode Release" and "Unicode Debug" configurations
> - open <wxWidgets dir>/contrib/build/stc/stc.dsw (letting VC convert the
> projects)
> - build the "Unicode Release" and "Unicode Debug" configurations
> After which the C:\Program Files\wxWidgets-2.8.10\lib\vc_lib folder contais
> 195MB of .lib goodness (wxbase28d.lib, wxbase28u.lib, wxbase28d_net.lib,
> wxbase28u_net.lib, ...).
>
> This is the relevant part of the configure output:
>
>> checking for debug build of WxWidgets... checking for wx-config... no
>
> checking for standard build of WxWidgets... checking for wx-config...
>> (cached) no
>
> configure: WARNING:
>
>                 wxWidgets must be installed on your system.
>
>
>>                 Please check that wx-config is in path, the directory
>
>                 where wxWidgets libraries are installed (returned by
>
>                 'wx-config --libs' or 'wx-config --static --libs' command)
>
>                 is in LD_LIBRARY_PATH or equivalent variable and
>
>                 wxWidgets version is 2.8.0 or above.
>
> checking GL/gl.h usability... no
>
> checking GL/gl.h presence... yes
>
> configure: WARNING: GL/gl.h: present but cannot be compiled
>
> configure: WARNING: GL/gl.h:     check for missing prerequisite headers?
>
> configure: WARNING: GL/gl.h: see the Autoconf documentation
>
> configure: WARNING: GL/gl.h:     section "Present But Cannot Be Compiled"
>
> configure: WARNING: GL/gl.h: proceeding with the preprocessor's result
>
> configure: WARNING: GL/gl.h: in the future, the compiler will take
>> precedence
>
> configure: WARNING:     ## ------------------------------------------ ##
>
> configure: WARNING:     ## Report this to the AC_PACKAGE_NAME lists.  ##
>
> configure: WARNING:     ## ------------------------------------------ ##
>
> checking for GL/gl.h... yes
>
> checking OpenGL/gl.h usability... no
>
> checking OpenGL/gl.h presence... no
>
> checking for OpenGL/gl.h... no
>
> checking if wxwidgets have opengl support... no
>
> checking for GLintptr... no
>
> checking for GLintptrARB... no
>
> checking for GLchar... no
>
> checking for GLcharARB... no
>
> checking for GLhalfARB... no
>
> checking for GLint64EXT... no
>
> checking GLU Callbacks uses Tiger Style... no
>
> checking for wx/stc/stc.h... no
>
> configure: WARNING: Can not find wx/stc/stc.h
>
> checking if we can link wxwidgets programs... no
>
> configure: WARNING: Can not link wx program are all developer packages
>> installed?
>
> configure: creating i686-pc-cygwin/config.status
>
> config.status: creating config.mk
>
> config.status: creating c_src/Makefile
>
>
> The wx-config didn't exist at this point. As there was a wx-config.in file I
> ran configure to create it. But that didn't help much.
>
> Here are some of its outputs:
>
> VC2008: wxWidgets-2.8.10 $ ./wx-config --libs-L/c/Progra~1/wxWidgets-2.8.10/lib
>   -lwx_msw_richtext-2.8 -lwx_msw_aui-2.8 -lwx_msw_xrc-2.8 -lwx_msw_qa-2.8
> -lwx_msw_html-2.8 -lwx_msw_adv-2.8 -lwx_msw_core-2.8 -lwx_base_xml-2.8
> -lwx_base_net-2.8 -lwx_base-2.8
>
> VC2008: wxWidgets-2.8.10 $ ./wx-config --static --libs
>
>   Warning: No config found to match: ./wx-config --static --libs
>            in /c/Progra~1/wxWidgets-2.8.10/lib/wx/config
>   If you require this configuration, please install the desired
>   library build.  If this is part of an automated configuration
>   test and no other errors occur, you may safely ignore it.
>   You may use wx-config --list to see all configs available in
>   the default prefix.
>
>
> VC2008: wx $ wx-config --unicode --debug=yes  Warning: No config found to
> match: /c/Progra~1/wxWidgets-2.8.10/wx-config --unicode --debug=yes
>            in /c/Progra~1/wxWidgets-2.8.10/lib/wx/config
>   If you require this configuration, please install the desired
>   library build.  If this is part of an automated configuration
>   test and no other errors occur, you may safely ignore it.
>   You may use wx-config --list to see all configs available in
>   the default prefix.
>
>
> The configure fails after this last check:
>
> checking for debug build of WxWidgets... checking for wx-config...
> /c/Progra~1/wxWidgets-2.8.10/wx-config
> checking for wxWidgets version >= 2.8.0 (--unicode --debug=yes)... no
> checking for standard build of WxWidgets... checking for wx-config...
> (cached) /
> c/Progra~1/wxWidgets-2.8.10/wx-config
> checking for wxWidgets version >= 2.8.0 (--unicode --debug=no)... no
> configure: WARNING:
>                 wxWidgets must be installed on your system.
>
>                 Please check that wx-config is in path, the directory
>                 where wxWidgets libraries are installed (returned by
>                 'wx-config --libs' or 'wx-config --static --libs' command)
>                 is in LD_LIBRARY_PATH or equivalent variable and
>                 wxWidgets version is 2.8.0 or above.
>
>
> I'm obviously clueless. Any tips? :)
>
> Cheers,
> :Davide
>


________________________________________________________________
erlang-patches mailing list. See http://www.erlang.org/faq.html
erlang-patches (at) erlang.org


Re: Re: Fixes for building erlang under windows

by Davide Marquês :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

2009/9/28 Dan Gudmundsson <dgud@...>

>
> From the README.win32
> =>  Get and unpack wxWidgets-2.8.9 or higher to /opt/local/pgm inside
> cygwin
>                                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
Doh!
Copying the files now. I'll let you know how it goes.


> The configure script only looks there on windows when building with VC++
> We didn't try anything fancy for the windows build there are so few
> building
> from the source on that platform.
>
Hope my tutorial/guide can help improve that. At least it shows that it's
possible to build erlang with a free (as in beer) toolchain.

Thanks for the RTFM. :)
:Davide

Re: Re: Fixes for building erlang under windows

by Davide Marquês :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi again,

With a bit of help (thanks guys!) I was able to build everything and now
have a (hopefully) fully working erlang installation.
All the patches and build steps are available here:
Building erlang using Visual C++ 2008 Express
Edition<http://github.com/davide/erl_interface-examples/blob/master/doc/Building%20erlang%20using%20Visual%20C++%202008%20Express%20Edition.txt>

I'll be doing development on this new system and I'll let you know if
anything's broken.

Cheers,
:Davide