Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Windows compiling error with mvsc #131

Description

@Hirobreak

I have:

  • searched open and closed issues for duplicates

Bug description

I was unable to compile libsignal-protocol-c using Visual Studio, either with the IDE or the default console compiler msvc.

Steps to reproduce

  • Open PowerShell or Developer Command Prompt for VS 2019
  • Go to the repo's folder, create a folder for the build and open it
  • run cmake ..
  • run cmake --build .

Actual result:
I get the following errors:

C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\src\curve25519\ed25519\tests\internal_fast_tests.c(300,28): erro
r C2057:  expected constant expression [C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\myOwnBuild\src\curve2551
9\curve25519.vcxproj]
C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\src\curve25519\ed25519\tests\internal_fast_tests.c(300,28): erro r C2466:  cannot allocate an array of constant size 0 [C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\myOwnBuil d\src\curve25519\curve25519.vcxproj]
C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\src\curve25519\ed25519\tests\internal_fast_tests.c(300,29): erro r C2133:  'msg': unknown size [C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\myOwnBuild\src\curve25519\curve25 519.vcxproj]
C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\src\curve25519\ed25519\tests\internal_fast_tests.c(340,28): erro r C2057:  expected constant expression [C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\myOwnBuild\src\curve2551 9\curve25519.vcxproj]
C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\src\curve25519\ed25519\tests\internal_fast_tests.c(340,28): erro r C2466:  cannot allocate an array of constant size 0 [C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\myOwnBuil d\src\curve25519\curve25519.vcxproj]
C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\src\curve25519\ed25519\tests\internal_fast_tests.c(340,29): erro
r C2133:  'msg': unknown size [C:\Users\Unable to decrypt\Documents\Git\libsignal-protocol-c\myOwnBuild\src\curve25519\curve25
519.vcxproj]

Expected result:
I expect to generate signal-protocol-c.lib

Device info

Device: Toshiba (DESKTOP-PKJM3FE) Windows 10 Home 64 bits
Signal version: 2.3.2

Link to logs

It seems like msvc doesn't fully support standard c99 which leads to errors in the following code:

const int MSG_LEN = 200;
unsigned char msg[MSG_LEN];

It also doesn't identify #ifndef _WINDOWS so it always ends up trying to include unistd.h.

I have a workaround, changes can be seen here Hirobreak@2721ea8.

Which works for me as of now. I did a little research to make my workaround a solution but I've found none yet

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions