TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How to compile C apps with musl and Clang

79 pointsby Proceduralalmost 10 years ago

9 comments

vezzy-fnordalmost 10 years ago
The more awareness musl gets, the better. See also Sabotage Linux, a musl-based distro: <a href="https:&#x2F;&#x2F;github.com&#x2F;sabotage-linux&#x2F;sabotage" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;sabotage-linux&#x2F;sabotage</a>
评论 #9791855 未加载
评论 #9796977 未加载
评论 #9791833 未加载
esjeonalmost 10 years ago
I&#x27;ve been digging musl + clang too. Here&#x27;s my wrapper script that I use to compile a number of projects: <a href="https:&#x2F;&#x2F;github.com&#x2F;esjeon&#x2F;musl-clang" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;esjeon&#x2F;musl-clang</a><p>This isn&#x27;t perfect, but kinda works (even with autoconf). I also tried to add musl support into LLVM&#x2F;clang, but I&#x27;ve been too busy recently, and won&#x27;t be able to work on it for a while.<p>A side note: Clang is such a beauty whose structure is so easy to understand yet very extendible. There are actually few things to be done on clang to support musl. Just implement a proper frontend, and you&#x27;re mostly done. But it&#x27;s kinda difficult to patch codes which assume glibc, and the fact that musl refuses to export __MUSL__ macro makes the job even harder.
mschuster91almost 10 years ago
Excuse the noob question, but why are there different libc implementations at all? I mean, their featureset is defined by standard, so all implementations should strive for the maximum performance - so where comes the bloat from?<p>Support for multiple archs is of course a valid source for percieved bloat, but that should matter only at compile time?
评论 #9792083 未加载
评论 #9792165 未加载
评论 #9792114 未加载
评论 #9792620 未加载
gctalmost 10 years ago
Must everything be an &quot;app&quot;? Whatever happened to programs or god forbid unabbreviated applications
评论 #9793262 未加载
stefanmielkealmost 10 years ago
Did someone acessed the website through mobile? I can&#x27;t go past the title.<p>Edit: Using an iPad 2.
评论 #9791918 未加载
评论 #9792014 未加载
justincormackalmost 10 years ago
You will after a bit run into issues using Musl with a wrapper script, in my experience, and you are better off using a Musl based distro. You can run one in a chroot, I used to use Sabotage like that quite a bit, or if you use Docker you can just use &quot;FROM alpine&quot; and everything will be nice and statically linked, or you can do an install in a VM.
fizixeralmost 10 years ago
musl is great, but it would great if there was something at the compiler level that is better than both gcc and LLVM&#x2F;Clang.<p>LLVM&#x2F;Clang is a step in the right direction but it&#x27;s quite bloated because of support for C++, Objective-C etc (for C standards at least); not to mention it&#x27;s written in C++.<p>Being a Python&#x2F;C hybrid enthusiast, I looked into taking something like Eli Bendersky&#x27;s pycparser and making it featureful (preprocesser parsing at the minimum), but haven&#x27;t done anything in that direction. Maybe some way of combining pycparser and tcc.
评论 #9791811 未加载
评论 #9791913 未加载
评论 #9792023 未加载
GFK_of_xmaspastalmost 10 years ago
Real classy sample program there.
srikualmost 10 years ago
Seems impossible to read the article on an iphone.