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

Fixing the parameters when using dynamic mbedtls lib #2830

Closed
wants to merge 10 commits into from

Conversation

heheda123123
Copy link
Contributor

编译mbedtls动态库的时候一直出来静态库,看了下CMakeLists.txt,之前用的参数错了
image

@waruqi
Copy link
Member

waruqi commented Nov 15, 2023

动态库失败了,好像符号没被导出,可以看下有没有导出的配置,或者让 cmake 强制导出下

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The dynamic library failed. It seems that the symbols were not exported. You can check whether there is any exported configuration, or ask cmake to force the export.

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Changed to version 3.5.1, and now both static and shared have failed.
My local environment is windows-2022, and both dynamic and static libraries can be compiled successfully.

@heheda123123
Copy link
Contributor Author

heheda123123 commented Nov 15, 2023

静态库失败,加上bcrypt就行。动态库失败好像是官方的bug,一直没修复
可以生成dll,但是没有导入库lib
Mbed-TLS/mbedtls#1130

@heheda123123
Copy link
Contributor Author

heheda123123 commented Nov 15, 2023

动态库失败了,好像符号没被导出,可以看下有没有导出的配置,或者让 cmake 强制导出下

大佬,现在是设置了在windows上只能用静态库。cmake怎么强制导出呢
另外,如果同时开启编译静态库和动态库,编译出来的dll还真是没有导出符号
image

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The dynamic library failed. It seems that the symbols were not exported. You can check whether there is any exported configuration, or ask cmake to force the export.

Boss, how can cmake force export?

@luciouskami
Copy link

动态库失败了,好像符号没被导出,可以看下有没有导出的配置,或者让 cmake 强制导出下

大佬,现在是设置了在windows上只能用静态库。cmake怎么强制导出呢 另外,如果同时开启编译静态库和动态库,编译出来的dll还真是没有导出符号 image

那你得用CMake生成两个配置

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The dynamic library failed. It seems that the symbols were not exported. You can check whether there is any exported configuration, or ask cmake to force the export.

Boss, now it is set up that only static libraries can be used on Windows. How does cmake force export? In addition, if you enable compilation of static libraries and dynamic libraries at the same time, the compiled dll really has no export symbols! [image](https://user-images.githubusercontent.com/97490782/283125207-162c1f56-e922 -4da1-b925-74fffefa58ce.png)

Then you have to use CMake to generate two configurations

@heheda123123
Copy link
Contributor Author

动态库失败了,好像符号没被导出,可以看下有没有导出的配置,或者让 cmake 强制导出下

大佬,现在是设置了在windows上只能用静态库。cmake怎么强制导出呢 另外,如果同时开启编译静态库和动态库,编译出来的dll还真是没有导出符号 image

那你得用CMake生成两个配置

啥意思没看懂,大佬直接改下pr吧

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


The dynamic library failed. It seems that the symbols were not exported. You can check whether there is any exported configuration, or ask cmake to force the export.

Boss, now it is set that only static libraries can be used on Windows. How does cmake force export? In addition, if you enable compilation of static libraries and dynamic libraries at the same time, the compiled dll really has no export symbols! [image](https://user-images.githubusercontent.com/97490782/283125207-162c1f56-e922 -4da1-b925-74fffefa58ce.png)

Then you have to use CMake to generate two configurations

I don’t understand what it means, please just change the PR

@waruqi
Copy link
Member

waruqi commented Nov 15, 2023

我没时间,参考其他包 ,走 CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 强制导出。。这是最后的 fallback 方案。。

一般这种库,肯定有内部的导出宏配置,可以翻下源码 开启下。。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I don't have time, so refer to other packages and use CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to force export. . This is the final fallback solution. .

Generally, this kind of library must have internal export macro configuration, which can be opened by opening the source code. .

@heheda123123
Copy link
Contributor Author

试了下搞不定。要不就先现在这样好了, 已经设置了windows上shared是read_only

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I tried it but couldn't figure it out. How about we just leave it like this for now, we have already set shared to be read_only on Windows.

@heheda123123
Copy link
Contributor Author

咦,这里已经有人搞定了,
acl-dev/acl#259 (comment)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Hey, someone has already done it here.
acl-dev/acl#259 (comment)

@waruqi
Copy link
Member

waruqi commented Nov 15, 2023

mingw 也有问题

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


MinGW also has problems

@star-hengxing
Copy link
Contributor

估计是 extern const 用错了😅

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


I guess extern const was used incorrectly😅

@waruqi
Copy link
Member

waruqi commented Nov 16, 2023

checkinfo: ...gramdir/core/sandbox/modules/import/core/tool/linker.lua:75: @programdir/core/sandbox/modules/os.lua:273: /usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/bin/x86_64-w64-mingw32-ld: /Users/runner/.xmake/packages/m/mbedtls/v3.5.1/7d52c2ddda154c3e8e1a864f70bdb8e6/lib/libmbedx509.a(x509_crt.c.obj):x509_crt.c:(.text+0x4284): undefined reference to __imp_inet_pton' /usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/bin/x86_64-w64-mingw32-ld: /Users/runner/.xmake/packages/m/mbedtls/v3.5.1/7d52c2ddda154c3e8e1a864f70bdb8e6/lib/libmbedx509.a(x509_crt.c.obj):x509_crt.c:(.text+0x42c7): undefined reference to __imp_inet_pton'
/usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/bin/x86_64-w64-mingw32-ld: /Users/runner/.xmake/packages/m/mbedtls/v3.5.1/7d52c2ddda154c3e8e1a864f70bdb8e6/lib/libmbedcrypto.a(entropy_poll.c.obj):entropy_poll.c:(.text+0x57): undefined reference to `BCryptGenRandom'

mingw 上还差几个 syslinks 补上应该就好了

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


checkinfo: ...gramdir/core/sandbox/modules/import/core/tool/linker.lua:75: @programdir/core/sandbox/modules/os.lua:273: /usr/local/Cellar/mingw- W64/11.0.1/ToolChain-X86_64/BIN/X86_64-W64-Mingw32-LD: /USERS/Runner/.Xmake/packages/m/mbedtls/v3.5.1/7d52C2DDDA154E8E864F70B70B db8e6/lib/libmbedx509.a (x509_crt.c. obj):x509_crt.c:(.text+0x4284): undefined reference to __imp_inet_pton' /usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/bin/x86_64-w64-mingw32-ld: /Users/runner/.xmake/packages/m/mbedtls/v3.5.1/7d52c2ddda154c3e8e1a864f70bdb8e6/lib /libmbedx509.a(x509_crt.c.obj):x509_crt.c:(.text+0x42c7): undefined reference to __imp_inet_pton'
/usr/local/Cellar/mingw-w64/11.0.1/toolchain-x86_64/bin/x86_64-w64-mingw32-ld: /Users/runner/.xmake/packages/m/mbedtls/v3.5.1/7d52c2ddda154c3e8e1a864f70bdb8e6/lib /libmbedcrypto.a(entropy_poll.c.obj):entropy_poll.c:(.text+0x57): undefined reference to `BCryptGenRandom'

There are still a few syslinks missing on mingw. It should be enough to make them up.

@waruqi
Copy link
Member

waruqi commented Nov 16, 2023

剩下的 mingw x86 问题,似乎是新版本引入的 Mbed-TLS/mbedtls#8334

可以看下能否打 patch 修复,或者等下个 release

@waruqi
Copy link
Member

waruqi commented Nov 17, 2023

https://github.com/Mbed-TLS/mbedtls/blob/edb8fec9882084344a314368ac7fd957a187519c/library/aesni.c#L47 这里也得打 patch 不过它下个版本修复了

@waruqi
Copy link
Member

waruqi commented Nov 21, 2023

可以了 #2849

@waruqi waruqi closed this Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants