d99kris / nchat

Terminal-based Telegram / WhatsApp client for Linux and macOS
MIT License
538 stars 41 forks source link

Issue Building on M1 Mac #107

Closed AjayShanker-geek closed 1 year ago

AjayShanker-geek commented 1 year ago

Description: Unable to build Error -> ld: warning: ignoring file go/libcgowm.dylib, building for macOS-arm64 but attempting to link with file built for macOS-arm64

How to reproduce it:

Running Build

Environment:

d99kris commented 1 year ago

Hi @AjayShanker-geek - is this from a clean/fresh clone of nchat? If not, please try clone a fresh one and build.

If it's a clean build failing - can you share the version of nchat (see lib/common/src/version.h)? Also what is the output from go version and which go?

I build/run nchat on M2 / Ventura without any issues. I don't anticipate M1 being much different, but I'll see if I can try it.

AjayShanker-geek commented 1 year ago

Hi @d99kris,

I have reclone and still facing the same issue.

d99kris commented 1 year ago

Thanks. I'm not sure what the problem is yet, but just in case you're only looking to use nchat for Telegram you can disable WhatsApp (which uses golang) to maybe work around the problem. Something like this:

rm -rf build
mkdir -p build && cd build && cmake -DHAS_WHATSAPP=OFF .. && make -s
AjayShanker-geek commented 1 year ago

Alright, telegram part works. I can help to figure it on my free time.

d99kris commented 1 year ago

Thanks for the update 👍

Btw, I did some googling and it seemed having an additional build toolchain could cause that build error. Do you have the brew package binutils installed? I believe one can check with brew list binutils. Or check if you have more than one ar or ranlib with which ar and which ranlib respectively.

I'm planning to try installing binutils myself to try reproduce, but I haven't had the chance yet.

AjayShanker-geek commented 1 year ago

Yes, I got binutils installed via brew. I managed to compiled after uninstalling binutils. Hope it helps others too, cheers!

d99kris commented 1 year ago

Great, thanks! 👍 I'll probably still try to see if I can get nchat build to detect and use the appropriate buildchain, but thanks for confirming having binutils is showing the issue. 👍

d99kris commented 1 year ago

I'll probably still try to see if I can get nchat build to detect and use the appropriate buildchain

For my own future reference, I tried modifying lib/wmchat/go/CMakeLists.txt to pass env vars like

  AR="${CMAKE_AR}"
  CC="${CMAKE_C_COMPILER}"
  CXX="${CMAKE_CXX_COMPILER}"

to the go build command, but apparently it is not sufficient. Will leave this as-is in nchat for now.