16 ms·
Building Elixir from source segfaults on macOS on Apple Silicon while compiling
- blairanderson 6y agoThe first comment on that thread is from the creator of Elixir: > Elixir doesn’t compile any native code. Therefore these errors mean that you were able to compile the Erlang VM but either the code or the compiler has bugs and the VM is seg faulting.
- drvdevd 6y agoI’ve run into errors compiling the Erlang VM before (just doing some Linux package management). If I casually ran into these types of issues on x86, I’m skeptical this really has anything to do with Apple Silicon, which is ARM after all.
- arjan_sch 6y agoErlang compiles and runs fine on ARM architectures in general. It is used extensively on IoT platforms like https://www.nerves-project.org/ https://www.nerves-project.org/
- KenoFischer 6y agoProbably not super well tested with a bleeding edge clang compiler though (and even for non-bleeding-edge versions, I'd suspect mostly tested with GCC). Triggering compiler bugs or exposing technically undefined behavior would not be entirely surprising.
- arjan_sch 6y agoTrue. IIRC Erlang only supports GCC as the build system. I helped fixing a race in the BEAM a while back that only occurred on the latest GCC.
- KenoFischer 6y ago> IIRC Erlang only supports GCC as the build system. Since gcc doesn't work on Apple Silicon, I assumed the OP must be using clang :).
- asveikau 6y agogcc certainly compiles for ARM and understands Darwin/mach-o. It can probably target iOS. What would the major barrier be for gcc to work?
- KenoFischer 6y agoSee https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96168 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96168.
- deleted 6y ago[deleted]
- asveikau 6y agoThis is a great thread, thanks! (And I see that your name is in the thread.) I gather from there that previous efforts to target iOS are outdated, there is substantial work to handle the Apple ABI, and that it's not been seriously looked at yet.
- manquer 6y agoGiven that Apple silicon is pretty new my guess it porting and testing , I would also add not all ARM chips are exactly the same , there will be some minor nuances for sure . Perhaps it is also some funding and access to the kits and dev time , updating gcc is not a full time job for most of the contributors after all.
- deleted 6y ago[deleted]
- 6y ago
- monocasa 6y agoDoes it support aarch64? AFAIK, the Apple SoCs these days don't support 32bit ARM anymore.
- Ndymium 6y agoBut in this case the Erlang VM was already compiled and running. It was compiling Elixir (using the Erlang VM) that crashed.
- dnautics 6y agonot every application sees every part of the beam VM. I wouldn't be surprised if test coverage on some new systems (like the new process group registry system) that depend on NIFs (C ABI FFI) isn't complete.
- pmontra 6y agoI compiled Erlang and Elixir on a Raspberry Pi 3. It's OK on that ARM chip. Maybe the compiler doesn't fully support the new Apple chip yet.
- js2 6y agoI tried to use clang to compile some NDK code on Android and the resulting binary segfaulted. I tracked it down to what appeared to be a bug with register spilling. The fix was to use gcc and hope the clang bug was eventually fixed. These things happen. https://groups.google.com/forum/m/#!topic/google-breakpad-discuss/uNjAGPCX1Fo https://groups.google.com/forum/m/#!topic/google-breakpad-di...
- pjmlp 6y agoI guess this was a while ago, given that GCC support has been dropped since a couple of releases.
- js2 6y agoYes about two years ago, but the bug wasn’t fixed till April this year and it looks like the fix was a work-around: https://chromium.googlesource.com/linux-syscall-support/+/be2d5a80df9a9519cab306508ce902d774da76a9 https://chromium.googlesource.com/linux-syscall-support/+/be...
- atonse 6y agoOff topic but I need to login to just view a google groups thread? I wish the DOJ had some balls and went after these monopolist pigs.
- oefrha 6y agoRelated: ongoing compatibility table compiled by the Homebrew team: https://github.com/Homebrew/brew/issues/7857 https://github.com/Homebrew/brew/issues/7857. (Please respect the team and refrain from polluting the thread. If in doubt check the comments marked off topic.)
- marcinzm 6y agoNo GCC support if I read that correctly and the effort is expected to take months of full time work. I wonder what that'd break or is Clang significantly more common on OSX now?
- KenoFischer 6y agoWell, for one, this means that Apple Silicon has no Fortran compiler, which breaks a decent chunk of the scientific computing ecosystem.
- dnautics 6y agois there not an flang project? Is it any good?
- KenoFischer 6y agoThere's several! We tried all of them without much luck :(. The most complete seems to be the old flang, which was basically an open sourced version of the PGI compiler hacked up to generate LLVM IR by concating strings to generate textual LLVM IR. However, that project is basically abandoned and also depends on LLVM 7, while you probably want at least LLVM 10 to generate good code for Apple Silicon, so somebody would have to do that porting work, which doesn't seem like a worthwhile investment.
- neurostimulant 6y agoHopefully apple will do something about it as they did advertise their new system would be great for machine learning and all, which seem to be moot without many popular numeric libraries that directly or indirectly use fortran. Would be great if clang/llvm suddenly gain a great open source fortran compiler just because apple moves to arm.
- vmchale 6y agoI expect that we'll see a lot of this. At least it's getting caught before it gets to consumers? But not entirely impressed with the work Apple is making developers shoulder.
- dilap 6y agoIs there any alternative though (other than not switching to ARM?)? I guess Apple could go out and try to preemptively fix all software, but that seems excessive to expect. :-)
- crooked-v 6y agoThey're actually actively contributing to a number of major open-source projects to fix ARM issues: https://twitter.com/wongmjane/status/1275177255681982464 https://twitter.com/wongmjane/status/1275177255681982464
- chongli 6y agoIf anyone out there is reading this and wondering whether the switch to ARM is part of some plan to eventually lock down macOS to the same level as iOS, they need only click the above link. Why would Apple dedicate engineers to fixing up all these open source projects if they were planning to lock them out? I think this very clearly demonstrates Apple’s commitment to supporting open source, user-installed software on Macs, outside of the Mac App Store.
- orangecat 6y agoYes, developers need to be able to run arbitrary code. But that's not inconsistent with macOS being locked down by default and requiring a developer certificate to run unapproved software. Of course, moving to ARM is orthogonal to that; Apple could just as easily impose restrictions on x86 Macs. The only immediate downside to ARM is the loss of the ability to boot other OSes, which has apparently been getting more difficult anyway due to custom hardware like the T2 chip.
- deleted 6y ago[deleted]
- Ijumfs 6y ago>a new architecture has some bugs OR >turns out the person compiled the thing with BSD make instead of gmake
- nazgulsenpai 6y agoHonest question, why go through this transition with macOS as a developer instead of Linux or Windows? Is there something that macOS provides developers that other operating systems don't?
- pmarreck 6y agoAs a user of all three OS’es... macOS generates the fewest admin headaches. I’ve slowly been moving more to Linux though
- atonse 6y agoA relatively smooth desktop experience and nice client apps, baseline security at the hardware level, and still the ability to get under the hood to a shell. Windows does this now with WSL2 especially, but the desktop experience still has a lot of cruft left over. I do look with envy at the choice of hardware on the Windows side though. Especially on the desktop side.
- noir_lord 6y agoBeen using OSX since just after xmas (work issued the new macbook pro) alongside Fedora (all my machines) and there really isn't any difference in terms of a "smooth desktop experience" which is a credit to Fedora and Cinnamon really. There are things I like about both platforms and things I dislike but I'm productive as a developer on either and mostly they feel the same. At home if I want to do some dev I'm more likely to reach for my thinkpad though because I prefer the keyboard and it runs a lot cooler on my knee.
- AsyncAwait 6y agoFrom experience I wouldn't call macOS a smooth experience personally, especially not 10.13, but I realize it depends if you ran into bugs personally or not.
- gumby 6y agoYou seem to be quite unhappy with it. Why do you use it at all? There are plenty of programming domains where other systems rule.
- Vosporos 6y agoAlways use gmake.
- Nursie 6y agoStupid question time - Where are these folks getting Apple silicon? Is there a dev MacOS distribution for iPad? Or is it likely they have preview hardware?
- xenospn 6y agoYou can buy it from Apple.
- donarb 6y agoNote, that it's more like a rental. You are required to return the equipment at the end of the beta period.
- rgovostes 6y agoThere is a Developer Transition Kit machine -- a Mac mini with an iPad CPU in it. https://developer.apple.com/programs/universal/ https://developer.apple.com/programs/universal/
- tosh 6y ago> Developer Transition Kit (DTK) https://developer.apple.com/programs/universal/ https://developer.apple.com/programs/universal/
- deleted 6y ago[deleted]
- samgranieri 6y agoThey're renting a developer transition kit that's basically a mac mini with an ipad pro chip until the end of the year for $500
- benmmurphy 6y agoThe elixir compiler runs jobs in parallel so it could be triggering a concurrency issue due to differences in the memory model between x86 and ARM. I’ve peered at the Erlang VM code and it looks like they are using primitives that are aware of the differences but they might not have covered everything. Until recently there was a concurrency bug in the VM that would trigger on elixir compiles that would cause compilation to hang on both x86 and ARM.
- st3fan 6y agoWhy is this news? Thousands of projects are in this position where they are porting to a new platform. This is normal.
- sfgweilr4f 6y agoI'm not seeing this as newsworthy either. All porting involves some changes and instability. This is "Water is wet" style news. Are we learning something new from this being widely reported? (very little from what I can see) Should be infer that there's something inherently wrong with Apple Silicon in that Elixir has an issue? (doubtful - its just new. no surprises multiple projects will need various bugfixes or code changes) Perhaps that this is insurmountable? (unlikely) Is this a case where large numbers of eyeballs being focused on it is somehow worthwhile or there are wide implications, eg its a major security incident? (no, unlikely) Is there some technical quirk that sparks interest? (not particularly) I don't understand how this is news.
- ogre_codes 6y agoThe words Apple and Elixir are both involved, two topics that many HN readers like to read about (including me). Even so, as you suggest, there are likely thousands of projects going through this transition right now. It's certain that the first retail Macs will lack some support for some things.
- karmakaze 6y agoHow interesting this might be depends on why it crashed. It's likely the compiler that compiled the Beam VM not producing the correct code for Apple silicon. If it turns out to be in the Apple ARM OS or possibly hardware, then it gets more interesting. Also, many top posts on HN these days I don't find newsworthy but I wouldn't say so categorically, just to me.
- justinmchase 6y agoIf it was caused by an underlying hardware problem with the chip not properly implementing arm then it would be very interesting but it seems like without that conclusively being the cause, its likely some other complex but much less interesting issue.
- olliej 6y agoAre there any 4k page size expectations built into the VM? From wwdc the DTKs have 16k pages?