Fix building with z_ prefix#936
Conversation
27bd59c to
c5e74ac
Compare
z_ prefix
535d235 to
05a405e
Compare
|
@madler: Have you seen this PR? |
05a405e to
551d695
Compare
|
@madler, do you mind having a look at this PR? Merging this would fix versioned symbols in the built shared object ( Without the change from this PR using the version-script ( |
551d695 to
7fb5551
Compare
openembedded-core(be5856616) forces the use of the bfd linker for zlib. zlib does not build with lld, keep it until madler/zlib#936 is addressed When using LTO with clang, it is recommended to use the lld linker. If it use the bfd linker, it need to use the LLVMgold.so plugin, but the gold linker has been deprecated. See more details https://errors.yoctoproject.org/Errors/Details/886598 ``` error loading plugin: TOPDIR/build/tmp/work/cortexa72-yoe-linux/zlib/1.3.1/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ``` Signed-off-by: mark.yang <mark.yang@lge.com>
bluez5 is forced to use the bfd linker. kraj@ee218b7 systemd-boot is forced to use the bfd linker. openembedded/openembedded-core@a157b2f#diff-02f955f0bb176d6a95cf74d4fa6b499d0318f7877cbe3c525936b09a4dc8f3ce For LTO, the lld linker is required, but if using the bfd linker, the LLVMgold.so plugin must be used. However, the gold linker is no longer used. ``` usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-ld.bfd: recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: error loading plugin: /home/markyang/workspace/yoe-distro/build/tmp/work/cortexa72-yoe-linux/systemd-boot/257.8/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ```` openembedded-core(be5856616) forces the use of the bfd linker for zlib. zlib does not build with lld, keep it until madler/zlib#936 is addressed When using LTO with clang, it is recommended to use the lld linker. If it use the bfd linker, it need to use the LLVMgold.so plugin, but the gold linker has been deprecated. See more details https://errors.yoctoproject.org/Errors/Details/886598 ``` error loading plugin: TOPDIR/build/tmp/work/cortexa72-yoe-linux/zlib/1.3.1/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ``` Signed-off-by: mark.yang <mark.yang@lge.com>
bluez5 is forced to use the bfd linker. ee218b7 systemd-boot is forced to use the bfd linker. openembedded/openembedded-core@a157b2f#diff-02f955f0bb176d6a95cf74d4fa6b499d0318f7877cbe3c525936b09a4dc8f3ce For LTO, the lld linker is required, but if using the bfd linker, the LLVMgold.so plugin must be used. However, the gold linker is no longer used. ``` usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-ld.bfd: recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: error loading plugin: /home/markyang/workspace/yoe-distro/build/tmp/work/cortexa72-yoe-linux/systemd-boot/257.8/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ```` openembedded-core(be5856616) forces the use of the bfd linker for zlib. zlib does not build with lld, keep it until madler/zlib#936 is addressed When using LTO with clang, it is recommended to use the lld linker. If it use the bfd linker, it need to use the LLVMgold.so plugin, but the gold linker has been deprecated. See more details https://errors.yoctoproject.org/Errors/Details/886598 ``` error loading plugin: TOPDIR/build/tmp/work/cortexa72-yoe-linux/zlib/1.3.1/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ``` Signed-off-by: mark.yang <mark.yang@lge.com>
bluez5 is forced to use the bfd linker. kraj@ee218b7 systemd-boot is forced to use the bfd linker. openembedded/openembedded-core@a157b2f#diff-02f955f0bb176d6a95cf74d4fa6b499d0318f7877cbe3c525936b09a4dc8f3ce For LTO, the lld linker is required, but if using the bfd linker, the LLVMgold.so plugin must be used. However, the gold linker is no longer used. ``` usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-ld.bfd: recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: error loading plugin: /home/markyang/workspace/yoe-distro/build/tmp/work/cortexa72-yoe-linux/systemd-boot/257.8/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ```` openembedded-core(be5856616) forces the use of the bfd linker for zlib. zlib does not build with lld, keep it until madler/zlib#936 is addressed When using LTO with clang, it is recommended to use the lld linker. If it use the bfd linker, it need to use the LLVMgold.so plugin, but the gold linker has been deprecated. See more details https://errors.yoctoproject.org/Errors/Details/886598 ``` error loading plugin: TOPDIR/build/tmp/work/cortexa72-yoe-linux/zlib/1.3.1/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ``` Signed-off-by: mark.yang <mark.yang@lge.com> Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
bluez5 is forced to use the bfd linker. ee218b7 systemd-boot is forced to use the bfd linker. openembedded/openembedded-core@a157b2f#diff-02f955f0bb176d6a95cf74d4fa6b499d0318f7877cbe3c525936b09a4dc8f3ce For LTO, the lld linker is required, but if using the bfd linker, the LLVMgold.so plugin must be used. However, the gold linker is no longer used. ``` usr/bin/aarch64-yoe-linux/aarch64-yoe-linux-ld.bfd: recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: error loading plugin: /home/markyang/workspace/yoe-distro/build/tmp/work/cortexa72-yoe-linux/systemd-boot/257.8/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ```` openembedded-core(be5856616) forces the use of the bfd linker for zlib. zlib does not build with lld, keep it until madler/zlib#936 is addressed When using LTO with clang, it is recommended to use the lld linker. If it use the bfd linker, it need to use the LLVMgold.so plugin, but the gold linker has been deprecated. See more details https://errors.yoctoproject.org/Errors/Details/886598 ``` error loading plugin: TOPDIR/build/tmp/work/cortexa72-yoe-linux/zlib/1.3.1/recipe-sysroot-native/usr/bin/aarch64-yoe-linux/../lib/LLVMgold.so: cannot open shared object file: No such file or directory ``` Signed-off-by: mark.yang <mark.yang@lge.com> Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
|
@DenizThatMenace: Can you rebase your PR? |
|
While rebasing, at least The option has a new name. |
This reverts commit 8a844d4.
This also fixes out-of-source builds when the `-zprefix` option was given to the configure script.
7fb5551 to
c9a1d30
Compare
|
I rebased this PR on latest I hope, this PR will be merged soon, because I am not eager to rebase it again in two more years when there are again more code parts that break this feature even further. |
|
3 Questions:
|
Because the path to this file ( Using the cache variable is the clean way to preserve this information between different CMake calls and to always give
There is no change to a file Before this PR, there already existed a file
Because |
And you fix the wrong location by writing the ordinary var as cache-var? The out-file is set to zlib1-dll-BINARY-DIR, and that value is never changed. And yes, the file could end up in a wring place, but that is caused because ZLIB_CONF_WRITTEN was set there. If the conf for this lib needs other settings, it should be guarded by another var, if the same settings apply, there's no need for any change there.
If toplevel CMakeLists.txt sets ZLIB_CONF_WRITTEN, is an elegant way to get ignored, as this if is never evaluated, and if you directly use contrib/zlib/-dll/CMakeLists.txt, the correct output-dir is set. So maybe 2 vars for one value is ore elegant, but they don't solve your problem.
This file does not exists? It is used when building directly from the shipped Makefile, zconf.h.in is only used by configure as an input for a generated zconf.h, and I'm pretty sure it's superflous as it's identical to zconf.h and every call to sed would alos work there.
There is a change to zconf.h.in. An obvious typo that could be easily catched.
Yep, that was there for the shipped Makefile when it was building something (maybe some in contrib still do). When that one is removed, the change makes sense, if not it doesn't change anything.
So you're writing a 4 lines Note to say "This doesn't work when using the gui and changing the value in a second configure run". And even more missleading, you're note says not only in the if block, but you now say it's not needed in the if at all. The second is right, and nailing it to the first value can be a problem when you later change it. So the right way would be to move the line from the if to somewhere outside before the configure-file call, not duplicating the line. |
I have problems understanding what you are trying to tell me. The situation how I understand it:
I meant the filenames you originally mentioned (
Have a look into the If the
There is a change to
If with "that" you mean
I probably should have written the second sentence in a comment here in the PR instead of in the code. (Will change that.)
I do not understand what exactly you want to tell me with these sentences. If you are just explaining what I meant, namely moving the |
c9a1d30 to
71f34cc
Compare
|
OK, to be state it clear before discussion drifts, I tried to follow your essay, but it's way too long. Let's gather the facts: cmake-gui and ccmake don't work when Z_PREFIX is changed in a second run. Moving setting of this var will fix the issue. renaming zconf.h to zconf.h.in has nothing to do with this. Maybe @madler can say something about that, but my first thought is this makes the PR necessarily bigger. Maybe it's semantically better, but that's all. I've never tested z_prefix, but I've built the libs all together and everyone on their own. I have no clue if they are incorrect, but there are no build-errors, so syntax is correct and they are found, so for me it looks like they are found no matter if you are introducing a cache-var or not. Regarding the maps: I've no clue if they are needed at all, my simple mind expects compilers to handle such stuff It's a working week and you have no chance that I read and answer before the 3rd beer. Thuesday you can expect me to catch your answers when sober. |
|
k, I took a look at all that stuff. What noone noticed, ZLIB_PREFIX is set as option, so always bool. I now changed that and create zlib.map and zlib.def from the files that have been there already. Take a look at #1233 and let me know if something is missing. |
This PR fixes a problem with the version-script (
zlib.map) when also building with enabledz_prefix for the function names.Without the changes from this PR the version-script did not properly assign version numbers to the function symbols in
zlib.so(using GCC or Clang) if the function symbols are prefixed withz_!Background
Most linkers silently ignored this error and just generated a
zlib.sowithout any version numbers attached. Starting withlld17 (or was it 16?), however, linking even fails with the following errors:The reason is that
zlib.mapdid not care whether thez_prefix is used or not.