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

[BUG] Target "redis++_static" links to: hiredis::hiredis_static_ssl #486

Closed
pberginkonsult opened this issue May 23, 2023 · 2 comments
Closed

Comments

@pberginkonsult
Copy link

Describe the bug
During configuration with CMake there is a bad substitution when handling the static libraries which make CMake to fail the configuration. This was found while building redis-plus-plus in Yocto with newer version of hiredis that also have a static library available.

$ bitbake redis-plus-plus -ccompile
Loading cache: 100% |#################################################################################################################################################################################################################| Time: 0:00:00
Loaded 3093 entries from dependency cache.
Parsing recipes: 100% |###############################################################################################################################################################################################################| Time: 0:00:00
Parsing of 1821 .bb files complete (1814 cached, 7 parsed). 3077 targets, 61 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "2.4.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky-altcfg"
DISTRO_VERSION       = "4.2"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "master:6f935ad920dcc11a81191c9665a9004587080569"
meta-oe              = "hiredis:9b7b674e583714d7636a3ac52ad564859ce3002b"

Initialising tasks: 100% |############################################################################################################################################################################################################| Time: 0:00:00
Sstate summary: Wanted 0 Local 0 Mirrors 0 Missed 0 Current 105 (0% match, 100% complete)
NOTE: Executing Tasks
ERROR: redis-plus-plus-1.3.7-r0 do_configure: ExecutionError('/work/yocto/poky/build/build-qemux86-64-systemd/tmp/work/core2-64-poky-linux/redis-plus-plus/1.3.7-r0/temp/run.do_configure.4073567', 1, None, None)
ERROR: Logfile of failure stored in: /work/yocto/poky/build/build-qemux86-64-systemd/tmp/work/core2-64-poky-linux/redis-plus-plus/1.3.7-r0/temp/log.do_configure.4073567
Log data follows:
| DEBUG: Executing python function extend_recipe_sysroot
| NOTE: Direct dependencies are ['/work/yocto/poky/sources/meta-openembedded/meta-oe/recipes-extended/hiredis/hiredis_1.1.0.bb:do_populate_sysroot', '/work/yocto/poky/sources/poky/meta/recipes-connectivity/openssl/openssl_3.1.0.bb:do_populate_sysroot', '/work/yocto/poky/sources/poky/meta/recipes-core/glibc/glibc_2.37.bb:do_populate_sysroot', '/work/yocto/poky/sources/poky/meta/recipes-devtools/cmake/cmake-native_3.26.3.bb:do_populate_sysroot', '/work/yocto/poky/sources/poky/meta/recipes-devtools/gcc/gcc-cross_12.2.bb:do_populate_sysroot', '/work/yocto/poky/sources/poky/meta/recipes-devtools/gcc/gcc-runtime_12.2.bb:do_populate_sysroot', 'virtual:native:/work/yocto/poky/sources/poky/meta/recipes-devtools/ninja/ninja_1.11.1.bb:do_populate_sysroot', 'virtual:native:/work/yocto/poky/sources/poky/meta/recipes-devtools/pseudo/pseudo_git.bb:do_populate_sysroot']
| NOTE: Installed into sysroot: []
| NOTE: Skipping as already exists in sysroot: ['hiredis', 'openssl', 'glibc', 'cmake-native', 'gcc-cross-x86_64', 'gcc-runtime', 'ninja-native', 'pseudo-native', 'linux-libc-headers', 'ncurses-native', 'zlib-native', 'bzip2-native', 'xz-native', 'openssl-native', 'zstd-native', 'libevent', 're2c-native', 'mpfr-native', 'binutils-cross-x86_64', 'flex-native', 'libtool-native', 'texinfo-dummy-native', 'libmpc-native', 'gnu-config-native', 'gmp-native', 'opkg-utils', 'libgcc', 'gettext-minimal-native', 'perl-native', 'zlib', 'm4-native', 'make-native', 'gdbm-native']
| DEBUG: Python function extend_recipe_sysroot finished
| DEBUG: Executing python function externalsrc_configure_prefunc
| DEBUG: Python function externalsrc_configure_prefunc finished
| DEBUG: Executing shell function do_configure
| -- redis-plus-plus version: 1.3.7
| -- The CXX compiler identification is GNU 12.2.0
| -- Detecting CXX compiler ABI info
| -- Detecting CXX compiler ABI info - done
| -- Check for working CXX compiler: /work/yocto/poky/build/build-qemux86-64-systemd/tmp/work/core2-64-poky-linux/redis-plus-plus/1.3.7-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-g++ - skipped
| -- Detecting CXX compile features
| -- Detecting CXX compile features - done
| -- redis-plus-plus build type: Release
| -- redis-plus-plus build with CXX standard: c++17
| -- redis-plus-plus TLS support: ON
| -- Found OpenSSL: /work/yocto/poky/build/build-qemux86-64-systemd/tmp/work/core2-64-poky-linux/redis-plus-plus/1.3.7-r0/recipe-sysroot/usr/lib/libcrypto.so (found version "3.1.0")
| -- redis-plus-plus build static library: ON
| -- redis-plus-plus build static library with position independent code: ON
| -- redis-plus-plus build shared library: ON
| -- redis-plus-plus build test: ON
| -- The C compiler identification is GNU 12.2.0
| -- Detecting C compiler ABI info
| -- Detecting C compiler ABI info - done
| -- Check for working C compiler: /work/yocto/poky/build/build-qemux86-64-systemd/tmp/work/core2-64-poky-linux/redis-plus-plus/1.3.7-r0/recipe-sysroot-native/usr/bin/x86_64-poky-linux/x86_64-poky-linux-gcc - skipped
| -- Detecting C compile features
| -- Detecting C compile features - done
| -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
| -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
| -- Found Threads: TRUE
| -- Debian package name: .deb
| -- Configuring done (0.3s)
| CMake Error at CMakeLists.txt:187 (target_link_libraries):
|   Target "redis++_static" links to:
| 
|     hiredis::hiredis_static_ssl
| 
|   but the target was not found.  Possible reasons include:
| 
|     * There is a typo in the target name.
|     * A find_package call is missing for an IMPORTED target.
|     * An ALIAS target is missing.
| 
| 
| 
| -- Generating done (0.0s)
| CMake Warning:
|   Manually-specified variables were not used by the project:
| 
|     CMAKE_EXPORT_NO_PACKAGE_REGISTRY
|     FETCHCONTENT_FULLY_DISCONNECTED
|     LIB_SUFFIX
|     PYTHON_EXECUTABLE
|     Python3_EXECUTABLE
|     Python_EXECUTABLE
| 
| 
| CMake Generate step failed.  Build files cannot be regenerated correctly.
| WARNING: exit code 1 from a shell command.
ERROR: Task (/work/yocto/poky/sources/meta-openembedded/meta-oe/recipes-extended/redis-plus-plus/redis-plus-plus_1.3.7.bb:do_configure) failed with exit code '1'

To Reproduce
Build redis-plus-plus in Yocto with this PR included: openembedded/meta-openembedded#695

Expected behavior
Tha configuration pass without error

Environment:

  • OS: Ubuntu 22.04
  • Compiler: Yocto master 4.2+
  • hiredis version: v1.1.0
  • redis-plus-plus version: 1.3.7

Additional context
The problem is in CMakeLists.txt:

string(REPLACE "hiredis::hiredis" "hiredis::hiredis_static" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC

Where the names are substituted for the static build.
The string before the substitution: hiredis::hiredis;hiredis::hiredis_ssl;
The string after the substitution: hiredis::hiredis_static;hiredis::hiredis_static_ssl;
The string should be: hiredis::hiredis_static;hiredis::hiredis_ssl_static;

One possible solution to the problem is to also include the ';' into the string:

$ git diff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69794d9..08c265d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -160,13 +160,12 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC)
     set(REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC ${REDIS_PLUS_PLUS_HIREDIS_LIBS})
 
     if (TARGET hiredis::hiredis_static)
-      string(REPLACE "hiredis::hiredis" "hiredis::hiredis_static" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
+      string(REPLACE "hiredis::hiredis;" "hiredis::hiredis_static;" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
         "${REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC}")
     endif()
-
     if (TARGET hiredis::hiredis_ssl_static)
       # If SSL is not enabled, this line will have no effect
-      string(REPLACE "hiredis::hiredis_ssl" "hiredis::hiredis_ssl_static" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
+      string(REPLACE "hiredis::hiredis_ssl;" "hiredis::hiredis_ssl_static;" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
         "${REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC}")
     endif()
pberginkonsult pushed a commit to pberginkonsult/meta-openembedded that referenced this issue May 23, 2023
When building static library a substitution for library name
was bad. Reported in sewenew/redis-plus-plus#486
and detected when building new version of hiredis that also builds
a static library.

Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Peter Bergin <[email protected]>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue May 23, 2023
When building static library a substitution for library name
was bad. Reported in sewenew/redis-plus-plus#486
and detected when building new version of hiredis that also builds
a static library.

Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue May 23, 2023
When building static library a substitution for library name
was bad. Reported in sewenew/redis-plus-plus#486
and detected when building new version of hiredis that also builds
a static library.

Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
kraj pushed a commit to YoeDistro/meta-openembedded that referenced this issue May 23, 2023
When building static library a substitution for library name
was bad. Reported in sewenew/redis-plus-plus#486
and detected when building new version of hiredis that also builds
a static library.

Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
@sewenew
Copy link
Owner

sewenew commented May 24, 2023

Thanks for reporting the bug! However, the proposal you mentioned does not work when we build redis-plus-plus and hired is without SSL support. Because, in that case, there's no semicolon in the string.

I fixed it with this commit, and merged the code into master branch. Please take a look, and test it. If the problem still exists, feel free to let me know.

Regards

@sewenew
Copy link
Owner

sewenew commented May 27, 2023

Since there's no update, I'll close this issue. If the code does not work, feel free to let me know.

Regards

@sewenew sewenew closed this as completed May 27, 2023
daregit pushed a commit to daregit/yocto-combined that referenced this issue May 22, 2024
…ction

When building static library a substitution for library name
was bad. Reported in sewenew/redis-plus-plus#486
and detected when building new version of hiredis that also builds
a static library.

Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Peter Bergin <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
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

No branches or pull requests

2 participants