radj307/ARRCON

[BUG] dyld[12869]: Symbol not found

FelixKLG opened this issue · 16 comments

# System Information

  • OS: MacOS Ventura 13.0.1 (22A400)
  • Version: 3.3.5
  • Shell (Windows-Only): N/A

# Bug Description

Expectation:
Application to run

Occured:
Symbol not found error

Terminal Output:
https://app.warp.dev/block/gWnBoFiwufKHpgeHIxsPOB

# Reproduction Steps

Download latest release on MacOS (M1 Max)
Unzip and run executable
Oberseve Error

I feel this error is likely caused by the new Apple M1 Arm64 architecture.

Looking into this.

Edit:

It doesn't seem like its currently possible to compile for ARM64 with github actions: actions/runner-images#5631
Unfortunately that means I don't actually have any way to (legally) compile & distribute for MacOS ARM64 architecture since I don't have access to a machine with that architecture. You can compile it yourself on that machine, however.

related: https://www.pantsbuild.org/v2.12/docs/ci-for-macos-on-arm64

I have cloned the repo locally however, I am not too familiar with C++ (and GCC/make) which means I have no real idea how to work around this error.

https://app.warp.dev/block/EgkrtquOeZicqYPl7R1eaO

I CD'd into the repo, and ran make.

The log that you posted mentioned a failure to resolve a symbol from /usr/lib/libstdc++.6.dylib; that likely means that you're missing the libstdc++6 library. Do you have that installed and in the correct location?

Assuming that your device's commandline is similar to debian linux, run this command (or some variation of it) sudo apt-get install libstdc++6 -y from a terminal and try it again.

I have cloned the repo locally however, I am not too familiar with C++ (and GCC/make) which means I have no real idea how to work around this error.

https://app.warp.dev/block/EgkrtquOeZicqYPl7R1eaO

I CD'd into the repo, and ran make.

Follow this guide to build from source: https://github.com/radj307/ARRCON/wiki/Building-from-Source
Judging by the rest of your log though, I'm going to fix the noted compilation errors in case that doesn't work.

As of a97abfb this should be fixed, with the following changes:

  1. (d6e9473) If the cmake cache variable APPLE is True, the executable is built using explicit static linking.
    This should circumvent the issue of libstdc++6 not being included by default on newer M1-based macOS systems.
  2. (1d2e122, a97abfb) Bumped lib version and fixed compilation warning-errors mentioned in your compilation log.
    This should fix any issues that you had while attempting to compile ARRCON on your ARM64 device.
    Note that you'll still need the libstdc++6 package to build it.

Please let me know if you're still having issues.

running make spits out the following errors:
https://app.warp.dev/block/8overa0nrOVmK8YxpMzW4Y

I deleted my local clone and re-cloned it so this is on the latest commit.

I've implemented a fix for those errors as well in efe4feb; sorry for the delay.

Let me know if any more issues spring up.

Compilation went further than last time however, I still ran into the same issue and then some other ones.
https://app.warp.dev/block/HudSsAadAIN7cGeOqS3N9H

What version of gcc do you have? (Run gcc --version)

Also, can you confirm that the original bug still occurs when libstdc++6 is installed?

GCC/G++:
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I also somewhat under the belief that libstdc++6 is installed. (Due to my XCode install)

You aren't actually using GCC, you're using Apple clang (it doesn't have all of the features from C++20 implemented yet).
ARRCON is written using C++20, so you'll need a compiler that supports that (gcc version 10 or newer).

Here's a guide on installing gcc/g++ with xcode: https://www.cyberciti.biz/faq/howto-apple-mac-os-x-install-gcc-compiler/
That guide is for OS X Mountain Lion but hopefully it'll be transferable.


Regarding libstdc++; Apple clang's implementation uses the libc++ standard library instead of the usual libstdc++ provided by gcc.

Installing gcc 10 or newer should fix the problem.
I'm sorry I can't be of more help since I don't own a mac to test this on.

I'm unfamiliar with apple's implementation of make, but that isn't the process that I use to build ARRCON in my build script so I figured I would elaborate on exactly what commands to run:

All of these commands are pulled directly from the CI script that compiles & creates github releases:
https://github.com/radj307/ARRCON/blob/main/.github/workflows/GenerateRelease.yml
The parts that are important for macOS can be summarized as follows:
(Requires cmake v3.22 or newer, ninja, & gcc-10 or newer)

git clone https://github.com/radj307/ARRCON && cd ARRCON
git submodule update --init --recursive
cmake -B "build" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ -G Ninja
cmake --build "build" ---config Release

The executable is then retrieved from build/ARRCON/ARRCON

I am able to report after installing and linking GCC and G++ manually I was able to compile the code successfully.
image

A little run-down on the steps I had to take incase anyone else has similar issues:

  • Install XCode build tools (xcode-select --install)
  • Install Homebrew
  • Install gcc via homebrew (brew install gcc)
  • Link gcc and g++ to /usr/local/bin/ or add the install path to the PATH env var (If using Apple Silicon link the aarch64 versions)
  • Install ninja using brew (brew install ninja)
  • Install cmake using brew (brew install cmake)
  • Clone repo and run git submodules commands
  • Run above cmake commands
  • Now it works

Glad to hear that you got it working, and many thanks for the step-by-step guide!

The issue of required libraries not being included on new versions of macOS has been continued here: #12