Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] openssl/1.1.1m: can't build with windows clang #9834

Open
AndreyMlashkin opened this issue Mar 18, 2022 · 8 comments
Open

[package] openssl/1.1.1m: can't build with windows clang #9834

AndreyMlashkin opened this issue Mar 18, 2022 · 8 comments
Labels
bug Something isn't working

Comments

@AndreyMlashkin
Copy link
Contributor

Package and Environment Details (include every applicable attribute)

  • Package Name/Version: openssl/1.1.1m
  • Operating System+version: Windows 10
  • Compiler+version: clang 12
  • Conan version: conan 1.46.0

Conan profile (output of conan profile show default or conan profile show <profile> if custom profile is in use)

[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=clang
compiler.runtime=MD
compiler.version=12
cppstd=17
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
CC=clang-cl
CONAN_CMAKE_GENERATOR=Ninja
CXX=clang-cl

Steps to reproduce (Include if Applicable)

conan install openssl/1.1.1m@ --build missing -pr clang

Logs (Include/Attach if Applicable)

Click to expand log
> conan install --build missing -pr clang openssl/1.1.1m@
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=clang
compiler.runtime=MD
compiler.version=12
cppstd=17
os=Windows
os_build=Windows
pictofitstudio:build_type=RelWithDebInfo
pictofitcore:build_type=RelWithDebInfo
[options]
pictofitstudio*:with_sentry=True
[build_requires]
[env]
CC=clang-cl
CONAN_CMAKE_GENERATOR=Ninja
CXX=clang-cl
openssl/1.1.1m: WARN: Package binary is corrupted, removing: e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc
Installing package: openssl/1.1.1m
Requirements
    openssl/1.1.1m from 'artifactory' - Cache
Packages
    openssl/1.1.1m:e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc - Build
Build requirements
    nasm/2.15.05 from 'artifactory' - Cache
    strawberryperl/5.30.0.1 from 'artifactory' - Cache
Build requirements packages
    nasm/2.15.05:0a420ff5c47119e668867cdb51baff0eca1fdb68 - Cache
    strawberryperl/5.30.0.1:ca33edce272a279b24f87dc0d4cf5bbdcffbc187 - Cache

Installing (downloading, building) binaries...
nasm/2.15.05: Already installed!
nasm/2.15.05: Appending PATH environment variable: D:\.conan\storage\nasm\2.15.05\_\_\package\0a420ff5c47119e668867cdb51baff0eca1fdb68\bin
strawberryperl/5.30.0.1: Already installed!
strawberryperl/5.30.0.1: Appending PATH environment variable: D:\.conan\fb39bb\1\bin
openssl/1.1.1m: Applying build-requirement: strawberryperl/5.30.0.1
openssl/1.1.1m: Applying build-requirement: nasm/2.15.05
openssl/1.1.1m: WARN: Build folder is dirty, removing it: D:\.conan\storage\openssl\1.1.1m\_\_\build\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc
openssl/1.1.1m: Copying sources to build folder
openssl/1.1.1m: Building your package in D:\.conan\storage\openssl\1.1.1m\_\_\build\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc
openssl/1.1.1m: Generator txt created conanbuildinfo.txt
openssl/1.1.1m: Aggregating env generators
openssl/1.1.1m: Calling build()
Found Visual Studio 16
**********************************************************************
** Visual Studio 2019 Developer Command Prompt v16.11.11
** Copyright (c) 2021 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
openssl/1.1.1m: using target: VC-conan-Release-Windows-x86_64-clang-12 -> VC-WIN64A
openssl/1.1.1m: my %targets = (
    "VC-conan-Release-Windows-x86_64-clang-12" => {
        inherit_from => [ "VC-WIN64A" ],
        cflags => add("-m64 -O3 -MD"),
        cxxflags => add("-m64 -O3 -MD"),
        defines => add("NDEBUG"),
        includes => add("D:/.conan/fb39bb/1/include"),
        lflags => add("-m64"),



        cc => "clang-cl",
        cxx => "clang-cl",



    },
);

openssl/1.1.1m: ['"VC-conan-Release-Windows-x86_64-clang-12"', 'no-shared', '--prefix="D:\\.conan\\storage\\openssl\\1.1.1m\\_\\_\\package\\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc"', '--openssldir="D:\\.conan\\storage\\openssl\\1.1.1m\\_\\_\\package\\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc\\res"', 'no-unit-test', 'threads', 'PERL=D:\\.conan\\fb39bb\\1\\bin\\perl.exe', 'no-tests', '--release']
WARN: replace_in_file didn't find pattern '/MTd ' in 'Configurations\10-main.conf' file.
WARN: replace_in_file didn't find pattern '/MTd"' in 'Configurations\10-main.conf' file.

----Running------
> D:\.conan\fb39bb\1\bin\perl.exe ./Configure "VC-conan-Release-Windows-x86_64-clang-12" no-shared --prefix="D:\.conan\storage\openssl\1.1.1m\_\_\package\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc" --openssldir="D:\.conan\storage\openssl\1.1.1m\_\_\package\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc\res" no-unit-test threads PERL=D:\.conan\fb39bb\1\bin\perl.exe no-tests --release
-----------------
Configuring OpenSSL version 1.1.1m (0x101010dfL) for VC-conan-Release-Windows-x86_64-clang-12
Using os-specific seed configuration
Creating configdata.pm
Creating makefile

**********************************************************************
***                                                                ***
***   OpenSSL has been successfully configured                     ***
***                                                                ***
***   If you encounter a problem while building, please open an    ***
***   issue on GitHub <https://github.com/openssl/openssl/issues>  ***
***   and include the output from the following command:           ***
***                                                                ***
***       perl configdata.pm --dump                                ***
***                                                                ***
***   (If you are new to OpenSSL, you might want to consult the    ***
***   'Troubleshooting' section in the INSTALL file first)         ***
***                                                                ***
**********************************************************************

----Running------
> nmake
-----------------

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

        "D:\.conan\fb39bb\1\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "include\crypto\bn_conf.h.in" > include\crypto\bn_conf.h
        "D:\.conan\fb39bb\1\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "include\crypto\dso_conf.h.in" > include\crypto\dso_conf.h
        "D:\.conan\fb39bb\1\bin\perl.exe" "-I." -Mconfigdata "util\dofile.pl"  "-omakefile" "include\openssl\opensslconf.h.in" > include\openssl\opensslconf.h
        "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe" /                   depend && "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe" /                   _all

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


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

        "clang-cl"  /Zi /Fdossl_static.pdb / /Zl /Gs0 /GF /Gy -m64 -O3 -MD /W3 /wd4090 /nologo /O2 /I "." /I "include" -D"L_ENDIAN" -D"OPENSSL_PIC" -D"OPENSSL_CPUID_OBJ" -D"OPENSSL_IA32_SSE2" -D"OPENSSL_BN_ASM_MONT" -D"OPENSSL_BN_ASM_MONT5" -D"OPENSSL_BN_ASM_GF2m" -D"SHA1_ASM" -D"SHA256_ASM" -D"SHA512_ASM" -D"KECCAK1600_ASM" -D"RC4_ASM" -D"MD5_ASM" -D"AESNI_ASM" -D"VPAES_ASM" -D"GHASH_ASM" -D"ECP_NISTZ256_ASM" -D"X25519_ASM" -D"POLY1305_ASM" -D"OPENSSLDIR=\"D:\\.conan\\storage\\openssl\\1.1.1m\\_\\_\\package\\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc\\res\"" -D"ENGINESDIR=\"D:\\.conan\\storage\\openssl\\1.1.1m\\_\\_\\package\\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc\\lib\\engines-1_1\"" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE" -D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE" -D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"NDEBUG" -D"NDEBUG" -I"D:/.conan/fb39bb/1/include"  -c /Foapps\app_rand.obj "apps\app_rand.c"
clang-cl: error: cannot specify '/Foapps\app_rand.obj' when compiling multiple source files
clang-cl: warning: /: 'linker' input unused [-Wunused-command-line-argument]
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\Llvm\x64\bin\clang-cl.EXE"' : return code '0x1'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64\nmake.exe"' : return code '0x2'
Stop.
openssl/1.1.1m:
openssl/1.1.1m: ERROR: Package 'e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc' build failed
openssl/1.1.1m: WARN: Build folder D:\.conan\storage\openssl\1.1.1m\_\_\build\e5dfaa2a6d0ff8915bb91aa1f1e2569e87e2b3dc
ERROR: openssl/1.1.1m: Error in build() method, line 772
        self._make()
while calling '_make', line 712
        self._run_make()
while calling '_run_make', line 667
        self.run(" ".join(command), win_bash=self._win_bash)
        ConanException: Error 2 while executing nmake
@SSE4
Copy link
Contributor

SSE4 commented Mar 26, 2022

I can try this one later today. I am pretty sure it used to work for clang-cl earlier, but it was like ~4 years ago xD

@SSE4
Copy link
Contributor

SSE4 commented Mar 26, 2022

I confirm I have the same error:
clang-cl: error: cannot specify '/Foapps\app_rand.obj' when compiling multiple source files

some similar reports, might be helpful:
openssl/openssl#12563
#4740
#5441

@SSE4
Copy link
Contributor

SSE4 commented Mar 26, 2022

the slash right after /Fdoss_static.pdb seems weird and redundant:

"clang-cl"  /Zi /Fdossl_static.pdb / /Zl /Gs0 /GF /Gy -m64 -O3 -MD /W3 /wd4090 /nologo /O2 /I "." /I "include" -D"L_ENDIAN" -D"OPENSSL_PIC" -D"OPENSSL_CPUID_OBJ" -D"OPENSSL_IA32_SSE2" -D"OPENSSL_BN_ASM_MONT" -D"OPENSSL_BN_ASM_MONT5" -D"OPENSSL_BN_ASM_GF2m" -D"SHA1_ASM" -D"SHA256_ASM" -D"SHA512_ASM" -D"KECCAK1600_ASM" -D"RC4_ASM" -D"MD5_ASM" -D"AESNI_ASM" -D"VPAES_ASM" -D"GHASH_ASM" -D"ECP_NISTZ256_ASM" -D"X25519_ASM" -D"POLY1305_ASM" -D"OPENSSLDIR=\"C:\\Users\\sse4\\.conan\\data\\openssl\\1.1.1m\\_\\_\\package\\5dc6feb006de2b40ddc710444b5ef1e8a0bb5688\\res\"" -D"ENGINESDIR=\"C:\\Users\\sse4\\.conan\\data\\openssl\\1.1.1m\\_\\_\\package\\5dc6feb006de2b40ddc710444b5ef1e8a0bb5688\\lib\\engines-1_1\"" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE" -D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE" -D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"NDEBUG" -D"NDEBUG"  -c /Foapps\app_rand.obj "apps\app_rand.c"

now need to understand where is it coming from...

@SSE4
Copy link
Contributor

SSE4 commented Mar 26, 2022

the output of perl configdata.pm --dump command:


Command line (with current working directory = .):

    C:\.conan\993101\1\bin\perl.exe Configure VC-conan-Release-Windows-x86_64-clang-13 no-shared --prefix=C:\Users\sse4\.conan\data\openssl\1.1.1m\_\_\package\5dc6feb006de2b40ddc710444b5ef1e8a0bb5688 --openssldir=C:\Users\sse4\.conan\data\openssl\1.1.1m\_\_\package\5dc6feb006de2b40ddc710444b5ef1e8a0bb5688\res no-unit-test threads PERL=C:\.conan\993101\1\bin\perl.exe no-tests --release

Perl information:

    C:\.conan\993101\1\bin\perl.exe
    5.30.0 for MSWin32-x64-multi-thread

Enabled features:

    aria
    asm
    async
    autoalginit
    autoerrinit
    autoload-config
    bf
    blake2
    camellia
    capieng
    cast
    chacha
    cmac
    cms
    comp
    ct
    deprecated
    des
    dgram
    dh
    dsa
    dso
    dtls
    ec
    ec2m
    ecdh
    ecdsa
    engine
    err
    filenames
    gost
    hw(-.+)?
    idea
    makedepend
    md4
    mdc2
    multiblock
    nextprotoneg
    pinshared
    ocb
    ocsp
    pic
    poly1305
    posix-io
    psk
    rc2
    rc4
    rdrand
    rfc3779
    rmd160
    scrypt
    seed
    siphash
    sm2
    sm3
    sm4
    sock
    srp
    srtp
    sse2
    ssl
    static-engine
    stdio
    threads
    tls
    ts
    ui-console
    whirlpool
    tls1
    tls1-method
    tls1_1
    tls1_1-method
    tls1_2
    tls1_2-method
    tls1_3
    dtls1
    dtls1-method
    dtls1_2
    dtls1_2-method

Disabled features:

    afalgeng                [not-linux] OPENSSL_NO_AFALGENG
    asan                    [default]   OPENSSL_NO_ASAN
    buildtest-c++           [default]   
    crypto-mdebug           [default]   OPENSSL_NO_CRYPTO_MDEBUG
    crypto-mdebug-backtrace [default]   OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
    devcryptoeng            [default]   OPENSSL_NO_DEVCRYPTOENG
    dynamic-engine          [cascade]   
    ec_nistp_64_gcc_128     [default]   OPENSSL_NO_EC_NISTP_64_GCC_128
    egd                     [default]   OPENSSL_NO_EGD
    external-tests          [default]   OPENSSL_NO_EXTERNAL_TESTS
    fuzz-libfuzzer          [default]   OPENSSL_NO_FUZZ_LIBFUZZER
    fuzz-afl                [default]   OPENSSL_NO_FUZZ_AFL
    heartbeats              [default]   OPENSSL_NO_HEARTBEATS
    md2                     [default]   OPENSSL_NO_MD2 (skip crypto\md2)
    msan                    [default]   OPENSSL_NO_MSAN
    rc5                     [default]   OPENSSL_NO_RC5 (skip crypto\rc5)
    sctp                    [default]   OPENSSL_NO_SCTP
    shared                  [option]    
    ssl-trace               [default]   OPENSSL_NO_SSL_TRACE
    tests                   [option]    OPENSSL_NO_TESTS
    ubsan                   [default]   OPENSSL_NO_UBSAN
    unit-test               [option]    OPENSSL_NO_UNIT_TEST
    weak-ssl-ciphers        [default]   OPENSSL_NO_WEAK_SSL_CIPHERS
    zlib                    [default]   
    zlib-dynamic            [default]   
    ssl3                    [default]   OPENSSL_NO_SSL3
    ssl3-method             [default]   OPENSSL_NO_SSL3_METHOD

Config target attributes:

    AR => "lib",
    ARFLAGS => "/nologo",
    AS => "nasm",
    ASFLAGS => "-g",
    CC => "clang-cl",
    CFLAGS => "/W3 /wd4090 /nologo /O2",
    CPP => "\$(CC) /EP /C",
    CXX => "clang-cl",
    CXXFLAGS => "/W3 /wd4090 /nologo /O2",
    HASHBANGPERL => "/usr/bin/env perl",
    LD => "link",
    LDFLAGS => "/nologo /debug",
    MT => "mt",
    MTFLAGS => "-nologo",
    RANLIB => "CODE(0xf9c368)",
    RC => "rc",
    aes_asm_src => "aes_core.c aes_cbc.c vpaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s",
    aes_obj => "aes_core.o aes_cbc.o vpaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o",
    apps_aux_src => "win32_init.c",
    apps_init_src => "",
    apps_obj => "win32_init.o",
    aroutflag => "/out:",
    asflags => "-Ox -f win64 -DNEAR",
    asoutflag => "-o ",
    bf_asm_src => "bf_enc.c",
    bf_obj => "bf_enc.o",
    bin_cflags => "/Zi /Fdapp.pdb /",
    bin_lflags => "/subsystem:console /opt:ref",
    bn_asm_src => "bn_asm.c x86_64-mont.s x86_64-mont5.s x86_64-gf2m.s rsaz_exp.c rsaz-x86_64.s rsaz-avx2.s",
    bn_obj => "bn_asm.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o",
    bn_ops => "EXPORT_VAR_AS_FN SIXTY_FOUR_BIT",
    build_file => "makefile",
    build_scheme => [ "unified", "windows", "VC-common" ],
    cast_asm_src => "c_enc.c",
    cast_obj => "c_enc.o",
    cflags => "/Gs0 /GF /Gy -m64 -O3 -MD",
    chacha_asm_src => "chacha-x86_64.s",
    chacha_obj => "chacha-x86_64.o",
    cmll_asm_src => "cmll-x86_64.s cmll_misc.c",
    cmll_obj => "cmll-x86_64.o cmll_misc.o",
    coutflag => "/Fo",
    cppflags => "",
    cpuid_asm_src => "x86_64cpuid.s",
    cpuid_obj => "x86_64cpuid.o",
    cxxflags => "-m64 -O3 -MD",
    defines => [ "OPENSSL_SYS_WIN32", "WIN32_LEAN_AND_MEAN", "UNICODE", "_UNICODE", "_CRT_SECURE_NO_DEPRECATE", "_WINSOCK_DEPRECATED_NO_WARNINGS", "NDEBUG" ],
    des_asm_src => "des_enc.c fcrypt_b.c",
    des_obj => "des_enc.o fcrypt_b.o",
    disable => [  ],
    dso_cflags => "/Zi /Fddso.pdb",
    dso_extension => ".dll",
    dso_scheme => "win32",
    ec_asm_src => "ecp_nistz256.c ecp_nistz256-x86_64.s x25519-x86_64.s",
    ec_obj => "ecp_nistz256.o ecp_nistz256-x86_64.o x25519-x86_64.o",
    enable => [  ],
    ex_libs => "ws2_32.lib gdi32.lib advapi32.lib crypt32.lib user32.lib",
    exe_extension => "",
    includes => [  ],
    keccak1600_asm_src => "keccak1600-x86_64.s",
    keccak1600_obj => "keccak1600-x86_64.o",
    ldoutflag => "/out:",
    lflags => "-m64",
    lib_cflags => "/Zi /Fdossl_static.pdb / /Zl",
    lib_cppflags => "",
    lib_defines => [ "L_ENDIAN" ],
    md5_asm_src => "md5-x86_64.s",
    md5_obj => "md5-x86_64.o",
    modes_asm_src => "ghash-x86_64.s aesni-gcm-x86_64.s",
    modes_obj => "ghash-x86_64.o aesni-gcm-x86_64.o",
    module_cflags => "",
    module_cxxflags => "",
    module_ldflags => "/dll",
    mtinflag => "-manifest ",
    mtoutflag => "-outputresource:",
    multilib => "-x64",
    padlock_asm_src => "e_padlock-x86_64.s",
    padlock_obj => "e_padlock-x86_64.o",
    perlasm_scheme => "auto",
    poly1305_asm_src => "poly1305-x86_64.s",
    poly1305_obj => "poly1305-x86_64.o",
    rc4_asm_src => "rc4-x86_64.s rc4-md5-x86_64.s",
    rc4_obj => "rc4-x86_64.o rc4-md5-x86_64.o",
    rc5_asm_src => "rc5_enc.c",
    rc5_obj => "rc5_enc.o",
    rcoutflag => "/fo",
    rmd160_asm_src => "",
    rmd160_obj => "",
    sha1_asm_src => "sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s sha1-mb-x86_64.s sha256-mb-x86_64.s",
    sha1_obj => "sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o",
    shared_cflag => "",
    shared_defines => [  ],
    shared_extension => ".dll",
    shared_extension_simple => ".dll",
    shared_ldflag => "/dll",
    shared_rcflag => "",
    shared_target => "win-shared",
    sys_id => "WIN64A",
    thread_defines => [  ],
    thread_scheme => "winthreads",
    unistd => "<unistd.h>",
    uplink_aux_src => "",
    uplink_obj => "",
    wp_asm_src => "wp-x86_64.s",
    wp_obj => "wp-x86_64.o",

Recorded environment:

    AR = 
    ARFLAGS = 
    AS = 
    ASFLAGS = 
    BUILDFILE = 
    CC = "clang-cl"
    CFLAGS = 
    CPP = 
    CPPDEFINES = 
    CPPFLAGS = 
    CPPINCLUDES = 
    CROSS_COMPILE = 
    CXX = clang-cl
    CXXFLAGS = 
    HASHBANGPERL = 
    LD = 
    LDFLAGS = 
    LDLIBS = 
    MT = 
    MTFLAGS = 
    OPENSSL_LOCAL_CONFIG_DIR = 
    PERL = C:\.conan\993101\1\bin\perl.exe
    RANLIB = 
    RC = 
    RCFLAGS = 
    RM = 
    WINDRES = 
    __CNF_CFLAGS = 
    __CNF_CPPDEFINES = 
    __CNF_CPPFLAGS = 
    __CNF_CPPINCLUDES = 
    __CNF_CXXFLAGS = 
    __CNF_LDFLAGS = 
    __CNF_LDLIBS = 

Makevars:

    AR              = lib
    ARFLAGS         = /nologo
    AS              = nasm
    ASFLAGS         = -g
    CC              = "clang-cl"
    CFLAGS          = /W3 /wd4090 /nologo /O2
    CPP             = $(CC) /EP /C
    CPPDEFINES      = 
    CPPFLAGS        = 
    CPPINCLUDES     = 
    CXX             = clang-cl
    CXXFLAGS        = /W3 /wd4090 /nologo /O2
    HASHBANGPERL    = C:\.conan\993101\1\bin\perl.exe
    LD              = link
    LDFLAGS         = /nologo /debug
    LDLIBS          = 
    MT              = mt
    MTFLAGS         = -nologo
    PERL            = C:\.conan\993101\1\bin\perl.exe
    RC              = rc
    RCFLAGS         = 

NOTE: These variables only represent the configuration view.  The build file
template may have processed these variables further, please have a look at the
build file for more exact data:
    makefile

build file:

    makefile

build file templates:

    Configurations\common0.tmpl
    Configurations\windows-makefile.tmpl
    Configurations\common.tmpl

notice: lib_cflags => "/Zi /Fdossl_static.pdb / /Zl", - that's where it is corrupted

@SSE4
Copy link
Contributor

SSE4 commented Mar 26, 2022

okay, the reason seeems to be clear now. in my local 10-main.conf it is:

        lib_cflags       => add(sub { $disabled{shared} ? "/ /Zl" : () }),

while an original code has:

        lib_cflags       => add(sub { $disabled{shared} ? "/MT /Zl" : () }),

so this should be the following line:
https://github.com/conan-io/conan-center-index/blob/master/recipes/openssl/1.x.x/conanfile.py#L794

so it turns out the new helper msvc_runtime_flag doesn't work for the clang-cl case. and indeed it doesn't:
https://github.com/conan-io/conan/blob/1.46.2/conan/tools/microsoft/visual.py#L86

I'll create an issue against conan client. meanwhile, the simple patch for the recipe solves that problem:

diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py
index 1ea358c60..997868bf2 100644
--- a/recipes/openssl/1.x.x/conanfile.py
+++ b/recipes/openssl/1.x.x/conanfile.py
@@ -791,8 +791,11 @@ class OpenSSLConan(ConanFile):

     def _replace_runtime_in_file(self, filename):
         for e in ["MDd", "MTd", "MD", "MT"]:
-            tools.replace_in_file(filename, "/%s " % e, "/%s " % msvc_runtime_flag(self), strict=False)
-            tools.replace_in_file(filename, "/%s\"" % e, "/%s\"" % msvc_runtime_flag(self), strict=False)
+            flag = msvc_runtime_flag(self)
+            if self._is_clangcl:
+                flag = self.settings.get_safe("compiler.runtime")
+            tools.replace_in_file(filename, "/%s " % e, "/%s " % flag, strict=False)
+            tools.replace_in_file(filename, "/%s\"" % e, "/%s\"" % flag, strict=False)

     def package(self):
         self.copy(src=self._source_subfolder, pattern="*LICENSE", dst="licenses")

then it fails with another errors:

C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include\stdatomic.h(15,2): error: <stdatomic.h> is not yet
      supported when compiling as C, but this is planned for a future release.
#error <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
 ^
include\crypto/evp.h(398,5): error: unknown type name 'CRYPTO_REF_COUNT'                                                                                 CRYPTO_REF_COUNT references;                                         

@SSE4
Copy link
Contributor

SSE4 commented Mar 26, 2022

okay, after adding one more change:

index 997868bf2..56d14442f 100644
--- a/recipes/openssl/1.x.x/conanfile.py
+++ b/recipes/openssl/1.x.x/conanfile.py
@@ -534,6 +534,9 @@ class OpenSSLConan(ConanFile):
                 args.append("-DOPENSSL_CAPIENG_DIALOG=1")
         else:
             args.append("-fPIC" if self.options.get_safe("fPIC", True) else "no-pic")
+        if self._is_clangcl:
+            # #error <stdatomic.h> is not yet supported when compiling as C, but this is planned for a future release.
+            args.append("-D__STDC_NO_ATOMICS__")
         if self.settings.os == "Neutrino":
             args.append("no-asm -lsocket -latomic")
         if self._full_version < "1.1.0":

I've got a successful build, finally.

@AndreyMlashkin
Copy link
Contributor Author

I am getting endless build loop locally...

@AndreyMlashkin
Copy link
Contributor Author

now it works for me. It seems, it was related to the time shift.
pkg-config was also not working back then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants