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

fix_poco_shared_build #4994

Merged
merged 11 commits into from
Aug 30, 2024
Merged

fix_poco_shared_build #4994

merged 11 commits into from
Aug 30, 2024

Conversation

SnowinterCat
Copy link
Contributor

@SnowinterCat SnowinterCat commented Aug 20, 2024

  • Fix Poco libraries cannot compile with shared build on Windows
  • Fix: Compiling Poco's xml module has some problems due to missing macros with the expat static library. Appending macros directly will cause to fail to compile Poco with a dynamic expat library. Change some previous code to be executed only when expat is a static library.
  • Fix: Compiling Poco's foundation module has some problems due to missing macros with the pcre2 static library. Appending macros directly will cause to fail to compile Poco with a dynamic pcre2 library. Change some previous code to be executed only when pcre2 is a static library.
  • Refine the Poco library modules so that you don't need to install the entire Poco library if you only need a small part of it.
  • Provide the option of mariadb when using the MySql module in Poco (not selectable at the same time as mysql).

@SnowinterCat
Copy link
Contributor Author

Poco库的mysql模块本身是支持Mysql或者MariaDB的,不过它的头文件里面写死了使用

#include <mysql/mysql.h>

但是xmake-repo编译出来的MariaDB的头文件是: mariadb/mysql.h
我为了进行支持,在用户选择Poco中的mariadb选项的时候,将Poco/Data/MySQL模块中所有用到了

#include <mysql/mysql.h>

都改成了

#include <mariadb/mysql.h>

来进行支持。
这样子做好吗?如果不好的话,有没有别的办法?
@waruqi

@Issues-translate-bot
Copy link

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


The mysql module of the Poco library itself supports Mysql or MariaDB, but its use is hard-coded in its header file.

#include <mysql/mysql.h>

But the header file of MariaDB compiled by xmake-repo is: mariadb/mysql.h
In order to provide support, when the user selects the mariadb option in Poco, I use all the modules in the Poco/Data/MySQL module.

#include <mysql/mysql.h>

All changed to

#include <mariadb/mysql.h>

to support.
Is this a good idea? If it's not good, is there any other way?
@waruqi

@@ -16,52 +16,129 @@ package("poco")
add_versions("1.12.5", "92b18eb0fcd2263069f03e7cc80f9feb43fb7ca23b8c822a48e42066b2cd17a6")
add_versions("1.13.3", "9f074d230daf30f550c5bde5528037bdab6aa83b2a06c81a25e89dd3bcb7e419")

add_configs("shared", {description = "Build shared library.", default = false, type = "boolean"})
add_configs("debug", {description = "Build debug library.", default = false, type = "boolean"})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这两原本就是内置 config 不用加

-- Rewrite to xmake:
-- if package:config("active_record") then
-- package:config_set("data", true)
-- end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释去掉

@waruqi
Copy link
Member

waruqi commented Aug 20, 2024

Poco库的mysql模块本身是支持Mysql或者MariaDB的,不过它的头文件里面写死了使用

#include <mysql/mysql.h>

但是xmake-repo编译出来的MariaDB的头文件是: mariadb/mysql.h 我为了进行支持,在用户选择Poco中的mariadb选项的时候,将Poco/Data/MySQL模块中所有用到了

#include <mysql/mysql.h>

都改成了

#include <mariadb/mysql.h>

来进行支持。 这样子做好吗?如果不好的话,有没有别的办法? @waruqi

可以

@Issues-translate-bot
Copy link

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


The mysql module of the Poco library itself supports Mysql or MariaDB, but its use is hard-coded in its header file.

#include <mysql/mysql.h>

But the header file of MariaDB compiled by xmake-repo is: mariadb/mysql.h. For support, when the user selects the mariadb option in Poco, all the modules in Poco/Data/MySQL are used.

#include <mysql/mysql.h>

All changed to

#include <mariadb/mysql.h>

for support. Is this a good idea? If it's not good, is there any other way? @waruqi

Can

@waruqi
Copy link
Member

waruqi commented Aug 21, 2024

@star-hengxing 9b9642f

这个 patch break 了 boost

error: ./packages/b/boost/xmake.lua:285: 'then' expected near '!'

@waruqi waruqi mentioned this pull request Aug 21, 2024
@waruqi waruqi closed this Aug 21, 2024
@waruqi waruqi reopened this Aug 21, 2024
package:add("deps", "mysql")
end
assert(not (package:has_runtime("MT", "MTd") and package:config("shared")), "Poco cannot have both BUILD_SHARED_LIBS and POCO_MT")
assert(not (package:config("mysql") and package:config("mariadb")), "Poco's options 'mysql' and 'mariadb' cannot exist together")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种检测放到 on_check 里面去做

local build_ver = string.match(vs_sdkver, "%d+%.%d+%.(%d+)%.?%d*")
assert(tonumber(build_ver) >= 18362, "poco requires Windows SDK to be at least 10.0.18362.0")
table.insert(configs, "-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=" .. vs_sdkver)
table.insert(configs, "-DCMAKE_SYSTEM_VERSION=" .. vs_sdkver)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configs 就不要加到 check 了。。

table.insert(configs, "-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=" .. vs_sdkver)
table.insert(configs, "-DCMAKE_SYSTEM_VERSION=" .. vs_sdkver)
end
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 configs 设置删来干嘛

@SnowinterCat
Copy link
Contributor Author

在android平台上的armeabi-v7a架构r22中,会因为pcre2需要大于r22的ndk而失败,但是在arm64-v8a架构r22下不会,这个是什么原因呢?

@Issues-translate-bot
Copy link

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


In the armeabi-v7a architecture r22 on the android platform, it will fail because pcre2 requires an ndk larger than r22, but it will not fail in the arm64-v8a architecture r22. What is the reason for this?

@SnowinterCat
Copy link
Contributor Author

这个Wasm平台会出现poco找不到pcre2,这就很奇怪了。我手动指定了pcre2的路径也不行,我只能暂时让poco不支持wasm了

@Issues-translate-bot
Copy link

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


This Wasm platform will show that poco cannot find pcre2, which is very strange. Even if I manually specify the path to pcre2, it doesn't work. I can only temporarily disable poco from supporting wasm.

@star-hengxing
Copy link
Contributor

在android平台上的armeabi-v7a架构r22中,会因为pcre2需要大于r22的ndk而失败,但是在arm64-v8a架构r22下不会,这个是什么原因呢?

因为 pcre2 加了 on_check 过滤 ci #4173

@star-hengxing
Copy link
Contributor

这个Wasm平台会出现poco找不到pcre2,这就很奇怪了。我手动指定了pcre2的路径也不行,我只能暂时让poco不支持wasm了

这个不知道是 cmake or xmake 的原因,很多包在 wasm 平台上总是 find_package 失败

@Issues-translate-bot
Copy link

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


This Wasm platform will show that poco cannot find pcre2, which is very strange. Even if I manually specify the path to pcre2, it doesn't work. I can only temporarily disable poco from supporting wasm.

I don’t know if this is caused by cmake or xmake. Many packages always fail to find_package on the wasm platform.

@SnowinterCat
Copy link
Contributor Author

在android平台上的armeabi-v7a架构r22中,会因为pcre2需要大于r22的ndk而失败,但是在arm64-v8a架构r22下不会,这个是什么原因呢?

因为 pcre2 加了 on_check 过滤 ci #4173

我其实是奇怪,为什么armeabi-v7a架构r22会报错 need ndk > 22,但是arm64-v8a架构r22 不会报错 need ndk > 22。就不是很方便做检查。不过既然pcre2已经有这个检查了,那poco应该就没必要加了吧

@Issues-translate-bot
Copy link

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


In the armeabi-v7a architecture r22 on the android platform, it will fail because pcre2 requires an ndk larger than r22, but not in the arm64-v8a architecture r22. What is the reason for this?

Because pcre2 added on_check filtering ci #4173

I am actually curious why the armeabi-v7a architecture r22 will report the error need ndk > 22, but the arm64-v8a architecture r22 will not report the error need ndk > 22. It is not very convenient for inspection. But since pcre2 already has this check, there should be no need for poco to add it.

@SnowinterCat
Copy link
Contributor Author

@waruqi 这下应该正式完工了,如果只有三个因为pcre2的ndk版本导致的失败的话

@SnowinterCat
Copy link
Contributor Author

最后的on_test中注释掉的那5个是exe,没有头文件我不清楚怎么测试。等以后别人来补充吧

@SnowinterCat
Copy link
Contributor Author

所以如果全部编译,应该是22个dll(MySql模块和MariaDB模块冲突),加上Windows特供的NetSSL_Win.dll,一共23个;加上5个exe

@Issues-translate-bot
Copy link

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


@waruqi It should be officially completed now, if there are only three failures caused by the ndk version of pcre2

@Issues-translate-bot
Copy link

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


The 5 commented out in the last on_test are exe. I don’t know how to test without the header file. Let others add it later.

@Issues-translate-bot
Copy link

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


So if you compile them all, there should be 22 dlls (the MySql module conflicts with the MariaDB module), plus NetSSL_Win.dll specially provided for Windows, a total of 23; plus 5 exes

@star-hengxing star-hengxing merged commit cc2d57e into xmake-io:dev Aug 30, 2024
62 of 65 checks passed
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.

4 participants