xmake-io / xmake

🔥 A cross-platform build utility based on Lua
https://xmake.io
Apache License 2.0
9.81k stars 774 forks source link

MacBook Pro M3 install boost 1.85 failed #5438

Open LiuYuan-SHU opened 1 month ago

LiuYuan-SHU commented 1 month ago

Xmake Version

v2.9.4+20240805

Operating System Version and Architecture

macOS Sonoma 14.5 (23F79)

Describe Bug

Install boost failed with command: xrepo install boost:

  => installing boost .. (1/b2) checking for Xcode directory ... %s
checking for Codesign Identity of Xcode ... no
  => install boost 1.85.0 .. failed

package(boost): links not found!
if you want to get more verbose errors, please see:
  -> ~/.xmake/cache/packages/2408/b/boost/1.85.0/installdir.failed/logs/install.txt

For more details:

manifest.txt:

{
    arch = "arm64",
    artifacts = {
        installdir = "/Users/liuyuan38/.xmake/packages/b/boost/1.85.0/681ad685c2464a94a7953076c870ac3a"
    },
    configs = {
        all = false,
        atomic = false,
        charconv = false,
        chrono = false,
        cobalt = false,
        container = false,
        context = false,
        contract = false,
        coroutine = false,
        date_time = false,
        debug = false,
        exception = false,
        fiber = false,
        filesystem = true,
        graph = false,
        graph_parallel = false,
        headers = false,
        iostreams = false,
        json = false,
        locale = false,
        log = false,
        lzma = false,
        math = false,
        mpi = false,
        multi = true,
        nowide = false,
        pic = true,
        program_options = false,
        python = false,
        pyver = "3.10",
        random = false,
        regex = false,
        serialization = false,
        shared = false,
        stacktrace = false,
        system = false,
        test = false,
        thread = false,
        timer = false,
        type_erasure = false,
        url = false,
        wave = false,
        zstd = false
    },
    description = "Collection of portable C++ source libraries.",
    envs = {
        DYLD_LIBRARY_PATH = {
            "lib"
        },
        LD_LIBRARY_PATH = {
            "lib"
        }
    },
    license = "BSL-1.0",
    mode = "release",
    name = "boost",
    pathenvs = {
        "PATH",
        "ACLOCAL_PATH",
        "LD_LIBRARY_PATH",
        "PKG_CONFIG_PATH",
        "DYLD_LIBRARY_PATH",
        "PYTHONPATH",
        "CMAKE_PREFIX_PATH"
    },
    plat = "macosx",
    repo = {
        branch = "master",
        commit = "99bec44e528ea401d9244b89ddc97d06bbf0ed4f",
        name = "xmake-repo",
        url = "https://gitee.com/tboox/xmake-repo.git"
    },
    vars = {
        links = {
            "boost_atomic-mt",
            "boost_charconv-mt",
            "boost_chrono-mt",
            "boost_cobalt-mt",
            "boost_container-mt",
            "boost_context-mt",
            "boost_contract-mt",
            "boost_coroutine-mt",
            "boost_date_time-mt",
            "boost_exception-mt",
            "boost_fiber-mt",
            "boost_filesystem-mt",
            "boost_graph-mt",
            "boost_graph_parallel-mt",
            "boost_headers-mt",
            "boost_iostreams-mt",
            "boost_json-mt",
            "boost_locale-mt",
            "boost_log_setup-mt",
            "boost_log-mt",
            "boost_math-mt",
            "boost_mpi-mt",
            "boost_nowide-mt",
            "boost_program_options-mt",
            "boost_python310-mt",
            "boost_numpy310-mt",
            "boost_random-mt",
            "boost_regex-mt",
            "boost_serialization-mt",
            "boost_stacktrace_backtrace-mt",
            "boost_stacktrace_basic-mt",
            "boost_system-mt",
            "boost_test-mt",
            "boost_thread-mt",
            "boost_timer-mt",
            "boost_type_erasure-mt",
            "boost_url-mt",
            "boost_wave-mt"
        }
    },
    version = "1.85.0"
}

install.txt:

package(boost): links not found!

references.txt:

{
    ["/private/var/folders/05/rbcqlngd5x37bkglcwvbh4240000gn/T/.xmake501/240805/xrepo/working"] = "240805"
}

Expected Behavior

Installation command should succeed

Project Configuration

None

Additional Information and Error Logs

None

waruqi commented 1 month ago

I haven't m3 machine. if it works, it will install two lib files in lib directory. and xmake will find them , use them as links. -lboost_atomic-mt. ...

You can find cache directory. ~/.xmake/cache/packages/2408/b/boost/1.85.0/installdir.failed and check these files.

  libfiles = {
    "/Users/ruki/.xmake/packages/b/boost/1.85.0/ea54d63440cc46f2befc6c2c911bdf9f/lib/libboost_atomic-mt.a",
    "/Users/ruki/.xmake/packages/b/boost/1.85.0/ea54d63440cc46f2befc6c2c911bdf9f/lib/libboost_filesystem-mt.a"
  },

or you can add -vD to get more verbose info.

It works for me on my macos/intel machine.

LiuYuan-SHU commented 1 month ago

It's really strange. I've installed boost1.84 successfully on M1, yet it does not work on M3. Maybe it is a platform-based problem. BTW, there are no lib files under the cache dir:

➜  installdir.failed tree
.
├── lib
│   ├── cmake
│   │   ├── Boost-1.85.0
│   │   │   ├── BoostConfig.cmake
│   │   │   └── BoostConfigVersion.cmake
│   │   └── BoostDetectToolset-1.85.0.cmake
│   └── pkgconfig
│       └── boost.pc
├── logs
│   └── install.txt
├── manifest.txt
└── references.txt

6 directories, 7 files

With -vD option, here's detailed error:

/Users/liuyuan/.local/bin/xmake create -P .
create working ...
  [+]: xmake.lua
  [+]: src/main.cpp
  [+]: .gitignore
create ok!
/Users/liuyuan/.local/bin/xmake f -c --require=n -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
checkinfo: cannot runv(nim --version), No such file or directory
checking for nim ... no
checkinfo: cannot runv(nim --version), No such file or directory
checking for nim ... no
configure
{
    buildir = build
    plat = macosx
    ccache = true
    mode = release
    ndk_stdcxx = true
    clean = true
    kind = static
    host = macosx
    arch = arm64
}
/Users/liuyuan/.local/bin/xmake require -v -D -j 10 --extra={system=false} boost
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(gitee.com) ... 21 ms
pinging the host(github.com) ... 77 ms
pinging the host(gitlab.com) ... 144 ms
/usr/bin/git rev-parse HEAD
finding boost from xmake ..
checking for xmake::boost ... no
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
  -> boost 1.85.0
please input: y (y/n/m)

/usr/bin/tar -xf boost-1.85.0-b2-nodocs.tar.gz -C source.tmp
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 the linker (ld) ... clang++
./bootstrap.sh --prefix=/Users/liuyuan/.xmake/packages/b/boost/1.85.0/681ad685c2464a94a7953076c870ac3a --libdir=/Users/liuyuan/.xmake/packages/b/boost/1.85.0/681ad685c2464a94a7953076c870ac3a/lib --without-icu --with-toolset=clang
Building B2 engine..

###
###
### Using 'clang' toolset.
###
###

Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

###
###

> clang++ -x c++ -std=c++11 -O3 -s -Wno-deprecated-declarations -DNDEBUG bindjam.cpp builtins.cpp class.cpp command.cpp compile.cpp constants.cpp cwd.cpp debug.cpp debugger.cpp execcmd.cpp execnt.cpp execunix.cpp filent.cpp filesys.cpp fileunix.cpp frames.cpp function.cpp glob.cpp hash.cpp hcache.cpp hdrmacro.cpp headers.cpp jam_strings.cpp jam.cpp jamgram.cpp lists.cpp make.cpp make1.cpp md5.cpp mem.cpp modules.cpp native.cpp option.cpp output.cpp parse.cpp pathnt.cpp pathsys.cpp pathunix.cpp regexp.cpp rules.cpp scan.cpp search.cpp startup.cpp tasks.cpp timestamp.cpp value.cpp variable.cpp w32_getreg.cpp mod_jam_builtin.cpp mod_jam_class.cpp mod_jam_errors.cpp mod_jam_modules.cpp mod_order.cpp mod_path.cpp mod_property_set.cpp mod_regex.cpp mod_sequence.cpp mod_set.cpp mod_string.cpp mod_summary.cpp mod_sysinfo.cpp mod_version.cpp -o b2
ld: warning: -s is obsolete
tools/build/src/engine/b2
Detecting Python version... 3.12
Detecting Python root... /opt/local/Library/Frameworks/Python.framework/Versions/3.12
Unicode/ICU support for Boost.Regex?... disabled.
Generating B2 configuration in project-config.jam for clang...

Bootstrapping is done. To build, run:

    ./b2

To generate header files, run:

    ./b2 headers

The configuration generated uses clang to build by default. If that is
unintended either use the --with-toolset option or adjust configuration, by
editing 'project-config.jam'.

Further information:

   - Command line help:
     ./b2 --help

   - Getting started guide:
     http://www.boost.org/more/getting_started/unix-variants.html

   - B2 documentation:
     http://www.boost.org/build/

./b2 headers
Performing configuration checks

    - default address-model    : 64-bit [1]
    - default architecture     : arm [1]

[1] clang-15
...found 2 targets...
checking for Xcode directory ... %s
checking for Codesign Identity of Xcode ... no
finding boost from xmake ..
checking for xmake::boost ... boost 1.85.0
{
  version = "1.85.0",
  license = "BSL-1.0"
}

patching /Users/liuyuan/.xmake/packages/b/boost/1.85.0/681ad685c2464a94a7953076c870ac3a/lib/pkgconfig/boost.pc ..
error: @programdir/core/package/package.lua:2420: package(boost): links not found!
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:973]:
    [@programdir/core/package/package.lua:2420]: in function '_generate_build_configs'
    [@programdir/core/package/package.lua:2584]: in function 'check_cxxsnippets'
    [...xmake/repositories/xmake-repo/packages/b/boost/xmake.lua:409]: in function 'script'
    [...dir/modules/private/action/require/impl/utils/filter.lua:114]: in function 'call'
    [...dir/modules/private/action/require/impl/actions/test.lua:41]:
    [.../modules/private/action/require/impl/actions/install.lua:444]:

  => install boost 1.85.0 .. failed
error: @programdir/core/main.lua:329: @programdir/modules/async/runjobs.lua:325: .../modules/private/action/require/impl/actions/install.lua:506: install failed!
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:973]:
    [.../modules/private/action/require/impl/actions/install.lua:506]: in function 'catch'
    [@programdir/core/sandbox/modules/try.lua:123]: in function 'try'
    [.../modules/private/action/require/impl/actions/install.lua:370]:
    [...modules/private/action/require/impl/install_packages.lua:491]: in function 'jobfunc'
    [@programdir/modules/async/runjobs.lua:241]:

stack traceback:
    [C]: in function 'error'
    @programdir/core/base/os.lua:973: in function 'base/os.raiselevel'
    (...tail calls...)
    @programdir/core/main.lua:329: in upvalue 'cotask'
    @programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
error: @programdir/core/main.lua:329: @programdir/core/sandbox/modules/os.lua:378: execv(/Users/liuyuan/.local/bin/xmake require -v -D -j 10 --extra={system=false} boost) failed(255)
stack traceback:
    [C]: in function 'error'
    [@programdir/core/base/os.lua:973]:
    [@programdir/core/sandbox/modules/os.lua:378]:
    [@programdir/modules/private/xrepo/action/install.lua:300]: in function '_install_packages'
    [@programdir/modules/private/xrepo/action/install.lua:307]:
    [@programdir/modules/private/xrepo/main.lua:196]:
    [@programdir/plugins/lua/main.lua:124]:
    [C]: in function 'xpcall'
    [@programdir/core/base/utils.lua:275]:
    [@programdir/core/base/task.lua:491]: in function 'run'
    [@programdir/core/main.lua:327]: in function 'cotask'
    [@programdir/core/base/scheduler.lua:406]:

stack traceback:
    [C]: in function 'error'
    @programdir/core/base/os.lua:973: in function 'base/os.raiselevel'
    (...tail calls...)
    @programdir/core/main.lua:329: in upvalue 'cotask'
    @programdir/core/base/scheduler.lua:406: in function <@programdir/core/base/scheduler.lua:399>
waruqi commented 1 month ago

you can check and debug here. https://github.com/xmake-io/xmake-repo/blob/526c64636d036bd30a73a06b9dd628ba3074be3e/packages/b/boost/xmake.lua#L169

git clone https://github.com/xmake-io/xmake-repo.git
cd xmake-repo 
xmake l scripts/test.lua --shallow -vD boost

It shoud generate two basic lib files. you can try to find it from the build directory.

Maybe it's because you don't have xcode installed, but I can't guarantee it. Because I have xcode here.