I'm trying to compile a simple C program on an M1 Mac that includes gmp.h
. For whatever reason, however, it continuously says that it can't find the library. I checked to see if it exists via locate libgmp.a
to which it says it is located in /opt/local/lib/libgmp.a
. I also attempted to install it via brew
to no avail. I really don't understand what I'm doing wrong here. I also checked the PATH environment variable to make sure this path was included, which it is.
The output of find /opt/local -type f -name "gmp.h"
is /opt/local/include/gmp.h
, and the output of find /opt/local -type f -name "libgmp*"
is
/opt/local/libgmp.a
/opt/local/lib/libgmpxx.4.dylib
/opt/local/lib/libgmp.a
/opt/local/lib/libgmpxx.a
/opt/local/lib/libgmp.10.dylib
I compiled by linking via -L/opt/local/lib -lgmp
does not fix the issue.
Command used: gcc main.c -o main.o -L/opt/local/lib -lgmp