I am trying to install C API of tensorflow on Macbook M1 to execute it in Go. I followed this guide by tensorflow developers but got stuck when running the hello_tf.c file with this command gcc hello_tf.c -ltensorflow -o hello_tf.
This is hello_tf.c file
#include <stdio.h>
#include <tensorflow/c/c_api.h>
int main() {
printf("Hello from TensorFlow C library version %s\n", TF_Version());
return 0;
}
And this is the error log:
ld: warning: ignoring file /usr/local/lib/libtensorflow.2.7.0.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
Undefined symbols for architecture arm64:
"_TF_Version", referenced from:
_main in hello_tf-6f1778.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation
Any suggestions on how to get the compilation fixed?
Related
It is definitely possible to target Intel when compiling on an Apple Silicon (ARM64) system, as Xcode does that all the time when building universal bundles of an app. However, I am unable to replicate this compiling a C program with make (specifically Stockfish).
What I've tried
I'm invoking make like so: make build ARCH=x86-64-modern COMP=clang (the same command works when I substitute x86-64-modern for apple-silicon). I've tried using the gcc compiler, which also worked when targeting the apple-silicon arch.
The problem
The make build command terminates with a bunch of errors, most importantly:
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Above the error is a bunch of lines complaining that a file was built for an "unknown bitcode architecture:
ld: warning: ignoring file <name>.o, lto file was built for unknown bitcode architecture which is not the architecture being linked (x86_64): <name>.o
So, it seems like the compilation phase succeeds, but the linking phase fails due to missing symbols. How would I acquire and provide the missing symbols to ld such that it can link successfully?
I have just started coding in c on my MacBook Air(m1). But whenever I code anything on VS code it throws the following error.
Undefined symbols for architecture x86_64:
"_main", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have installed all the extensions and the clang as well but it always shows this error. I am new to coding and have very little idea about it.
I installed gcc on my mac os but i don't it doesn't work due to a clang module, i used gcc my_program.c -Wall -o prog.
I have tried to reinstall and to follow some answers online , it doesn't work
When i compiled i got this in my terminal :
Undefined symbols for architecture x86_64:
"_omp_get_thread_num", referenced from:
_tri_pair_impair in tri_pair_impair-a7c555.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I except to be able to compile my C code with gcc to do parallel computing
I am working on Mac and I installed TensorFlow for C following this tutorial: https://www.tensorflow.org/install/install_c
When I try to validate the installation by running the tutorial example "hello_tf.c" I get the following message error:
Undefined symbols for architecture x86_64:
"_TF_Version", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I installed TensorFlow by looking this tutorial here https://www.tensorflow.org/install/install_mac and the validation was successful.
How can I fix this problem? I would be also interested to know the reasons for this issue
I'm trying to install WiiUse (https://github.com/rpavlik/wiiuse) on my El Capitan.
First I downloaded all the git, then I followed the instruction and when I try to run the example I get this error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to solve this?