Skip to content

Building on MacOS for x86_64 architecture #77

@bapcyk

Description

@bapcyk

I am trying to use the library on arm-based MacOS which support both architectures (arm64, x86_64), it's so called "M1":

$ sw_vers
ProductName:            macOS
ProductVersion:         13.0.1
BuildVersion:           22A400
$ arch
arm64

and when I compile my application using the library for arm64 architecture - no problem (but it requires sudo ln -sf /opt/homebrew/Cellar/openssl@3/3.0.7 /usr/local/opt/openssl).

But when I try to switch to x86_64, I get an error like:

dlopen(/Xxx/.stack/snapshots/x86_64-osx/b1...50/9.2.5/lib/x86_64-osx-ghc-9.2.5/libHSHsOpenSSL-0.11.7.2-1JX1qBi8YfpGDjk1ra3OXq-ghc9.2.5.dylib, 0x0005): symbol not found in flat namespace '_DSA_free'

I do it by:

stack --resolver lts-20.4 --arch x86_64 build

and installed openssl with brew arch -x86_64 ./brew install openssl@3 from the folder (/usr/local/homebrew) where I installed Homebrew for x86_64.

I tried flags as well, but it does not help.

Not sure, why it happens, maybe it tries to use arm64 library. Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions