Code Monkey home page Code Monkey logo

Comments (11)

naedanger avatar naedanger commented on August 19, 2024 4

Its now possible to build restbed in windows.

The build has been tested with Visual Studio 2015 Community Edition (compiler version 19.00.23026). You can use cmake to generate a VS project file or NMake files using the instructions below.

Examples that dont require OpenSSL, Syslog or PAM all build. The tests have not yet been ported. SSL support is not yet operational but this is just a matter of modifying cmake files to find the binaries on windows.

To create a Visual Studio project file, type the following at a command prompt or directly in GIT Bash (assuming cmake is in your path):

mkdir build && cd build
cmake -DBUILD_SSL=OFF -DBUILD_EXAMPLES=ON -G "Visual Studio 14 2015" ..

To use NMake, open a Visual Studio Command Prompt and navigate to restbed directory:

mkdir build && cd build
cmake -DBUILD_SSL=OFF -DBUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" ..
nmake

from restbed.

ben-crowhurst avatar ben-crowhurst commented on August 19, 2024 4

I can confirm that Restbed now builds natively on Windows with Visual Studio 2015. What follows is a set of instructions and any errors we have encountered along the way. I'm not going to close this ticket as several build warnings (unreachable code) still remain around test cases. These issues appear to be caused by our choice of framework.

Environment

  • Windows 8.1 x64
  • Visual Studio (CE) 14 2015

Setup
To address the resource problem and excessive file indexing caused by Visual Studio. We have opted to build the project using the Visual Studio 2015 x64 Native Tools Command Prompt. If your environment differs x86/ARM, please ensure you open the correct prompt. You MUST build Restbed and any dependencies (OpenSSL) via the same prompt to ensure x64 compatibility.

Once you've built the project and it's dependencies you can confirm you have the right build by checking each library as follows; they should produce matching output 8664 machine (x64) in our case.

dumpbin libeay32.dll /headers | findstr machine
dumpbin ssleay32.dll /headers | findstr machine
dumpbin restbed.lib /headers | findstr machine

Build OpenSSL
These instructions differ on x86/ARM platforms, please see dependency\openssl\INSTALL.* for details.

cd restbed\dependency\openssl
perl Configure VC-WIN64A
ms\do_win64a
nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test
set PATH=restbed\dependency\openssl\out32dll;%PATH%

If you need to generate an SSL certificate you will additionally have to install OpenSSL.

nmake -f ms\ntdll.mak install
set PATH=%PATH%;c:\usr\local\ssl\bin

We will move to C:\tmp so the new certificate will work with the HTTPS example. The following must be performed in "Run As Administrator" mode to work, otherwise unable to write 'random state' errors will occur.

mkdir \tmp
cd \tmp
openssl genrsa -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
openssl dhparam -out dh768.pem 768

Build Restbed

cd restbed
mkdir build
cd build
cmake -G "Visual Studio 14 2015 Win64" -DBUILD_EXAMPLES=YES -DBUILD_TESTS=YES ..
cmake --build . --target ALL_BUILD --config Release
ctest

from restbed.

ben-crowhurst avatar ben-crowhurst commented on August 19, 2024 1

@nViso If I recall correctly, this error was due to an OpenSSL build issue/bug. Please reset the OpenSSL folder to its original state.

Reset

cd restbed
git deinit -f dependency/openssl
git submodule update --init dependency/openssl

Confirm everything has reverted to its original state.

cd dependency/openssl
git status
HEAD detacted at 2df619b
nothing to commit, working directory clean

Configure Stage 1

perl Configure VC-WIN64A

Output

Configuring for VC-WIN64A
    no-ec_nistp_64_gcc_128 [default]  OPENSSL_NO_EC
    no-gmp          [default]  OPENSSL_NO_GMP (skip
    no-jpake        [experimental] OPENSSL_NO_JPAKE
    no-krb5         [krb5-flavor not specified] OPE
    no-libunbound   [experimental] OPENSSL_NO_LIBUN
    no-md2          [default]  OPENSSL_NO_MD2 (skip
    no-rc5          [default]  OPENSSL_NO_RC5 (skip
    no-rfc3779      [default]  OPENSSL_NO_RFC3779 (
    no-sctp         [default]  OPENSSL_NO_SCTP (ski
    no-shared       [default]
    no-ssl-trace    [default]  OPENSSL_NO_SSL_TRACE
    no-store        [experimental] OPENSSL_NO_STORE
    no-unit-test    [default]  OPENSSL_NO_UNIT_TEST
    no-zlib         [default]
    no-zlib-dynamic [default]
IsMK1MF=1
CC            =cl
CFLAG         =-DOPENSSL_THREADS  -DDSO_WIN32 -W3 -
O_DEPRECATE -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MO
AES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM -DGHASH_ASM -DE
EX_LIBS       =
CPUID_OBJ     =x86_64cpuid.o
BN_ASM        =bn_asm.o x86_64-mont.o x86_64-mont5.
EC_ASM        =ecp_nistz256.o ecp_nistz256-x86_64.o
DES_ENC       =des_enc.o fcrypt_b.o
AES_ENC       =aes-x86_64.o vpaes-x86_64.o bsaes-x8
BF_ENC        =bf_enc.o
CAST_ENC      =c_enc.o
RC4_ENC       =rc4-x86_64.o rc4-md5-x86_64.o
RC5_ENC       =rc5_enc.o
MD5_OBJ_ASM   =md5-x86_64.o
SHA1_OBJ_ASM  =sha1-x86_64.o sha256-x86_64.o sha512
RMD160_OBJ_ASM=
CMLL_ENC      =cmll-x86_64.o cmll_misc.o
MODES_OBJ     =ghash-x86_64.o aesni-gcm-x86_64.o
ENGINES_OBJ   =
PROCESSOR     =
RANLIB        =true
ARFLAGS       =
PERL          =perl
SIXTY_FOUR_BIT mode
DES_INT used
RC4_CHUNK is unsigned long long

Configured for VC-WIN64A.

Configure Stage 2

ms\do_win64a

Output

perl util\mkfiles.pl  1>MINFO
cmd /c "nasm -f win64 -v"  1>NUL 2>&1
if 0 NEQ 0 goto ml64
perl ms\uplink-x86_64.pl nasm  1>ms\uptable.asm
nasm -f win64 -o ms\uptable.obj ms\uptable.asm
goto proceed
perl util\mk1mf.pl VC-WIN64A  1>ms\nt.mak
perl util\mk1mf.pl dll VC-WIN64A  1>ms\ntdll.mak
perl util\mkdef.pl 32 libeay  1>ms\libeay32.def
perl util\mkdef.pl 32 ssleay  1>ms\ssleay32.def

Build

nmake -f ms\ntdll.mak
nmake -f ms\ntdll.mak test

Environment

Asset Version
Operating System Microsoft Windows 8.1, 64-bit OS, x64-based processor
Processor Intel Core i3-2365M CPU @ 1.40GHz
RAM 4.00 GB (2.89 GB usable)
Command Prompt VS2015 x64 Native Tools
Visual Studio Community 2015 Version 14.0.23107.10
Visual Studio 2015 SDK - ENU Version 14.0.23107.10
Microsoft Visual C++ 2015 Redistributable (x64) 14.0.23026.0
Perl Active Perl 5, Version 20, SubVersion 2 (v5.20.2) build for MSWin32-x64 multi-thread
nasm Version 2.11.08 Complied on Feb 21 2015
nmake Microsoft Program Maintenance Utility Version 14.00.23026.0

from restbed.

nViso avatar nViso commented on August 19, 2024

Hi,

We'd like to try the project on VS2015, is it possible to add support for this compiler?

Thanks,
Tim

from restbed.

ben-crowhurst avatar ben-crowhurst commented on August 19, 2024

This functionality has been in beta for sometime and should be available in the next week or two. Currently we're addressing the OpenSSL situation to help ease VS2015 integration.

from restbed.

ben-crowhurst avatar ben-crowhurst commented on August 19, 2024

The following helps to avoid the pain of opening the resource hog that is Visual Studio.

cmake -G "Visual Studio 14 2015" -DBUILD_SSL=NO -DBUILD_EXAMPLES=YES -DBUILD_TESTS=YES ..
cmake --build . --target ALL_BUILD --config Release
ctest

from restbed.

nViso avatar nViso commented on August 19, 2024

While building OpenSSL with Visual Studio 2015 on Windows 10 we are getting this error. What was your build environment for compiling OpenSSL?

C:\workspace\scratch\restbed-master\dependency\openssl>nmake -f ms\ntdll.mak

Microsoft (R) Program Maintenance Utility Version 14.00.23026.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Building OpenSSL

perl .\util\copy-if-different.pl ".\crypto\buildinf.h" "tmp32dll\buildin
f.h"

Copying: ./crypto/buildinf.h to tmp32dll/buildinf.h

perl .\util\copy-if-different.pl ".\crypto\opensslconf.h" "inc32\openssl
\opensslconf.h"

NOT copying: ./crypto/opensslconf.h to inc32/openssl/opensslconf.h
ml64 /c /Cp /Cx /Zi /Fotmp32dll\x86_64cpuid.obj tmp32dll\x86_64cpuid.asm

Microsoft (R) Macro Assembler (x64) Version 14.00.23026.0
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: tmp32dll\x86_64cpuid.asm
tmp32dll\x86_64cpuid.asm(1) : error A2088:END directive required at end of file
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\BIN\amd64\ml64.EXE"' : return code '0x1'
Stop.

from restbed.

nViso avatar nViso commented on August 19, 2024

The static library is building fine : nmake -f ms\nt.mak

from restbed.

ben-crowhurst avatar ben-crowhurst commented on August 19, 2024

@nViso Alternatively I can make the shared library available to you via download?

from restbed.

Puneetsharma030 avatar Puneetsharma030 commented on August 19, 2024

HI,

I tried to build with openssl support and was able to generate visual studio project files with cmake. But when I try to compile the project, it throws many errors from "asio/ssl/" dependency. I would really appreciate if I could get any lead.
Thanks

from restbed.

ben-crowhurst avatar ben-crowhurst commented on August 19, 2024

@Puneetsharma030 Please open a new ticket including as much detail as you can.

from restbed.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.