radj307 / ARRCON

Lightweight Source RCON client that works on Windows, macOS, & Linux.
GNU General Public License v3.0
190 stars 10 forks source link

[BUG] dyld[12869]: Symbol not found #11

Closed FelixKLG closed 2 years ago

FelixKLG commented 2 years ago

# System Information

# 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.

radj307 commented 2 years ago

Looking into this.

Edit:

It doesn't seem like its currently possible to compile for ARM64 with github actions: https://github.com/actions/runner-images/issues/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

FelixKLG commented 2 years ago

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.

radj307 commented 2 years ago

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.

radj307 commented 2 years ago

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.

radj307 commented 2 years ago

As of https://github.com/radj307/ARRCON/commit/a97abfbd0978ec5136c9d9eefe34641b9644d7fb this should be fixed, with the following changes:

  1. (https://github.com/radj307/ARRCON/commit/d6e9473e20aaf89d648761225e6281316982e7b4) 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. (https://github.com/radj307/ARRCON/commit/1d2e1227914fc5ab6388948caf42f925898420c8, https://github.com/radj307/ARRCON/commit/a97abfbd0978ec5136c9d9eefe34641b9644d7fb) 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.

FelixKLG commented 2 years ago

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.

radj307 commented 2 years ago

I've implemented a fix for those errors as well in https://github.com/radj307/ARRCON/commit/efe4feb9982386da85dfee2547fe9f54e83b0890; sorry for the delay.

Let me know if any more issues spring up.

FelixKLG commented 2 years ago

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

radj307 commented 2 years ago

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

radj307 commented 2 years ago

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

FelixKLG commented 2 years ago

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)

radj307 commented 2 years ago

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.

radj307 commented 2 years ago

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

FelixKLG commented 2 years ago

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:

radj307 commented 1 year ago

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

radj307 commented 1 year ago

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