Comments (6)
这个 patch 只是方便,不是每次都必须替换的。需要时候才替换,不需要的时候就不调用了。大部分情况的标准库都是默认的,所以这里的 patch pkgconfig 方法只是偶然内聚的结果。
头文件名称相同有案例吗?如果目前没有的话就维持现状,这里没必要大动干戈,再不济还可以对冲突的库设置 --includedir
参数来安装。
from static-php-cli.
@crazywhalecc 这不是需不需要的问题啊,而是需要的时候,没有。
看例子: libpq源码里 引用 openssl 。直接引用的是 openssl/ssl.h
vi src/include/libpq/libpq-be.h
#ifdef USE_OPENSSL
#include <openssl/ssl.h>
#include <openssl/err.h>
#include "postgres.h"
#ifdef USE_LIBXML
#include <libxml/chvalid.h>
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
#include <libxml/tree.h>
#include <libxml/uri.h>
#include <libxml/xmlerror.h>
#include <libxml/xmlversion.h>
#include <libxml/xmlwriter.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
from static-php-cli.
我没有搞懂你说的意思。你是说有的库的 .h 文件不能被 pkgconfig 内提供的参数覆盖吗?而且即使是你提到的这个 openssl 和 libxml2 的问题其实是不存在的,例如引入 openssl 时 Cflag 就是 -I"buildroot/include"
目录,在编译时使用 #include <openssl/ssl.h>
就会自动寻找 buildroot/include/openssl/ssl.h
这个文件,并不存在你说的引用问题,而且其他库都是这么引用的,例如 curl:#if defined(USE_OPENSSL) # include <openssl/ssl.h>
。在 libxml2 中也是如此,这些提供 ABI 的开源通用库都一般不会存在这类很显著的问题的,要不然一个成熟的 Linux 发行版把所有软件的头文件放到 /usr/include
目录不是早冲突了。
如果你遇到了此类问题并无法解决,我建议你先贴出来你做了什么,config.log 显示到哪步报错,是哪个参数或变量缺失导致的,我补充上什么参数就能 working 了。否则因为引入新的依赖库时破坏了大量旧的依赖库结构其实是一种破坏性更新行为,除非旧的逻辑真的有 Bug。
from static-php-cli.
@crazywhalecc 需求就是把这个 #84 跑起来,不想要 patch ,也不想添加其他代码
当前状况是,如果不修改其他库,构建PGSQL 预处理这一步通不过。构建PGSQL ,预处理遇到的第一个问题是:xml2-config ,然后是openssl 头文件 。然后是icu
from static-php-cli.
去掉大部分 PATCH 的关键代码: 包括curl 的patch
$builddir = BUILD_ROOT_PATH;
$cppflags = '';
$ldflags = '';
$libs = '';
if (!empty($this->pkg_config_packages)) {
$packages = implode(' ', $this->pkg_config_packages);
$output = shell()->execWithResult($envs . ' pkg-config --libs-only-l --static ' . $packages);
if (!empty($output[1][0])) {
$libs = $output[1][0];
logger()->info('LIBS=' . $output[1][0]);
}
$output = shell()->execWithResult($envs . ' pkg-config --cflags-only-I --static ' . $packages);
if (!empty($output[1][0])) {
$cppflags = $output[1][0];
logger()->info('CPPFLAGS=' . $output[1][0]);
}
$output = shell()->execWithResult($envs . ' pkg-config --libs-only-L --static ' . $packages);
if (!empty($output[1][0])) {
$ldflags = $output[1][0];
logger()->info('LDFLAGS=' . $output[1][0]);
}
}
if ($this->getLib('libiconv')) {
$libs .= ' -liconv ';
}
if ($this->getLib('bzip2')) {
$libs .= ' -lbz2';
}
if ($this->getLib('icu')) {
$libs .= ' -lstdc++';
}
$envs .= " CPPFLAGS=\"-I{$builddir}/include/ {$cppflags}\" ";
$envs .= " LDFLAGS=\"-L{$builddir}/lib/ {$ldflags}\" ";
if (!empty($libs)) {
$envs .= " LIBS=\"{$libs} \" ";
}
if (!empty(trim($cflags))) {
$envs .= " CFLAGS='{$cflags} ";
}
https://github.com/jingjingxyk/static-php-cli/blob/main/src/SPC/builder/linux/LinuxBuilder.php#L160
https://github.com/jingjingxyk/static-php-cli/blob/main/src/SPC/builder/unix/library/curl.php (cmake 默认链接都是动态库,使用package_name_ROOT 参数,申明静态库位置)
from static-php-cli.
(cmake 默认链接都是动态库,使用package_name_ROOT 参数,申明静态库位置)
这里应该不存在这个问题。首先自编译的 pkg-config 可以限定库只从 buildroot 查找,其次输入的 cmake toolchain file 中也描述了只在指定的根目录下查找包,而 buildroot 只有静态库,所以不会连接到动态库。
from static-php-cli.
Related Issues (20)
- xz dependency unavailable HOT 1
- win版中构建的micro.sfx HOT 1
- Build error with Postgres because of libxml2 HOT 3
- libuuid fails to build on linux HOT 1
- FreeBSD Support Not Working - "Current OS is not supported" HOT 10
- bug: Linux x86_64 build failed HOT 6
- Compiled Windows executable isn't running HOT 1
- Windows Defender SmartScreen HOT 4
- SSL operation failed with code 5 HOT 10
- In extreme cases micro.sfx using `--with-upx-pack` will build the wrong binary
- Extension request: `gd` on Windows
- postgresql: Failed to get pkg-config information HOT 3
- ncurses 6.5 not working with libreadline
- xz build failed on Linux and macOS
- download bug: for-extensions=redis does not download zstd
- Extension request: `intl` on Windows HOT 2
- `intl` ICU build errors HOT 2
- SAPI embed Support on Windows HOT 2
- Add the parallel extension HOT 3
- Doc: remove `untested` type for extension list
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from static-php-cli.