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

Error LNK1181 when USE_SHARED_MBEDTLS_LIBRARY CMake / MSVC #1130

Open
solvingj opened this issue Oct 8, 2017 · 19 comments
Open

Error LNK1181 when USE_SHARED_MBEDTLS_LIBRARY CMake / MSVC #1130

solvingj opened this issue Oct 8, 2017 · 19 comments
Labels
bug component-platform Portability layer and build scripts help-wanted This issue is not being actively worked on, but PRs welcome.

Comments

@solvingj
Copy link

solvingj commented Oct 8, 2017

Description

  • Type: Bug
  • Priority: Minor

Bug

OS
windows

mbed TLS build:
Version: 2.6.0 and 2.1.9
OS version: Windows 10
Visual studio version: 2017
Expected behavior
Should be able to build shared library.

Actual behavior

LINK : fatal error LNK1104: cannot open file 'Debug\mbedcrypto.lib' [C:\Users\jerry\git-c\mbedtls\build_shared\library\
mbedx509.vcxproj]

Steps to reproduce
Git clone or extract the latest release of this library. From the project root, do the following.

mkdir build
cd build
cmake -DENABLE_TESTING=Off -DUSE_SHARED_MBEDTLS_LIBRARY=On ..
cmake --build .
@RonEld
Copy link
Contributor

RonEld commented Oct 9, 2017

Hi @solvingj Thank you for reporting this issue!
Note that if you build from the root folder, you should not encounter this issue

@RonEld
Copy link
Contributor

RonEld commented Oct 9, 2017

Note that this is reproduced only when building a shared library.

@ciarmcom
Copy link

ciarmcom commented Oct 9, 2017

ARM Internal Ref: IOTSSL-1805

@solvingj
Copy link
Author

solvingj commented Oct 9, 2017

Hi @RonEld indeed it's a problem specific to building for shared. Also, I'm not sure how building it in the root would be relevant but I tried it anyway and got the same error.

I chatted with a C++ library expert from microsoft about it after opening this ticket. He tried to help fix the building of shared library, and ultimately indicated that building mbedTLS shared with MSVC is simply not possible the way it is currently set up. Here were some excerpts comments:

So MSVC requires __declspec(dllimport) on global variables imported from DLLs and they use a global function pointer to do some platform hiding stuff

So options are 1) apply dllimport or 2) twiddle the platform machinery to not dynamically link it like that. Applying dllimport usually means pain for consumers because they have to define macros to match the consumption type, etc etc.

I don't think this can be a DLL on windows unless they're willing to add dllexport/import or they change the global variables to function calls. Both of which are pretty invasive.

So, for maximum build progress use cmake -DENABLE_TESTING=Off -DUSE_SHARED_MBEDTLS_LIBRARY=On .. -DCMAKE_WINDOWS_EXPORT_ALL_SYMBOLS=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF and add add_definitions(/DMBEDTLS_PLATFORM_SNPRINTF_MACRO=snprintf) to the top of the main CMakeLists.txt

what's failing are the executables afaict. so it might be possible to build still if you disable the exes (or let it use the static form for that) and then make sure to use dllimport in your own code

@RonEld
Copy link
Contributor

RonEld commented Oct 9, 2017

Hi @solvingj Thanks for your input

Also, I'm not sure how building it in the root would be relevant but I tried it anyway and got the same error.

When doing the following from the Mbed TLS root directory( Don't forget to delete the CMakeCache.txt file):

cmake -DENABLE_TESTING=Off -DUSE_SHARED_MBEDTLS_LIBRARY=on  .
cmake --build .

I managed to make it successfully build. Please confirm.

As for the error itself, although it is a link error, I believe it should be related to the build of mbedx509.lib:

 LINK : fatal error LNK1104: cannot open file 'Debug\mbedcrypto.lib' [C:\Users\roneld01\work\mbedtls\build\library\mbedx509.vcxproj]

I think it is related to the line:

 target_link_libraries(mbedx509 ${libs} mbedcrypto)

and it is probably because the linker can't find mbedcrypto.lib

@solvingj
Copy link
Author

solvingj commented Oct 9, 2017

No, it doesn't work if i build from the clean project root. I get the same error as before. It's still unclear to me why you think that would make any difference, especially since it's bad practice to build in source like that.

Perhaps if you start from a clean source you'll reproduce the error.

Here is my complete log:

C:\Users\jerry\git-c>git clone git@github.com:ARMmbed/mbedtls.git
Cloning into 'mbedtls'...
Enter passphrase for key '/c/Users/jerry/.ssh/id_rsa':
remote: Counting objects: 47968, done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 47968 (delta 40), reused 44 (delta 22), pack-reused 47886
Receiving objects: 100% (47968/47968), 21.95 MiB | 944.00 KiB/s, done.
Resolving deltas: 100% (36648/36648), done.

C:\Users\jerry\git-c>cd mbedtls

C:\Users\jerry\git-c\mbedtls>cmake -DENABLE_TESTING=Off -DUSE_SHARED_MBEDTLS_LIBRARY=on  .
-- Building for: Visual Studio 15 2017
-- The C compiler identification is MSVC 19.11.25508.2
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Could NOT find Perl (missing:  PERL_EXECUTABLE)
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/jerry/git-c/mbedtls

C:\Users\jerry\git-c\mbedtls>cmake --build .
Microsoft (R) Build Engine version 15.3.409.57025 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 10/9/2017 11:34:41 AM.
Project "C:\Users\jerry\git-c\mbedtls\ALL_BUILD.vcxproj" on node 1 (default targets).
Project "C:\Users\jerry\git-c\mbedtls\ALL_BUILD.vcxproj" (1) is building "C:\Users\jerry\git-c\mbedtls\ZERO_CHECK.vcxpr
oj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Win32\Debug\ZERO_CHECK\".
  Creating directory "C:\Users\jerry\git-c\mbedtls\Debug\".
  Creating directory "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\".
InitializeBuildStatus:
  Creating "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Checking Build System
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/CMakeFiles/generate.stamp is up-to-date.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/library/CMakeFiles/generate.stamp is up-to-date.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/include/CMakeFiles/generate.stamp is up-to-date.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/CMakeFiles/generate.stamp is up-to-date.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/aes/CMakeFiles/generate.stamp is up-to-da
  te.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/hash/CMakeFiles/generate.stamp is up-to-d
  ate.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/pkey/CMakeFiles/generate.stamp is up-to-d
  ate.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/random/CMakeFiles/generate.stamp is up-to
  -date.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/ssl/CMakeFiles/generate.stamp is up-to-da
  te.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/test/CMakeFiles/generate.stamp is up-to-d
  ate.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/x509/CMakeFiles/generate.stamp is up-to-d
  ate.
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/programs/util/CMakeFiles/generate.stamp is up-to-d
  ate.
FinalizeBuildStatus:
  Deleting file "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
  Touching "Win32\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
CleanupEmptyRefsFolder:
  Removing directory "C:\Users\jerry\git-c\mbedtls\Debug\".
Done Building Project "C:\Users\jerry\git-c\mbedtls\ZERO_CHECK.vcxproj" (default targets).

Project "C:\Users\jerry\git-c\mbedtls\ALL_BUILD.vcxproj" (1) is building "C:\Users\jerry\git-c\mbedtls\programs\aes\aes
crypt2.vcxproj" (3) on node 1 (default targets).
Project "C:\Users\jerry\git-c\mbedtls\programs\aes\aescrypt2.vcxproj" (3) is building "C:\Users\jerry\git-c\mbedtls\lib
rary\mbedcrypto.vcxproj" (4) on node 1 (default targets).
PrepareForBuild:
  Creating directory "mbedcrypto.dir\Debug\".
  Creating directory "C:\Users\jerry\git-c\mbedtls\library\Debug\".
  Creating directory "mbedcrypto.dir\Debug\mbedcrypto.tlog\".
InitializeBuildStatus:
  Creating "mbedcrypto.dir\Debug\mbedcrypto.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/jerry/git-c/mbedtls/library/CMakeLists.txt
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/library/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\CL.exe /c /I"
  C:\Users\jerry\git-c\mbedtls\include" /Zi /nologo /W3 /WX /diagnostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D
  "CMAKE_INTDIR=\"Debug\"" /D mbedcrypto_EXPORTS /D _WINDLL /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:fo
  rScope /Zc:inline /Fo"mbedcrypto.dir\Debug\\" /Fd"mbedcrypto.dir\Debug\vc141.pdb" /Gd /TC /analyze- /errorReport:queu
  e "C:\Users\jerry\git-c\mbedtls\library\aes.c" "C:\Users\jerry\git-c\mbedtls\library\aesni.c" "C:\Users\jerry\git-c\m
  bedtls\library\arc4.c" "C:\Users\jerry\git-c\mbedtls\library\asn1parse.c" "C:\Users\jerry\git-c\mbedtls\library\asn1w
  rite.c" "C:\Users\jerry\git-c\mbedtls\library\base64.c" "C:\Users\jerry\git-c\mbedtls\library\bignum.c" "C:\Users\jer
  ry\git-c\mbedtls\library\blowfish.c" "C:\Users\jerry\git-c\mbedtls\library\camellia.c" "C:\Users\jerry\git-c\mbedtls\
  library\ccm.c" "C:\Users\jerry\git-c\mbedtls\library\cipher.c" "C:\Users\jerry\git-c\mbedtls\library\cipher_wrap.c" "
  C:\Users\jerry\git-c\mbedtls\library\cmac.c" "C:\Users\jerry\git-c\mbedtls\library\ctr_drbg.c" "C:\Users\jerry\git-c\
  mbedtls\library\des.c" "C:\Users\jerry\git-c\mbedtls\library\dhm.c" "C:\Users\jerry\git-c\mbedtls\library\ecdh.c" "C:
  \Users\jerry\git-c\mbedtls\library\ecdsa.c" "C:\Users\jerry\git-c\mbedtls\library\ecjpake.c" "C:\Users\jerry\git-c\mb
  edtls\library\ecp.c" "C:\Users\jerry\git-c\mbedtls\library\ecp_curves.c" "C:\Users\jerry\git-c\mbedtls\library\entrop
  y.c" "C:\Users\jerry\git-c\mbedtls\library\entropy_poll.c" "C:\Users\jerry\git-c\mbedtls\library\error.c" "C:\Users\j
  erry\git-c\mbedtls\library\gcm.c" "C:\Users\jerry\git-c\mbedtls\library\havege.c" "C:\Users\jerry\git-c\mbedtls\libra
  ry\hmac_drbg.c" "C:\Users\jerry\git-c\mbedtls\library\md.c" "C:\Users\jerry\git-c\mbedtls\library\md2.c" "C:\Users\je
  rry\git-c\mbedtls\library\md4.c" "C:\Users\jerry\git-c\mbedtls\library\md5.c" "C:\Users\jerry\git-c\mbedtls\library\m
  d_wrap.c" "C:\Users\jerry\git-c\mbedtls\library\memory_buffer_alloc.c" "C:\Users\jerry\git-c\mbedtls\library\oid.c" "
  C:\Users\jerry\git-c\mbedtls\library\padlock.c" "C:\Users\jerry\git-c\mbedtls\library\pem.c" "C:\Users\jerry\git-c\mb
  edtls\library\pk.c" "C:\Users\jerry\git-c\mbedtls\library\pk_wrap.c" "C:\Users\jerry\git-c\mbedtls\library\pkcs12.c"
  "C:\Users\jerry\git-c\mbedtls\library\pkcs5.c" "C:\Users\jerry\git-c\mbedtls\library\pkparse.c" "C:\Users\jerry\git-c
  \mbedtls\library\pkwrite.c" "C:\Users\jerry\git-c\mbedtls\library\platform.c" "C:\Users\jerry\git-c\mbedtls\library\r
  ipemd160.c" "C:\Users\jerry\git-c\mbedtls\library\rsa.c" "C:\Users\jerry\git-c\mbedtls\library\sha1.c" "C:\Users\jerr
  y\git-c\mbedtls\library\sha256.c" "C:\Users\jerry\git-c\mbedtls\library\sha512.c" "C:\Users\jerry\git-c\mbedtls\libra
  ry\threading.c" "C:\Users\jerry\git-c\mbedtls\library\timing.c" "C:\Users\jerry\git-c\mbedtls\library\version.c" "C:\
  Users\jerry\git-c\mbedtls\library\version_features.c" "C:\Users\jerry\git-c\mbedtls\library\xtea.c"
  aes.c
  aesni.c
  arc4.c
  asn1parse.c
  asn1write.c
  base64.c
  bignum.c
  blowfish.c
  camellia.c
  ccm.c
  cipher.c
  cipher_wrap.c
  cmac.c
  ctr_drbg.c
  des.c
  dhm.c
  ecdh.c
  ecdsa.c
  ecjpake.c
  ecp.c
  Generating Code...
  Compiling...
  ecp_curves.c
  entropy.c
  entropy_poll.c
  error.c
  gcm.c
  havege.c
  hmac_drbg.c
  md.c
  md2.c
  md4.c
  md5.c
  md_wrap.c
  memory_buffer_alloc.c
  oid.c
  padlock.c
  pem.c
  pk.c
  pk_wrap.c
  pkcs12.c
  pkcs5.c
  Generating Code...
  Compiling...
  pkparse.c
  pkwrite.c
  platform.c
  ripemd160.c
  rsa.c
  sha1.c
  sha256.c
  sha512.c
  threading.c
  timing.c
  version.c
  version_features.c
  xtea.c
  Generating Code...
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\link.exe /ERR
  ORREPORT:QUEUE /OUT:"C:\Users\jerry\git-c\mbedtls\library\Debug\mbedcrypto.dll" /INCREMENTAL /NOLOGO kernel32.lib use
  r32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ws2_32.lib /MANI
  FEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/Users/jerry/git-c/mbedtls/libr
  ary/Debug/mbedcrypto.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/Users/jerry/git-c/mbedtls/li
  brary/Debug/mbedcrypto.lib" /MACHINE:X86 /SAFESEH   /machine:X86 /DLL mbedcrypto.dir\Debug\aes.obj
  mbedcrypto.dir\Debug\aesni.obj
  mbedcrypto.dir\Debug\arc4.obj
  mbedcrypto.dir\Debug\asn1parse.obj
  mbedcrypto.dir\Debug\asn1write.obj
  mbedcrypto.dir\Debug\base64.obj
  mbedcrypto.dir\Debug\bignum.obj
  mbedcrypto.dir\Debug\blowfish.obj
  mbedcrypto.dir\Debug\camellia.obj
  mbedcrypto.dir\Debug\ccm.obj
  mbedcrypto.dir\Debug\cipher.obj
  mbedcrypto.dir\Debug\cipher_wrap.obj
  mbedcrypto.dir\Debug\cmac.obj
  mbedcrypto.dir\Debug\ctr_drbg.obj
  mbedcrypto.dir\Debug\des.obj
  mbedcrypto.dir\Debug\dhm.obj
  mbedcrypto.dir\Debug\ecdh.obj
  mbedcrypto.dir\Debug\ecdsa.obj
  mbedcrypto.dir\Debug\ecjpake.obj
  mbedcrypto.dir\Debug\ecp.obj
  mbedcrypto.dir\Debug\ecp_curves.obj
  mbedcrypto.dir\Debug\entropy.obj
  mbedcrypto.dir\Debug\entropy_poll.obj
  mbedcrypto.dir\Debug\error.obj
  mbedcrypto.dir\Debug\gcm.obj
  mbedcrypto.dir\Debug\havege.obj
  mbedcrypto.dir\Debug\hmac_drbg.obj
  mbedcrypto.dir\Debug\md.obj
  mbedcrypto.dir\Debug\md2.obj
  mbedcrypto.dir\Debug\md4.obj
  mbedcrypto.dir\Debug\md5.obj
  mbedcrypto.dir\Debug\md_wrap.obj
  mbedcrypto.dir\Debug\memory_buffer_alloc.obj
  mbedcrypto.dir\Debug\oid.obj
  mbedcrypto.dir\Debug\padlock.obj
  mbedcrypto.dir\Debug\pem.obj
  mbedcrypto.dir\Debug\pk.obj
  mbedcrypto.dir\Debug\pk_wrap.obj
  mbedcrypto.dir\Debug\pkcs12.obj
  mbedcrypto.dir\Debug\pkcs5.obj
  mbedcrypto.dir\Debug\pkparse.obj
  mbedcrypto.dir\Debug\pkwrite.obj
  mbedcrypto.dir\Debug\platform.obj
  mbedcrypto.dir\Debug\ripemd160.obj
  mbedcrypto.dir\Debug\rsa.obj
  mbedcrypto.dir\Debug\sha1.obj
  mbedcrypto.dir\Debug\sha256.obj
  mbedcrypto.dir\Debug\sha512.obj
  mbedcrypto.dir\Debug\threading.obj
  mbedcrypto.dir\Debug\timing.obj
  mbedcrypto.dir\Debug\version.obj
  mbedcrypto.dir\Debug\version_features.obj
  mbedcrypto.dir\Debug\xtea.obj
  mbedcrypto.vcxproj -> C:\Users\jerry\git-c\mbedtls\library\Debug\mbedcrypto.dll
FinalizeBuildStatus:
  Deleting file "mbedcrypto.dir\Debug\mbedcrypto.tlog\unsuccessfulbuild".
  Touching "mbedcrypto.dir\Debug\mbedcrypto.tlog\mbedcrypto.lastbuildstate".
Done Building Project "C:\Users\jerry\git-c\mbedtls\library\mbedcrypto.vcxproj" (default targets).

Project "C:\Users\jerry\git-c\mbedtls\programs\aes\aescrypt2.vcxproj" (3) is building "C:\Users\jerry\git-c\mbedtls\lib
rary\mbedtls.vcxproj" (5) on node 1 (default targets).
Project "C:\Users\jerry\git-c\mbedtls\library\mbedtls.vcxproj" (5) is building "C:\Users\jerry\git-c\mbedtls\library\mb
edx509.vcxproj" (6) on node 1 (default targets).
PrepareForBuild:
  Creating directory "mbedx509.dir\Debug\".
  Creating directory "mbedx509.dir\Debug\mbedx509.tlog\".
InitializeBuildStatus:
  Creating "mbedx509.dir\Debug\mbedx509.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/jerry/git-c/mbedtls/library/CMakeLists.txt
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/library/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\CL.exe /c /I"
  C:\Users\jerry\git-c\mbedtls\include" /Zi /nologo /W3 /WX /diagnostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D
  "CMAKE_INTDIR=\"Debug\"" /D mbedx509_EXPORTS /D _WINDLL /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forS
  cope /Zc:inline /Fo"mbedx509.dir\Debug\\" /Fd"mbedx509.dir\Debug\vc141.pdb" /Gd /TC /analyze- /errorReport:queue "C:\
  Users\jerry\git-c\mbedtls\library\certs.c" "C:\Users\jerry\git-c\mbedtls\library\pkcs11.c" "C:\Users\jerry\git-c\mbed
  tls\library\x509.c" "C:\Users\jerry\git-c\mbedtls\library\x509_create.c" "C:\Users\jerry\git-c\mbedtls\library\x509_c
  rl.c" "C:\Users\jerry\git-c\mbedtls\library\x509_crt.c" "C:\Users\jerry\git-c\mbedtls\library\x509_csr.c" "C:\Users\j
  erry\git-c\mbedtls\library\x509write_crt.c" "C:\Users\jerry\git-c\mbedtls\library\x509write_csr.c"
  certs.c
  pkcs11.c
  x509.c
  x509_create.c
  x509_crl.c
  x509_crt.c
  x509_csr.c
  x509write_crt.c
  x509write_csr.c
  Generating Code...
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\link.exe /ERR
  ORREPORT:QUEUE /OUT:"C:\Users\jerry\git-c\mbedtls\library\Debug\mbedx509.dll" /INCREMENTAL /NOLOGO kernel32.lib user3
  2.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ws2_32.lib Debug\m
  bedcrypto.lib ws2_32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG /PDB:"C:/
  Users/jerry/git-c/mbedtls/library/Debug/mbedx509.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"C:/
  Users/jerry/git-c/mbedtls/library/Debug/mbedx509.lib" /MACHINE:X86 /SAFESEH   /machine:X86 /DLL mbedx509.dir\Debug\ce
  rts.obj
  mbedx509.dir\Debug\pkcs11.obj
  mbedx509.dir\Debug\x509.obj
  mbedx509.dir\Debug\x509_create.obj
  mbedx509.dir\Debug\x509_crl.obj
  mbedx509.dir\Debug\x509_crt.obj
  mbedx509.dir\Debug\x509_csr.obj
  mbedx509.dir\Debug\x509write_crt.obj
  mbedx509.dir\Debug\x509write_csr.obj
LINK : fatal error LNK1104: cannot open file 'Debug\mbedcrypto.lib' [C:\Users\jerry\git-c\mbedtls\library\mbedx509.vcxp
roj]
Done Building Project "C:\Users\jerry\git-c\mbedtls\library\mbedx509.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\Users\jerry\git-c\mbedtls\library\mbedtls.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\Users\jerry\git-c\mbedtls\programs\aes\aescrypt2.vcxproj" (default targets) -- FAILED.

Project "C:\Users\jerry\git-c\mbedtls\ALL_BUILD.vcxproj" (1) is building "C:\Users\jerry\git-c\mbedtls\library\mbedcryp
to_static.vcxproj" (28) on node 1 (default targets).
PrepareForBuild:
  Creating directory "mbedcrypto_static.dir\Debug\".
  Creating directory "mbedcrypto_static.dir\Debug\mbedcryp.0BFEAE33.tlog\".
InitializeBuildStatus:
  Creating "mbedcrypto_static.dir\Debug\mbedcryp.0BFEAE33.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/jerry/git-c/mbedtls/library/CMakeLists.txt
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/library/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\CL.exe /c /I"
  C:\Users\jerry\git-c\mbedtls\include" /Zi /nologo /W3 /WX /diagnostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D
  "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"mbedcrypto_
  static.dir\Debug\\" /Fd"mbedcrypto_static.dir\Debug\mbedcrypto_static.pdb" /Gd /TC /analyze- /errorReport:queue "C:\U
  sers\jerry\git-c\mbedtls\library\aes.c" "C:\Users\jerry\git-c\mbedtls\library\aesni.c" "C:\Users\jerry\git-c\mbedtls\
  library\arc4.c" "C:\Users\jerry\git-c\mbedtls\library\asn1parse.c" "C:\Users\jerry\git-c\mbedtls\library\asn1write.c"
   "C:\Users\jerry\git-c\mbedtls\library\base64.c" "C:\Users\jerry\git-c\mbedtls\library\bignum.c" "C:\Users\jerry\git-
  c\mbedtls\library\blowfish.c" "C:\Users\jerry\git-c\mbedtls\library\camellia.c" "C:\Users\jerry\git-c\mbedtls\library
  \ccm.c" "C:\Users\jerry\git-c\mbedtls\library\cipher.c" "C:\Users\jerry\git-c\mbedtls\library\cipher_wrap.c" "C:\User
  s\jerry\git-c\mbedtls\library\cmac.c" "C:\Users\jerry\git-c\mbedtls\library\ctr_drbg.c" "C:\Users\jerry\git-c\mbedtls
  \library\des.c" "C:\Users\jerry\git-c\mbedtls\library\dhm.c" "C:\Users\jerry\git-c\mbedtls\library\ecdh.c" "C:\Users\
  jerry\git-c\mbedtls\library\ecdsa.c" "C:\Users\jerry\git-c\mbedtls\library\ecjpake.c" "C:\Users\jerry\git-c\mbedtls\l
  ibrary\ecp.c" "C:\Users\jerry\git-c\mbedtls\library\ecp_curves.c" "C:\Users\jerry\git-c\mbedtls\library\entropy.c" "C
  :\Users\jerry\git-c\mbedtls\library\entropy_poll.c" "C:\Users\jerry\git-c\mbedtls\library\error.c" "C:\Users\jerry\gi
  t-c\mbedtls\library\gcm.c" "C:\Users\jerry\git-c\mbedtls\library\havege.c" "C:\Users\jerry\git-c\mbedtls\library\hmac
  _drbg.c" "C:\Users\jerry\git-c\mbedtls\library\md.c" "C:\Users\jerry\git-c\mbedtls\library\md2.c" "C:\Users\jerry\git
  -c\mbedtls\library\md4.c" "C:\Users\jerry\git-c\mbedtls\library\md5.c" "C:\Users\jerry\git-c\mbedtls\library\md_wrap.
  c" "C:\Users\jerry\git-c\mbedtls\library\memory_buffer_alloc.c" "C:\Users\jerry\git-c\mbedtls\library\oid.c" "C:\User
  s\jerry\git-c\mbedtls\library\padlock.c" "C:\Users\jerry\git-c\mbedtls\library\pem.c" "C:\Users\jerry\git-c\mbedtls\l
  ibrary\pk.c" "C:\Users\jerry\git-c\mbedtls\library\pk_wrap.c" "C:\Users\jerry\git-c\mbedtls\library\pkcs12.c" "C:\Use
  rs\jerry\git-c\mbedtls\library\pkcs5.c" "C:\Users\jerry\git-c\mbedtls\library\pkparse.c" "C:\Users\jerry\git-c\mbedtl
  s\library\pkwrite.c" "C:\Users\jerry\git-c\mbedtls\library\platform.c" "C:\Users\jerry\git-c\mbedtls\library\ripemd16
  0.c" "C:\Users\jerry\git-c\mbedtls\library\rsa.c" "C:\Users\jerry\git-c\mbedtls\library\sha1.c" "C:\Users\jerry\git-c
  \mbedtls\library\sha256.c" "C:\Users\jerry\git-c\mbedtls\library\sha512.c" "C:\Users\jerry\git-c\mbedtls\library\thre
  ading.c" "C:\Users\jerry\git-c\mbedtls\library\timing.c" "C:\Users\jerry\git-c\mbedtls\library\version.c" "C:\Users\j
  erry\git-c\mbedtls\library\version_features.c" "C:\Users\jerry\git-c\mbedtls\library\xtea.c"
  aes.c
  aesni.c
  arc4.c
  asn1parse.c
  asn1write.c
  base64.c
  bignum.c
  blowfish.c
  camellia.c
  ccm.c
  cipher.c
  cipher_wrap.c
  cmac.c
  ctr_drbg.c
  des.c
  dhm.c
  ecdh.c
  ecdsa.c
  ecjpake.c
  ecp.c
  Generating Code...
  Compiling...
  ecp_curves.c
  entropy.c
  entropy_poll.c
  error.c
  gcm.c
  havege.c
  hmac_drbg.c
  md.c
  md2.c
  md4.c
  md5.c
  md_wrap.c
  memory_buffer_alloc.c
  oid.c
  padlock.c
  pem.c
  pk.c
  pk_wrap.c
  pkcs12.c
  pkcs5.c
  Generating Code...
  Compiling...
  pkparse.c
  pkwrite.c
  platform.c
  ripemd160.c
  rsa.c
  sha1.c
  sha256.c
  sha512.c
  threading.c
  timing.c
  version.c
  version_features.c
  xtea.c
  Generating Code...
Lib:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\Lib.exe /OUT:
  "C:\Users\jerry\git-c\mbedtls\library\Debug\mbedcrypto.lib" /NOLOGO   /machine:X86 mbedcrypto_static.dir\Debug\aes.ob
  j
  mbedcrypto_static.dir\Debug\aesni.obj
  mbedcrypto_static.dir\Debug\arc4.obj
  mbedcrypto_static.dir\Debug\asn1parse.obj
  mbedcrypto_static.dir\Debug\asn1write.obj
  mbedcrypto_static.dir\Debug\base64.obj
  mbedcrypto_static.dir\Debug\bignum.obj
  mbedcrypto_static.dir\Debug\blowfish.obj
  mbedcrypto_static.dir\Debug\camellia.obj
  mbedcrypto_static.dir\Debug\ccm.obj
  mbedcrypto_static.dir\Debug\cipher.obj
  mbedcrypto_static.dir\Debug\cipher_wrap.obj
  mbedcrypto_static.dir\Debug\cmac.obj
  mbedcrypto_static.dir\Debug\ctr_drbg.obj
  mbedcrypto_static.dir\Debug\des.obj
  mbedcrypto_static.dir\Debug\dhm.obj
  mbedcrypto_static.dir\Debug\ecdh.obj
  mbedcrypto_static.dir\Debug\ecdsa.obj
  mbedcrypto_static.dir\Debug\ecjpake.obj
  mbedcrypto_static.dir\Debug\ecp.obj
  mbedcrypto_static.dir\Debug\ecp_curves.obj
  mbedcrypto_static.dir\Debug\entropy.obj
  mbedcrypto_static.dir\Debug\entropy_poll.obj
  mbedcrypto_static.dir\Debug\error.obj
  mbedcrypto_static.dir\Debug\gcm.obj
  mbedcrypto_static.dir\Debug\havege.obj
  mbedcrypto_static.dir\Debug\hmac_drbg.obj
  mbedcrypto_static.dir\Debug\md.obj
  mbedcrypto_static.dir\Debug\md2.obj
  mbedcrypto_static.dir\Debug\md4.obj
  mbedcrypto_static.dir\Debug\md5.obj
  mbedcrypto_static.dir\Debug\md_wrap.obj
  mbedcrypto_static.dir\Debug\memory_buffer_alloc.obj
  mbedcrypto_static.dir\Debug\oid.obj
  mbedcrypto_static.dir\Debug\padlock.obj
  mbedcrypto_static.dir\Debug\pem.obj
  mbedcrypto_static.dir\Debug\pk.obj
  mbedcrypto_static.dir\Debug\pk_wrap.obj
  mbedcrypto_static.dir\Debug\pkcs12.obj
  mbedcrypto_static.dir\Debug\pkcs5.obj
  mbedcrypto_static.dir\Debug\pkparse.obj
  mbedcrypto_static.dir\Debug\pkwrite.obj
  mbedcrypto_static.dir\Debug\platform.obj
  mbedcrypto_static.dir\Debug\ripemd160.obj
  mbedcrypto_static.dir\Debug\rsa.obj
  mbedcrypto_static.dir\Debug\sha1.obj
  mbedcrypto_static.dir\Debug\sha256.obj
  mbedcrypto_static.dir\Debug\sha512.obj
  mbedcrypto_static.dir\Debug\threading.obj
  mbedcrypto_static.dir\Debug\timing.obj
  mbedcrypto_static.dir\Debug\version.obj
  mbedcrypto_static.dir\Debug\version_features.obj
  mbedcrypto_static.dir\Debug\xtea.obj
  mbedcrypto_static.vcxproj -> C:\Users\jerry\git-c\mbedtls\library\Debug\mbedcrypto.lib
FinalizeBuildStatus:
  Deleting file "mbedcrypto_static.dir\Debug\mbedcryp.0BFEAE33.tlog\unsuccessfulbuild".
  Touching "mbedcrypto_static.dir\Debug\mbedcryp.0BFEAE33.tlog\mbedcrypto_static.lastbuildstate".
Done Building Project "C:\Users\jerry\git-c\mbedtls\library\mbedcrypto_static.vcxproj" (default targets).

Project "C:\Users\jerry\git-c\mbedtls\ALL_BUILD.vcxproj" (1) is building "C:\Users\jerry\git-c\mbedtls\library\mbedtls_
static.vcxproj" (29) on node 1 (default targets).
Project "C:\Users\jerry\git-c\mbedtls\library\mbedtls_static.vcxproj" (29) is building "C:\Users\jerry\git-c\mbedtls\li
brary\mbedx509_static.vcxproj" (30) on node 1 (default targets).
PrepareForBuild:
  Creating directory "mbedx509_static.dir\Debug\".
  Creating directory "mbedx509_static.dir\Debug\mbedx509_static.tlog\".
InitializeBuildStatus:
  Creating "mbedx509_static.dir\Debug\mbedx509_static.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/jerry/git-c/mbedtls/library/CMakeLists.txt
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/library/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\CL.exe /c /I"
  C:\Users\jerry\git-c\mbedtls\include" /Zi /nologo /W3 /WX /diagnostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D
  "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"mbedx509_st
  atic.dir\Debug\\" /Fd"mbedx509_static.dir\Debug\mbedx509_static.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\j
  erry\git-c\mbedtls\library\certs.c" "C:\Users\jerry\git-c\mbedtls\library\pkcs11.c" "C:\Users\jerry\git-c\mbedtls\lib
  rary\x509.c" "C:\Users\jerry\git-c\mbedtls\library\x509_create.c" "C:\Users\jerry\git-c\mbedtls\library\x509_crl.c" "
  C:\Users\jerry\git-c\mbedtls\library\x509_crt.c" "C:\Users\jerry\git-c\mbedtls\library\x509_csr.c" "C:\Users\jerry\gi
  t-c\mbedtls\library\x509write_crt.c" "C:\Users\jerry\git-c\mbedtls\library\x509write_csr.c"
  certs.c
  pkcs11.c
  x509.c
  x509_create.c
  x509_crl.c
  x509_crt.c
  x509_csr.c
  x509write_crt.c
  x509write_csr.c
  Generating Code...
Lib:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\Lib.exe /OUT:
  "C:\Users\jerry\git-c\mbedtls\library\Debug\mbedx509.lib" /NOLOGO   /machine:X86 mbedx509_static.dir\Debug\certs.obj
  mbedx509_static.dir\Debug\pkcs11.obj
  mbedx509_static.dir\Debug\x509.obj
  mbedx509_static.dir\Debug\x509_create.obj
  mbedx509_static.dir\Debug\x509_crl.obj
  mbedx509_static.dir\Debug\x509_crt.obj
  mbedx509_static.dir\Debug\x509_csr.obj
  mbedx509_static.dir\Debug\x509write_crt.obj
  mbedx509_static.dir\Debug\x509write_csr.obj
  mbedx509_static.vcxproj -> C:\Users\jerry\git-c\mbedtls\library\Debug\mbedx509.lib
FinalizeBuildStatus:
  Deleting file "mbedx509_static.dir\Debug\mbedx509_static.tlog\unsuccessfulbuild".
  Touching "mbedx509_static.dir\Debug\mbedx509_static.tlog\mbedx509_static.lastbuildstate".
Done Building Project "C:\Users\jerry\git-c\mbedtls\library\mbedx509_static.vcxproj" (default targets).

PrepareForBuild:
  Creating directory "mbedtls_static.dir\Debug\".
  Creating directory "mbedtls_static.dir\Debug\mbedtls_static.tlog\".
InitializeBuildStatus:
  Creating "mbedtls_static.dir\Debug\mbedtls_static.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Building Custom Rule C:/Users/jerry/git-c/mbedtls/library/CMakeLists.txt
  CMake does not need to re-run because C:/Users/jerry/git-c/mbedtls/library/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\CL.exe /c /I"
  C:\Users\jerry\git-c\mbedtls\include" /Zi /nologo /W3 /WX /diagnostics:classic /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D
  "CMAKE_INTDIR=\"Debug\"" /D _MBCS /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"mbedtls_sta
  tic.dir\Debug\\" /Fd"mbedtls_static.dir\Debug\mbedtls_static.pdb" /Gd /TC /analyze- /errorReport:queue "C:\Users\jerr
  y\git-c\mbedtls\library\debug.c" "C:\Users\jerry\git-c\mbedtls\library\net_sockets.c" "C:\Users\jerry\git-c\mbedtls\l
  ibrary\ssl_cache.c" "C:\Users\jerry\git-c\mbedtls\library\ssl_ciphersuites.c" "C:\Users\jerry\git-c\mbedtls\library\s
  sl_cli.c" "C:\Users\jerry\git-c\mbedtls\library\ssl_cookie.c" "C:\Users\jerry\git-c\mbedtls\library\ssl_srv.c" "C:\Us
  ers\jerry\git-c\mbedtls\library\ssl_ticket.c" "C:\Users\jerry\git-c\mbedtls\library\ssl_tls.c"
  debug.c
  net_sockets.c
  ssl_cache.c
  ssl_ciphersuites.c
  ssl_cli.c
  ssl_cookie.c
  ssl_srv.c
  ssl_ticket.c
  ssl_tls.c
  Generating Code...
Lib:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\bin\HostX86\x86\Lib.exe /OUT:
  "C:\Users\jerry\git-c\mbedtls\library\Debug\mbedtls.lib" /NOLOGO   /machine:X86 mbedtls_static.dir\Debug\debug.obj
  mbedtls_static.dir\Debug\net_sockets.obj
  mbedtls_static.dir\Debug\ssl_cache.obj
  mbedtls_static.dir\Debug\ssl_ciphersuites.obj
  mbedtls_static.dir\Debug\ssl_cli.obj
  mbedtls_static.dir\Debug\ssl_cookie.obj
  mbedtls_static.dir\Debug\ssl_srv.obj
  mbedtls_static.dir\Debug\ssl_ticket.obj
  mbedtls_static.dir\Debug\ssl_tls.obj
  mbedtls_static.vcxproj -> C:\Users\jerry\git-c\mbedtls\library\Debug\mbedtls.lib
FinalizeBuildStatus:
  Deleting file "mbedtls_static.dir\Debug\mbedtls_static.tlog\unsuccessfulbuild".
  Touching "mbedtls_static.dir\Debug\mbedtls_static.tlog\mbedtls_static.lastbuildstate".
Done Building Project "C:\Users\jerry\git-c\mbedtls\library\mbedtls_static.vcxproj" (default targets).

Done Building Project "C:\Users\jerry\git-c\mbedtls\ALL_BUILD.vcxproj" (default targets) -- FAILED.


Build FAILED.

"C:\Users\jerry\git-c\mbedtls\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\jerry\git-c\mbedtls\programs\aes\aescrypt2.vcxproj" (default target) (3) ->
"C:\Users\jerry\git-c\mbedtls\library\mbedtls.vcxproj" (default target) (5) ->
"C:\Users\jerry\git-c\mbedtls\library\mbedx509.vcxproj" (default target) (6) ->
(Link target) ->
  LINK : fatal error LNK1104: cannot open file 'Debug\mbedcrypto.lib' [C:\Users\jerry\git-c\mbedtls\library\mbedx509.vc
xproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:16.39

@RonEld
Copy link
Contributor

RonEld commented Oct 9, 2017

Hi @solvingj
I have created a PR in #1133 that fixed the issue for me
Please confirm on your side

@solvingj
Copy link
Author

solvingj commented Oct 9, 2017

@RonEld the bad news is that doesn't fix the problem. The good news is that I got lucky through trial and error and made some progress. I can get the build to succeed if I just run it twice in a row. This indicates that the file Debug\mbedcrypto.lib is either generated out of order, or it's somehow locked by the build system in a state where it can't be linked when it needs to.

@solvingj
Copy link
Author

solvingj commented Oct 9, 2017

Of note, the PR you submitted is irrelevant to this issue.

@RonEld
Copy link
Contributor

RonEld commented Oct 10, 2017

Hi @solvingj Thanks for your information.
It is strange, because I reproduced the issue, and it was fixed with my PR. Perhaps two issues caused same symptom.. The only difference is that I am working on VS2015

@ericroy
Copy link

ericroy commented Nov 4, 2018

I can confirm that this is an issue in mbedtls 2.13.0, using the VS2017 cmake generated projects. It fails only on the first build attempt after project generation. Reattempting the build succeeds.

Interestingly enough, the cmake generated NMake projects seem to succeed without issue.

@simonbutcher
Copy link
Contributor

@ericroy - Can you comment as to whether @RonEld's PR #1130 helped fix the issue?

@RonEld RonEld added the component-platform Portability layer and build scripts label Feb 17, 2019
@RonEld RonEld added tracking archived Do not use - historically applied to archived issues help-wanted This issue is not being actively worked on, but PRs welcome. and removed tracking help-wanted This issue is not being actively worked on, but PRs welcome. labels Jun 13, 2019
@RonEld RonEld closed this as completed Jun 13, 2019
@zengxs
Copy link

zengxs commented Apr 5, 2020

Occurs the same issue, (mbedtls 2.16.5)

I found must build shared library by specific order,
because mbedx509 shared library depends mbedcrypto static library, and mbedtls shared library depends mbedx509 static library.

so must build static libraries first and then build shared libraries:

# must enable `USE_SHARED_MBEDTLS_LIBRARY` and `USE_STATIC_MBEDTLS_LIBRARY` at the same time
cmake . -D USE_STATIC_MBEDTLS_LIBRARY=ON -D USE_SHARED_MBEDTLS_LIBRARY=ON
cmake --build . -t mbedcrypto  # generate mbedcrypto.dll
cmake --build . -t mbedcrypto_static  # generate mbedcrypto.lib
cmake --build . -t mbedx509  # generate mbedx509.dll (depends mbedcrypto.lib)
cmake --build . -t mbedx509_static  # generate mbedx509.lib
cmake --build . -t mbedtls  # generate mbedtls.dll (depends mbedx509.lib)
cmake --build . -t mbedtls_static  # generate mbedtls.lib

My environment:

  • Visual Studio 2017
  • Windows 10 (1909)
  • CMake 3.17.0

@827Dream
Copy link

827Dream commented Aug 7, 2022

it can success but dll donot have export table..

@dan-masek
Copy link

This is still broken in 3.2.1 -- it only links by accident, since the static libraries and shared libraries both have the same name (so instead of linking shared to shared, it links shared to static). That also explains why it sometimes "works" on the second attempt (there is no dependency chain defined between the static and shared -- understandingly -- so the lib files don't necessarily get built in time). It becomes really evident when you explicitly disable static libs and only try to build shared -- in that case it never succeeds.

@gilles-peskine-arm
Copy link
Contributor

I'm reopening this issue since the problem is still present.

Note that this issue is solely about building the shared libraries. A DLL export table is a different topic and out of scope here.

If you know how to fix this, please submit a fix, and, preferably, add something to the CI scripts that would catch the problem. If this can be reproduced with MingW, the preferred way to test is in component_build_mingw in tests/scripts/all.sh. If this needs MSVC, the main Windows test scripts is windows_testing.py in the mbedtls-test repository.

@gilles-peskine-arm gilles-peskine-arm removed the archived Do not use - historically applied to archived issues label Nov 27, 2022
@dan-masek
Copy link

@gilles-peskine-arm I'll see if I can look at it when I have time. Right now I just need a dependency for another dependency that can build on windows (and all that to be able to do some time-critical work), and static will work OK for now. Just wanted to mention my observations.

I have a feeling, tho, that without exports there's not really a way to make this behave as it (IMHO) should.

@pkviet
Copy link

pkviet commented Apr 1, 2023

We're still hit by this bug w/ 3.4.0 on msvc. There's no such bug if one cross compiles with mingw on linux. It's hard to believe that such a bug has been around for such a long time. Unfortunately I have no clear idea on a fix.

@heheda123123
Copy link

heheda123123 commented Nov 15, 2023

3.5.1 still has this problem, unable to generate the import library lib required for the dll in windows.

facebook-github-bot pushed a commit to facebookresearch/ocean that referenced this issue May 23, 2024
Summary:
Issue Mbed-TLS/mbedtls#1130 was opened in 2017. The last comment on the issue from 11/2023 reports "still a problem".

Defining CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS will export function symbols to a DLL, but there are some .c and .h changes necessary to export global variables. See https://cmake.org/cmake/help/latest/prop_tgt/WINDOWS_EXPORT_ALL_SYMBOLS.html.

Also, we upgrade from mbedtls 3.5.2 to 3.6.0.

Reviewed By: enpe

Differential Revision: D57745357

fbshipit-source-id: ab5e5c357fddd7df41259d9282a5d3cb653fea8d
thomas43 pushed a commit to aja-video/mbedtls that referenced this issue Jun 7, 2024
thomas43 pushed a commit to aja-video/mbedtls that referenced this issue Jun 7, 2024
thomas43 pushed a commit to aja-video/mbedtls that referenced this issue Jun 8, 2024
thomas43 pushed a commit to aja-video/mbedtls that referenced this issue Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-platform Portability layer and build scripts help-wanted This issue is not being actively worked on, but PRs welcome.
Projects
None yet
Development

No branches or pull requests