ld: warning: ignoring file, found architecture 'arm64', required architecture 'x86_64'

gcc -I/opt/homebrew/opt/postgresql@15/include -I/opt/homebrew/Cellar/openssl@3/3.2.1/include -fPIC -c -o pkg/publisher/pg/clibpq/copy.o pkg/publisher/pg/clibpq/copy.c gcc -shared -L/opt/homebrew/opt/postgresql@15/lib -lpq -o pkg/publisher/pg/clibpq/libcopy.so pkg/publisher/pg/clibpq/copy.o ld: warning: ignoring file '/opt/homebrew/Cellar/postgresql@15/15.6_1/lib/libpq.5.15.dylib': found architecture 'arm64', required architecture 'x86_64' ld: Undefined symbols: _PQclear, referenced from: _copy_table_data in copy.o _copy_table_data in copy.o _copy_table_data in copy.o _start_copy_origin_tx in copy.o _start_copy_origin_tx in copy.o _start_copy_target_tx in copy.o _finish_copy_origin_tx in copy.o ... clang: error: linker command failed with exit code 1 (use -v to see invocation)

Error compiling code with new arch arm64

It looks like you’re trying to build for Intel but the libpq.5.15.dylib library is built for Apple silicon. Are you building on Intel? If so, you’ll need to tell your compiler driver to build for Apple silicon.

As to how you do that, that depends on whether the gcc is your command is actually GCC or whether you’re using Clang via the gcc alias:

  • If it’s the former, I can’t help you. I don’t maintain expertise in GCC.

  • If it’s the latter, you do this by passing in the ‘triple’ via the -target option.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

ld: warning: ignoring file, found architecture 'arm64', required architecture 'x86_64'
 
 
Q