www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dub support for Mac M1?

reply tastyminerals <tastyminerals gmail.com> writes:
I got a company MacBook with M1 chip and gradually migrate all 
the stuff from Linux machine. I got precompiled ldc binary 
installed without any problem now is the time for dub since I 
have couple of D projects I use at work and all of them use dub.

I can only see the dub-v1.23.0-osx-x86_64.tar.gz package so it 
should at least run via Rosetta. I also tried compiling it via 
MacPorts but looks like dub pulls dmd as a dependency and dmd 
fails to build currently. For example:

"""
$ sudo port install dub
Warning: The macOS 11.2 SDK does not appear to be installed. 
Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line 
Tools package by running `xcode-select --install'.
--->  Computing dependencies for dub
The following dependencies will be installed:
  dmd
  dmd-tools
  druntime
  phobos
Continue? [Y/n]: y
Warning: The macOS 11.2 SDK does not appear to be installed. 
Ports may not build correctly.
Warning: You can install it as part of the Xcode Command Line 
Tools package by running `xcode-select --install'.
--->  Fetching archive for dmd
--->  Attempting to fetch dmd-2.088.0_0.darwin_20.arm64.tbz2 from 
https://lil.fr.packages.macports.org/dmd
--->  Attempting to fetch dmd-2.088.0_0.darwin_20.arm64.tbz2 from 
https://mse.uk.packages.macports.org/dmd
--->  Attempting to fetch dmd-2.088.0_0.darwin_20.arm64.tbz2 from 
https://packages.macports.org/dmd
--->  Building dmd
Error: Failed to build dmd: command execution failed
Error: See 
/opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_l
ng_dmd/dmd/main.log for details.
Error: Follow https://guide.macports.org/#project.tickets to 
report a bug.
Error: Processing of port dub failed
"""

We look into the logs and see
"""
:info:build      (maybe you meant: dt_writeToObj(Obj*, dt_t*, 
int, unsigned long long&), file_write(char*, void*, unsigned int) 
, Obj_write_pointerRef(Symbol*, unsigned int) , 
Obj_write_bytes(seg_data*, unsigned int, void*) , 
__D3dmd4glue18obj_write_deferredRCQBf3lib7LibraryZ5counti , 
Obj_write_zeros(seg_data*, unsigned long long) , 
obj_write_deferred(Library*) , Obj_write_byte(seg_data*, unsigned 
int) )
:info:build ld: symbol(s) not found for architecture i386
:info:build clang: error: linker command failed with exit code 1 
(use -v to see invocation)
:info:build Error: linker exited with status 1
:info:build make: *** [../generated/osx/release/32/dmd] Error 1
"""

Are there any plans to support M1 for dub?
Mar 04 2021
next sibling parent Max Haughton <maxhaton gmail.com> writes:
On Thursday, 4 March 2021 at 22:30:17 UTC, tastyminerals wrote:
 I got a company MacBook with M1 chip and gradually migrate all 
 the stuff from Linux machine. I got precompiled ldc binary 
 installed without any problem now is the time for dub since I 
 have couple of D projects I use at work and all of them use dub.

 [...]
If someone with an M1 wants to get it working the patch is appreciated but I (for one) don't have one so I can't.
Mar 04 2021
prev sibling parent reply kinke <noone nowhere.com> writes:
On Thursday, 4 March 2021 at 22:30:17 UTC, tastyminerals wrote:
 I got a company MacBook with M1 chip and gradually migrate all 
 the stuff from Linux machine. I got precompiled ldc binary 
 installed without any problem now is the time for dub since I 
 have couple of D projects I use at work and all of them use dub.

 I can only see the dub-v1.23.0-osx-x86_64.tar.gz package so it 
 should at least run via Rosetta.
The official prebuilt LDC package comes with prebuilt dub, dustmite, ddemangle and rdmd, just like any other package.
Mar 04 2021
parent tastyminerals <tastyminerals gmail.com> writes:
On Thursday, 4 March 2021 at 23:57:25 UTC, kinke wrote:
 On Thursday, 4 March 2021 at 22:30:17 UTC, tastyminerals wrote:
 I got a company MacBook with M1 chip and gradually migrate all 
 the stuff from Linux machine. I got precompiled ldc binary 
 installed without any problem now is the time for dub since I 
 have couple of D projects I use at work and all of them use 
 dub.

 I can only see the dub-v1.23.0-osx-x86_64.tar.gz package so it 
 should at least run via Rosetta.
The official prebuilt LDC package comes with prebuilt dub, dustmite, ddemangle and rdmd, just like any other package.
Oh, you are right! I was not aware of that. Thank you.
Mar 05 2021