xmake-io / xmake-repo

📦 An official xmake package repository
https://xrepo.xmake.io
Apache License 2.0
694 stars 406 forks source link

How to add package or-tools? #3770

Open fxxhuang opened 7 months ago

fxxhuang commented 7 months ago

Is your feature request related to a problem? Please describe.

I found that there are very few packages about Operations Research in xrepo, so I want to add google/or-tools.

I built the or-tools package myself, but encountered a problem. I hope someone can answer it.

It was installed successfully, but there were errors when using it.

Describe the solution you'd like

I added the package myself:

package("or-tools")
    set_homepage("https://developers.google.com/optimization/")
    set_description("Google's Operations Research tools")
    set_license("Apache-2.0")

    add_urls("https://github.com/google/or-tools/archive/refs/tags/$(version).tar.gz",
             "https://github.com/google/or-tools.git")

    add_versions("v9.9", "8c17b1b5b05d925ed03685522172ca87c2912891d57a5e0d5dcaeff8f06a4698")

    add_deps("cmake")

    on_install(function (package)
        local configs = {}
        -- table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
        -- table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
        table.insert(configs, "-DBUILD_DEPS=ON")
        import("package.tools.cmake").install(package, configs)
    end)

"BUILD_DEPS" means It can auto download requeaments itself by cmake.

The above can be successfully installed

But I get problem when I used, this is my project:

includes("or-tools")

add_rules("mode.debug", "mode.release")
add_requires("or-tools")
add_packages("or-tools")
set_languages("c++17")
target("test-or-tools")
    set_kind("binary")
    add_files("src/*.cpp")

Its build error report:

❯ xmake -vD
checking for platform ... macosx
checking for architecture ... arm64
checking for Xcode directory ... %s
checking for Codesign Identity of Xcode ... no
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checkinfo: cannot runv(zig version), No such file or directory
checking for zig ... no
checking for unzip ... /usr/bin/unzip
checking for git ... /usr/bin/git
checking for gzip ... /usr/bin/gzip
checking for tar ... /usr/bin/tar
checking for ping ... /sbin/ping
pinging the host(github.com) ... 68 ms
pinging the host(gitee.com) ... 60 ms
pinging the host(gitlab.com) ... 225 ms
/usr/bin/git rev-parse HEAD
checking for cmake ... no
checking for cmake ... /opt/homebrew/bin/cmake
finding or-tools from xmake ..
checking for xmake::or-tools ... or-tools v9.9
checking for /Library/Developer/CommandLineTools/usr/bin/clang ... ok
checking for the c++ compiler (cxx) ... clang
checking for /Library/Developer/CommandLineTools/usr/bin/clang ... ok
checking for flags (-fPIC) ... ok
> clang "-fPIC" "-Qunused-arguments" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
checking for flags (-fvisibility-inlines-hidden) ... ok
> clang "-fvisibility-inlines-hidden" "-Qunused-arguments" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
checking for flags (-O3) ... ok
> clang "-O3" "-Qunused-arguments" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
checking for flags (-DNDEBUG) ... ok
> clang "-DNDEBUG" "-Qunused-arguments" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
[ 25%]: cache compiling.release src/main.cpp
/Library/Developer/CommandLineTools/usr/bin/clang -c -Qunused-arguments -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -fvisibility=hidden -fvisibility-inlines-hidden -O3 -std=c++17 -isystem /Users/xxx/.xmake/packages/o/or-tools/v9.9/45c988db470d4cb2973983a475401880/include -DNDEBUG -o build/.objs/test-or-tools/macosx/arm64/release/src/main.cpp.o src/main.cpp
checking for flags (-MMD -MF) ... ok
> clang "-MMD" "-MF" "/dev/null" "-Qunused-arguments" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
checking for flags (-fdiagnostics-color=always) ... ok
> clang "-fdiagnostics-color=always" "-Qunused-arguments" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
checking for /Library/Developer/CommandLineTools/usr/bin/clang++ ... ok
checking for the linker (ld) ... clang++
checking for /Library/Developer/CommandLineTools/usr/bin/clang++ ... ok
checking for flags (-fPIC) ... ok
> clang++ "-fPIC" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" "-lz" "-isysroot" "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" "-lz"
[ 50%]: linking.release test-or-tools
/Library/Developer/CommandLineTools/usr/bin/clang++ -o build/macosx/arm64/release/test-or-tools build/.objs/test-or-tools/macosx/arm64/release/src/main.cpp.o -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/Users/xxx/.xmake/packages/o/or-tools/v9.9/45c988db470d4cb2973983a475401880/lib -Wl,-x -Wl,-dead_strip -labsl_die_if_null -labsl_log_internal_conditions -labsl_city -lClpSolver -labsl_time_zone -lOsiCbc -lCgl -labsl_kernel_timeout_internal -labsl_spinlock_wait -labsl_cord -labsl_status -labsl_log_severity -labsl_failure_signal_handler -labsl_log_internal_nullguard -labsl_log_internal_log_sink_set -labsl_bad_optional_access -labsl_hash -labsl_flags_commandlineflag -labsl_raw_logging_internal -labsl_log_internal_format -labsl_string_view -labsl_random_internal_pool_urbg -labsl_cord_internal -labsl_base -labsl_cordz_info -lz -labsl_bad_any_cast_impl -labsl_periodic_sampler -labsl_random_distributions -labsl_flags_usage_internal -lClp -labsl_random_seed_sequences -labsl_random_internal_platform -labsl_throw_delegate -labsl_debugging_internal -labsl_log_internal_fnmatch -labsl_flags_private_handle_accessor -lutf8_range -lCbcSolver -labsl_strings -labsl_malloc_internal -lprotobuf -labsl_str_format_internal -lprotoc -labsl_flags_usage -lprotobuf-lite -labsl_strings_internal -lCoinUtils -labsl_flags_program_name -labsl_int128 -labsl_crc_cord_state -labsl_scoped_set_env -labsl_raw_hash_set -labsl_crc32c -labsl_random_internal_seed_material -labsl_symbolize -labsl_crc_internal -labsl_random_internal_randen_slow -labsl_graphcycles_internal -labsl_exponential_biased -labsl_random_internal_randen_hwaes_impl -labsl_crc_cpu_detect -labsl_bad_variant_access -labsl_statusor -lOsi -labsl_log_internal_globals -labsl_log_sink -labsl_log_internal_check_op -labsl_stacktrace -labsl_cordz_handle -labsl_log_internal_message -lscip -labsl_log_initialize -lOsiClp -labsl_random_internal_randen_hwaes -labsl_flags_parse -labsl_log_globals -labsl_log_internal_proto -labsl_random_internal_randen -labsl_random_internal_distribution_test_util -labsl_time -labsl_flags_config -labsl_synchronization -labsl_flags_commandlineflag_internal -labsl_hashtablez_sampler -labsl_demangle_internal -labsl_leak_check -labsl_flags_marshalling -lutf8_validity -labsl_strerror -lre2 -labsl_log_entry -labsl_flags_reflection -labsl_cordz_functions -labsl_examine_stack -labsl_flags_internal -labsl_low_level_hash -labsl_random_seed_gen_exception -lCbc -labsl_vlog_config_internal -labsl_log_flags -labsl_cordz_sample_token -labsl_civil_time
Undefined symbols for architecture arm64:
  "_CFRelease", referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a(time_zone_lookup.cc.o)
  "_CFStringGetCString", referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a(time_zone_lookup.cc.o)
  "_CFStringGetLength", referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a(time_zone_lookup.cc.o)
  "_CFStringGetMaximumSizeForEncoding", referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a(time_zone_lookup.cc.o)
  "_CFTimeZoneCopyDefault", referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a(time_zone_lookup.cc.o)
  "_CFTimeZoneGetName", referenced from:
      absl::lts_20240116::time_internal::cctz::local_time_zone() in libabsl_time_zone.a(time_zone_lookup.cc.o)
  "operations_research::MPObjective::SetCoefficient(operations_research::MPVariable const*, double)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPObjective::SetOptimizationDirection(bool)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPConstraint::SetCoefficient(operations_research::MPVariable const*, double)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::MakeNumVar(double, double, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::ParseSolverType(std::__1::basic_string_view<char, std::__1::char_traits<char> >, operations_research::MPSolver::OptimizationProblemType*)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::MakeRowConstraint(double, double)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::SupportsProblemType(operations_research::MPSolver::OptimizationProblemType)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::Solve()", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::MPSolver(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, operations_research::MPSolver::OptimizationProblemType)", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::~MPSolver()", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPVariable::reduced_cost() const", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPVariable::solution_value() const", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPObjective::Value() const", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPConstraint::dual_value() const", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::iterations() const", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
  "operations_research::MPSolver::ComputeConstraintActivities() const", referenced from:
      operations_research::RunLinearProgrammingExample(std::__1::basic_string_view<char, std::__1::char_traits<char> >) in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: @programdir/core/main.lua:306: @programdir/actions/build/main.lua:148: @programdir/modules/async/runjobs.lua:320: @programdir/actions/build/kinds/binary.lua:74: @programdir/core/sandbox/modules/os.lua:378: execv(/Library/Developer/CommandLineTools/usr/bin/clang++ -o build/macosx/arm64/release/test-or-tools build/.objs/test-or-tools/macosx/arm64/release/src/main.cpp.o -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/Users/xxx/.xmake/packages/o/or-tools/v9.9/45c988db470d4cb2973983a475401880/lib -Wl,-x -Wl,-dead_strip -labsl_die_if_null -labsl_log_internal_conditions -labsl_city -lClpSolver -labsl_time_zone -lOsiCbc -lCgl -labsl_kernel_timeout_internal -labsl_spinlock_wait -labsl_cord -labsl_status -labsl_log_severity -labsl_failure_signal_handler -labsl_log_internal_nullguard -labsl_log_internal_log_sink_set -labsl_bad_optional_access -labsl_hash -labsl_flags_commandlineflag -labsl_raw_logging_internal -labsl_log_internal_format -labsl_string_view -labsl_random_internal_pool_urbg -labsl_cord_internal -labsl_base -labsl_cordz_info -lz -labsl_bad_any_cast_impl -labsl_periodic_sampler -labsl_random_distributions -labsl_flags_usage_internal -lClp -labsl_random_seed_sequences -labsl_random_internal_platform -labsl_throw_delegate -labsl_debugging_internal -labsl_log_internal_fnmatch -labsl_flags_private_handle_accessor -lutf8_range -lCbcSolver -labsl_strings -labsl_malloc_internal -lprotobuf -labsl_str_format_internal -lprotoc -labsl_flags_usage -lprotobuf-lite -labsl_strings_internal -lCoinUtils -labsl_flags_program_name -labsl_int128 -labsl_crc_cord_state -labsl_scoped_set_env -labsl_raw_hash_set -labsl_crc32c -labsl_random_internal_seed_material -labsl_symbolize -labsl_crc_internal -labsl_random_internal_randen_slow -labsl_graphcycles_internal -labsl_exponential_biased -labsl_random_internal_randen_hwaes_impl -labsl_crc_cpu_detect -labsl_bad_variant_access -labsl_statusor -lOsi -labsl_log_internal_globals -labsl_log_sink -labsl_log_internal_check_op -labsl_stacktrace -labsl_cordz_handle -labsl_log_internal_message -lscip -labsl_log_initialize -lOsiClp -labsl_random_internal_randen_hwaes -labsl_flags_parse -labsl_log_globals -labsl_log_internal_proto -labsl_random_internal_randen -labsl_random_internal_distribution_test_util -labsl_time -labsl_flags_config -labsl_synchronization -labsl_flags_commandlineflag_internal -labsl_hashtablez_sampler -labsl_demangle_internal -labsl_leak_check -labsl_flags_marshalling -lutf8_validity -labsl_strerror -lre2 -labsl_log_entry -labsl_flags_reflection -labsl_cordz_functions -labsl_examine_stack -labsl_flags_internal -labsl_low_level_hash -labsl_random_seed_gen_exception -lCbc -labsl_vlog_config_internal -labsl_log_flags -labsl_cordz_sample_token -labsl_civil_time) failed(1)
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:957]:
    [@programdir/core/sandbox/modules/os.lua:378]: in function 'execv'
    [@programdir/modules/core/tools/gcc.lua:527]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]:
    [@programdir/core/tool/linker.lua:221]: in function 'link'
    [@programdir/actions/build/kinds/binary.lua:74]: in function 'callback'
    [@programdir/modules/core/project/depend.lua:217]: in function 'on_changed'
    [@programdir/actions/build/kinds/binary.lua:55]: in function '_do_link_target'
    [@programdir/actions/build/kinds/binary.lua:105]:
    [@programdir/actions/build/kinds/binary.lua:132]: in function '_link_target'
    [@programdir/actions/build/kinds/binary.lua:160]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:237]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:280]: in function 'trycall'
    [@programdir/core/sandbox/modules/try.lua:117]: in function 'try'
    [@programdir/modules/async/runjobs.lua:220]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:404]:

stack traceback:
        [C]: in function 'error'
        @programdir/core/base/os.lua:957: in function 'base/os.raiselevel'
        (...tail calls...)
        @programdir/core/main.lua:306: in upvalue 'cotask'
        @programdir/core/base/scheduler.lua:404: in function <@programdir/core/base/scheduler.lua:397>

Describe alternatives you've considered

No response

Additional context

or-tools install user-guide

star-hengxing commented 7 months ago

You need to add on_test to check the links

fxxhuang commented 7 months ago

I hope someone can assist me in adding the library, or directly help me add it myself.

fxxhuang commented 7 months ago

You need to add on_test to check the links

Yes I know, I try on_test, bug its failed. So I direct test it using a project, and it also bug by "Undefined symbols for architecture arm64". But, you know what I mean, It can build install successfully.

For test, can using follow code:

#include "ortools/linear_solver/linear_solver.h"
           #include "ortools/linear_solver/linear_solver.pb.h"

           namespace operations_research {
             void RunTest(
               MPSolver::OptimizationProblemType optimization_problem_type) {
               MPSolver solver("Glop", optimization_problem_type);
               MPVariable* const x = solver.MakeNumVar(0.0, 1, "x");
               MPVariable* const y = solver.MakeNumVar(0.0, 2, "y");
               MPObjective* const objective = solver.MutableObjective();
               objective->SetCoefficient(x, 1);
               objective->SetCoefficient(y, 1);
               objective->SetMaximization();
               solver.Solve();
               printf("\nSolution:");
               printf("\nx = %.1f", x->solution_value());
               printf("\ny = %.1f", y->solution_value());
             }

             void RunExample() {
               RunTest(MPSolver::GLOP_LINEAR_PROGRAMMING);
             }
           }

           int main(int argc, char** argv) {
             operations_research::RunExample();
             return 0;
           }
SirLynix commented 7 months ago

It's probably a link order issue, you probably have to add links to let xmake know in which order it should link them.

fxxhuang commented 7 months ago

It's probably a link order issue, you probably have to add links to let xmake know in which order it should link them.

This may be a large workload if manual linking is required, as it has many dependencies. I just started learning about xmake, maybe there are other solutions, maybe I made some mistakes?

star-hengxing commented 7 months ago

Check installdir/lib and add_links explicitly:

https://github.com/xmake-io/xmake-repo/blob/79a5f74631f82d0bd19788a58b64ff859cd6a75f/packages/b/brotli/xmake.lua#L21

However, the package has some external dependencies that need to be added as well

fxxhuang commented 7 months ago

Check installdir/lib and add_links explicitly:

https://github.com/xmake-io/xmake-repo/blob/79a5f74631f82d0bd19788a58b64ff859cd6a75f/packages/b/brotli/xmake.lua#L21

However, the package has some external dependencies that need to be added as well

Its huge project can't be manual linking I guess. (ToT)

star-hengxing commented 7 months ago

You can try, for example, adding the packages that xrepo already has first

package("or-tools")
    set_homepage("https://developers.google.com/optimization/")
    set_description("Google's Operations Research tools")
    set_license("Apache-2.0")

    add_urls("https://github.com/google/or-tools/archive/refs/tags/$(version).tar.gz",
             "https://github.com/google/or-tools.git")

    add_versions("v9.9", "8c17b1b5b05d925ed03685522172ca87c2912891d57a5e0d5dcaeff8f06a4698")

    if is_plat("windows") then
        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
    end

    add_deps("cmake")
    add_deps("zlib", "eigen", "re2")
    add_deps("protobuf-cpp", {confgis = {zlib = true}})

    on_install("windows", "linux", "macosx", function (package)
        local configs = {
            "-DBUILD_TESTING=OFF",
            "-DBUILD_EXAMPLES=OFF",
            "-DBUILD_SAMPLES=OFF",
            "-DBUILD_DEPS=OFF",
            "-DUSE_BOP=OFF",
            "-DUSE_COINOR=OFF",
            "-DUSE_SCIP=OFF",
        }
        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
        import("package.tools.cmake").install(package, configs)
    end)

    on_test(function (package)
        assert(package:check_cxxsnippets({test = [[
            #include <ortools/linear_solver/linear_solver.h>
            void test() {
                auto solver = MPSolver::CreateSolver("SCIP");
            }
        ]]}, {configs = {languages = "c++20"}}))
    end)
fxxhuang commented 7 months ago

You can try, for example, adding the packages that xrepo already has first

package("or-tools")
    set_homepage("https://developers.google.com/optimization/")
    set_description("Google's Operations Research tools")
    set_license("Apache-2.0")

    add_urls("https://github.com/google/or-tools/archive/refs/tags/$(version).tar.gz",
             "https://github.com/google/or-tools.git")

    add_versions("v9.9", "8c17b1b5b05d925ed03685522172ca87c2912891d57a5e0d5dcaeff8f06a4698")

    if is_plat("windows") then
        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
    end

    add_deps("cmake")
    add_deps("zlib", "eigen", "re2")
    add_deps("protobuf-cpp", {confgis = {zlib = true}})

    on_install("windows", "linux", "macosx", function (package)
        local configs = {
            "-DBUILD_TESTING=OFF",
            "-DBUILD_EXAMPLES=OFF",
            "-DBUILD_SAMPLES=OFF",
            "-DBUILD_DEPS=OFF",
            "-DUSE_BOP=OFF",
            "-DUSE_COINOR=OFF",
            "-DUSE_SCIP=OFF",
        }
        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
        import("package.tools.cmake").install(package, configs)
    end)

    on_test(function (package)
        assert(package:check_cxxsnippets({test = [[
            #include <ortools/linear_solver/linear_solver.h>
            void test() {
                auto solver = MPSolver::CreateSolver("SCIP");
            }
        ]]}, {configs = {languages = "c++20"}}))
    end)

OK, I will try it late, thank for you kindness help.

fxxhuang commented 7 months ago

You can try, for example, adding the packages that xrepo already has first

package("or-tools")
    set_homepage("https://developers.google.com/optimization/")
    set_description("Google's Operations Research tools")
    set_license("Apache-2.0")

    add_urls("https://github.com/google/or-tools/archive/refs/tags/$(version).tar.gz",
             "https://github.com/google/or-tools.git")

    add_versions("v9.9", "8c17b1b5b05d925ed03685522172ca87c2912891d57a5e0d5dcaeff8f06a4698")

    if is_plat("windows") then
        add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
    end

    add_deps("cmake")
    add_deps("zlib", "eigen", "re2")
    add_deps("protobuf-cpp", {confgis = {zlib = true}})

    on_install("windows", "linux", "macosx", function (package)
        local configs = {
            "-DBUILD_TESTING=OFF",
            "-DBUILD_EXAMPLES=OFF",
            "-DBUILD_SAMPLES=OFF",
            "-DBUILD_DEPS=OFF",
            "-DUSE_BOP=OFF",
            "-DUSE_COINOR=OFF",
            "-DUSE_SCIP=OFF",
        }
        table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:is_debug() and "Debug" or "Release"))
        table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
        import("package.tools.cmake").install(package, configs)
    end)

    on_test(function (package)
        assert(package:check_cxxsnippets({test = [[
            #include <ortools/linear_solver/linear_solver.h>
            void test() {
                auto solver = MPSolver::CreateSolver("SCIP");
            }
        ]]}, {configs = {languages = "c++20"}}))
    end)

It config success , but build error, when install or-tools. Maybe those deps'version need to specify?