dub does not correctly link on Macbook Pro 2019 (intel)

Alexander poneomenos at gmail.com
Sat Aug 19 21:35:25 UTC 2023


Completely new to D, and when trying to setup the toolchain, DMD 
seems to work fine, but dub is running into linker issues.  Below 
is session showing a simple hello world directory initialized 
with dub init, and the issues I am encountering.  Any help would 
be greatly appreciated:

> % tree

```
.
├── dub.json
└── source
     └── app.d

2 directories, 2 files
```
> pacs at PACS-2019-MBPRO hellod % cat dub.json
```
{
         "name": "hellod"
}
```
> % cat source/app.d
```
import std.stdio;

void main()
{
         writeln("Edit source/app.d to start your project.");
}
```
> % dub run
```
     Starting Performing "debug" build using dmd for x86_64.
     Building hellod ~master: building configuration [application]
      Linking hellod
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: alignment (1) of atom 'anon' is too small and may 
result in unaligned pointers
ld: warning: pointer not aligned at address 0x1000681CE ('anon' + 
462 from 
/Users/pacs/.dub/cache/hellod/~master/build/application-debug-g5hl-T2MblAlsFiv_Yxjpw/h
ellod.o)
ld: warning: pointer not aligned at address 0x1000681E7 ('anon' + 
487 from 
/Users/pacs/.dub/cache/hellod/~master/build/application-debug-g5hl-T2MblAlsFiv_Yxjpw/h
ellod.o)
ld: warning: pointer not aligned at address 0x1000682E7 ('anon' + 
743 from 
/Users/pacs/.dub/cache/hellod/~master/build/application-debug-g5hl-T2MblAlsFiv_Yxjpw/h
ellod.o)
ld: warning: pointer not aligned at address 0x10006832F ('anon' + 
815 from 
/Users/pacs/.dub/cache/hellod/~master/build/application-debug-g5hl-T2MblAlsFiv_Yxjpw/h
ellod.o)
ld: warning: pointer not aligned at address 0x100068385 ('anon' + 
901 from 
/Users/pacs/.dub/cache/hellod/~master/build/application-debug-g5hl-T2MblAlsFiv_Yxjpw/h
ellod.o)
ld: warning: pointer not aligned at address 0x100068446 ('anon' + 
1094 from 
/Users/pacs/.dub/cache/hellod/~master/build/application-debug-g5hl-T2MblAlsFiv_Yxjpw/
hellod.o)
ld: warning: pointer not aligned at address 0x100068462 ('anon' + 
1122 from 
/Users/pacs/.dub/cache/hellod/~master/build/application-debug-g5hl-T2MblAlsFiv_Yxjpw/
hellod.o)
ld: unaligned pointer(s) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to 
see invocation)
Error: linker exited with status 1
Error dmd failed with exit code 1.
```
> % cd source
% dmd app.d
% ls -l
```
total 1688
-rwxr-xr-x@ 1 pacs  staff  842616 Aug 19 16:30 app
-rw-r--r--@ 1 pacs  staff      89 Aug 19 02:46 app.d
-rw-r--r--@ 1 pacs  staff   15496 Aug 19 16:30 app.o
```
> % otool -L app
```
app:
         /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, 
current version 1319.100.3)
```
> % file app
```
app: Mach-O 64-bit executable x86_64
```
> % ./app
```
Edit source/app.d to start your project.

```


More information about the Digitalmars-d-learn mailing list