Replies: 1 comment 3 replies
-
It would be very useful if you would like to contribute this to the build / install instructions. I've had similar "fun" times when using various versions of LLVM on MacOS. If you use macports, can you see what dynamic library dependencies the resulting c3c binary has? |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello. I came across C3 and thought I would give it a try.
I found there's no prebuilt binary for my platform.
Unfortunately brew is not supported on my older version of OSX so I use https://www.macports.org
I followed a variation of the instructions https://c3-lang.org/getting-started/compile
I had previously installed llvm-17 via macports so I thought I would be ok, but I had a few issues to work through.
Leaving this here for anyone else who may find the details useful and perhaps save a little time.
TL;DR
Although I already had llvm-17 on my system, I was not able to build c3c from a clone of the repository until doing the following steps
Details on what I did follow
First Attempt
After cloning the repository and creating a build/ directory the command "cmake .." failed with an error
Based on the output of "port info llvm-17" and "port contents llvm-17" I determined
I indeed had llvm-17 already, but didn't know the proper setting of LLVM_DIR.
After some searching I came across a mention of LLVM_DIR at https://forums.gentoo.org/viewtopic-t-1168721.html
which helped me find /opt/local/libexec/llvm-17/lib/cmake/llvm on my system.
Second Attempt
After removing and recreating the build/ directory and explicitly setting
the "cmake .." command failed with different errors
and as expected the "cmake --build ." step quickly failed
More searching turned up #399
which confirmed my belief that I was likely missing lld or it was in an unexpected place.
On a whim I tried searching for the header file in the error message.
Very odd... why did I have the file for llvm-15 and llvm-18 but not llvm-17?
And why did I have those at all? Well some weeks ago I installed various
versions of clang in an effort to build zig from source, which made me believe
I probably needed clang-17 in addtion to llvm-17
Running "sudo port install clang-17" provided me with
/opt/local/libexec/llvm-17/include/lld/Common/CommonLinkerContext.h
as expected.
Third Attempt
This time I was able to build c3c successfully
This c3c build and ran the "hello_world.c3" as described at https://c3-lang.org/getting-started/hello-world
otool output
In response to @lerno, here is the output of "otool -L hello_world"
Also a "hello_world.dSYM" was built as well with the following contents
Beta Was this translation helpful? Give feedback.
All reactions