简体   繁体   English

自新的 M 系列笔记本电脑以来,vcpkg 是否仍可在 macOS 上运行?

[英]Does vcpkg still work on macOS since new M series laptops?

While using QtCretor I put together the following:在使用 QtCretor 时,我将以下内容放在一起:

#include <iostream>
#include <string>

#include <fmt/core.h>

using namespace std;

int main(int argc, char *argv[])
{
    cout  << "starting..." << endl;

    std::string s = fmt::format("The answer is {}.", 42);

    return 0;
}
CONFIG -= debug_and_release debug_and_release_target

CONFIG += c++17

CONFIG(debug, debug|release) {
     MODE = debug
     d = d
} else {

}

INCLUDEPATH += $$(VCPKG)/include
     LIBS += -L$$(VCPKG)/$${MODE}/lib
     LIBS += -lfmt$${d}

SOURCES += \
    main.cpp \

HEADERS += \

Where I set我设置的地方

export VCPKG=~/vcpkg/installed/arm64-osx

Installed fmt with vcpkg on MacBook Air M1.在 MacBook Air M1 上使用vcpkg安装了fmt But then got:但后来得到:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names  -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=10.13 -Wl,-rpath,@executable_path/../Frameworks -Wl,-rpath,/Users/user/Qt/5.15.2/clang_64/lib -o project.app/Contents/MacOS/project main.o   -F/Users/user/Qt/5.15.2/clang_64/lib -L/Users/user/vcpkg/installed/arm64-osx/debug/lib -lfmtd -framework QtGui -framework AppKit -framework Metal -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL   
ld: warning: ignoring file /Users/user/vcpkg/installed/arm64-osx/debug/lib/libfmtd.a, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
Undefined symbols for architecture x86_64:
  "fmt::v9::vformat(fmt::v9::basic_string_view<char>, fmt::v9::basic_format_args<fmt::v9::basic_format_context<fmt::v9::appender, char> >)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [project.app/Contents/MacOS/project] Error 1
17:25:55: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project project (kit: Desktop Qt 5.15.2 clang 64bit)
The kit Desktop Qt 5.15.2 clang 64bit has configuration issues which might be the root cause for this problem.
When executing step "Make"

What should I do?我应该怎么办?

Adding (as pointed by Marek_R)添加(如 Marek_R 所指出的)

QMAKE_APPLE_DEVICE_ARCHS = arm64

to.pro seems to solve the problem. to.pro 似乎解决了这个问题。

Still wondering why that's not the default behavior though.仍然想知道为什么这不是默认行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM