Bug 1836608 - z3, z3-devel, z3-libs do not provide proper CMake interface for find_package(Z3)
Summary: z3, z3-devel, z3-libs do not provide proper CMake interface for find_package(Z3)
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: z3
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jerry James
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On: 1878004
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-17 08:49 UTC by Anton Kochkov
Modified: 2021-05-25 16:17 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-05-25 16:17:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Anton Kochkov 2020-05-17 08:49:34 UTC
I am compiling Triton from sources, and it fails only on Fedora, see the corresponding lines in CMakeLists.txt: https://github.com/JonathanSalwan/Triton/blob/a6645a1d0e08b27b6698be7c2c0896d3367fd0b4/CMakeLists.txt#L164


Triton/build on  fix-python-3.8 
[i] ℤ cmake ..                                                                                                                                                                                                                     16:31:06 
Z3_INCLUDE_DIR=Z3_INCLUDE_DIR-NOTFOUND
Z3_INCLUDE_DIRS=
Z3_LIBRARY=/usr/lib64/libz3.so
Z3_LIBRARIES=/usr/lib64/libz3.so;/usr/lib64/libz3.so
CMake Error at CMakeModules/LibFindMacros.cmake:75 (message):
  Required library Z3 NOT FOUND.

  Install the library (dev version) and try again.  If the library is already
  installed, use ccmake to set the missing variables manually.
Call Stack (most recent call first):
  CMakeModules/FindZ3.cmake:32 (libfind_process)
  CMakeLists.txt:164 (find_package)


-- Configuring incomplete, errors occurred!

If I run `Z3_INCLUDE_DIR=/usr/include/z3 cmake ..` it works, but fails at the linking stage:

Scanning dependencies of target ctest_api
[ 88%] Building CXX object src/examples/cpp/CMakeFiles/ctest_api.dir/ctest_api.cpp.o
[ 89%] Linking CXX executable ctest_api
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_solver_get_model'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_iff'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_concat'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_symbol_string'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_set_error_handler'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvurem'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_ast_vector_push'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_error_code'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_decl_kind'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvsrem'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvshl'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvlshr'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_extract'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_model_get_func_decl'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_error_msg'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_del_config'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_xor'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_solver_dec_ref'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_not'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_decl_int_parameter'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_ast_vector_get'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_app_arg'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_model_get_const_decl'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_ast_vector_size'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvugt'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_or'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_solver_check'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvor'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_numeral_string'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvxor'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_string_symbol'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_decl_name'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvnand'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_inc_ref'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvsub'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_and'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvsmod'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvuge'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvand'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_model_get_const_interp'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_numeral'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_bool_value'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_sort_kind'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_ite'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_const'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_app_decl'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_sort'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_translate'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvsdiv'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvslt'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvsgt'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvule'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_rotate_left'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvashr'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_bv_sort_size'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvsle'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvadd'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvmul'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_rotate_right'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_int_sort'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_model_get_num_consts'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_config'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_simplify'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvsge'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_dec_ref'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_model_inc_ref'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_app_num_args'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_del_context'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_zero_ext'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_ast_vector'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_distinct'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_model_get_num_funcs'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvnot'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bv_sort'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_model_dec_ref'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvxnor'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvneg'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_eq'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvult'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_solver'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_ast_vector_dec_ref'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_sign_ext'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_set_ast_print_mode'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_numeral_uint64'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_solver_assert'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvudiv'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_context_rc'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_forall_const'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_ast_vector_inc_ref'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_mk_bvnor'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_get_ast_kind'
/usr/bin/ld: ../../libtriton/libtriton.so: undefined reference to `Z3_solver_inc_ref'
collect2: 错误:ld 返回 1

Comment 1 Jerry James 2020-05-18 00:58:09 UTC
The z3 library does contain those symbols, so the most likely problem is that the link command does not include -lz3.  Try invoking cmake like this:

cmake -DZ3_INCLUDE_DIRS=/usr/include/z3 -DZ3_LIBRARIES=/usr/lib64/libz3.so .

The problem appears to be that Triton's CMakeModules/FindZ3.cmake uses pkgconfig to find out where the z3 headers and library are located, but z3 upstream does not ship a pkgconfig file.  Triton must be relying on some pkgconfig file created by somebody somewhere, but they apparently have not given it to the z3 developers, so it has not shown up in any z3 release.  If you are on speaking terms with the Triton developers, please ask them to either submit z3.pc to the z3 developers, or find another way of locating the headers and library.

This is not a bug in the Fedora package.

Comment 2 Anton Kochkov 2020-05-18 04:51:20 UTC
I sent PR to the mainstream, lets wait when (or if) it will be merged. Might become a part of the 4.8.9 release if we are lucky.

https://github.com/Z3Prover/z3/pull/4368

Comment 3 Anton Kochkov 2020-09-11 04:42:52 UTC
That patch was included in the Z3 4.8.9 which was released today - https://github.com/Z3Prover/z3/releases/tag/z3-4.8.9

Please update the package.

Comment 4 Fedora Program Management 2021-04-29 16:26:36 UTC
This message is a reminder that Fedora 32 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 32 on 2021-05-25.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '32'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 32 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Ben Cotton 2021-05-25 16:17:14 UTC
Fedora 32 changed to end-of-life (EOL) status on 2021-05-25. Fedora 32 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.