www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - dub creates unrunnable binary in "build" dir

reply tastyminerals gmail.com <tastyminerals gmail.com> writes:
I have been using dub to build one project of mine and its been 
2021 the last time I tried to rebuild it...

I made some code changes today and wanted to run unittests. Here 
is what I got after running `dub build -b tests`:

```
     Starting Performing "tests" build using 
/Users/pavels/.local/share/ldc2-1.31.0-osx-arm64/bin/ldc2 for 
aarch64, arm_hardfloat.
     Building dxml 0.4.3: building configuration [library]
     Building x11 1.0.21: building configuration [tcltk-import]
     Building tcltk 8.6.5: building configuration [library]
     Building tkd 1.1.14: building configuration [library]
     Building toml 1.0.0-rc.3: building configuration [library]
     Building doc_sender_app ~master: building configuration 
[application]
     Linking doc_sender_app
              Copying files for doc_sender_app...
```

Build is completed, now let's run it.
`cd build && ./doc_sender_app`
```
dyld[4032]: Symbol not found: _memcmp
   Referenced from: <2E0B0A60-5997-399C-8361-B70D44650A19> 
/Users/pavels/dev/build/doc_sender_app
   Expected in:     <D95E18F3-1B58-3595-AB23-2D17FCBCB1CF> 
/opt/local/lib/libtcl8.6.dylib
fish: Job 1, './doc_sender_app' terminated by signal SIGABRT 
(Abort)
```
Huh?
Checking
`dyld_info -imports /opt/local/lib/libtcl8.6.dylib | rg "_memcmp"`
```
0x008F  0x002  _memcmp
```
The symbol exists if I understood correctly.
Searching the internet didn't provide me with any answers :(
Building with older 1.27.1 ldc/dub provided the same results. So, 
it means that something changed on my system after the latest mac 
ports update but I have no clue how to proceed tbo.

Can anyone provide some more information about the error?
What else should I try out?

DUB version: version 1.30.0, built on Feb 11 2023
The compiler is the latest "ldc2-1.31.0-osx-arm64".
The machine is Mac M1 with Ventura installed and all relevant tk 
and tcl libs in place.
Feb 23 2023
parent reply "Richard (Rikki) Andrew Cattermole" <richard cattermole.co.nz> writes:
On 24/02/2023 1:10 AM, tastyminerals gmail.com wrote:
 The symbol exists if I understood correctly.
-imports shows you the imports of the binary, not the exports. So no it does not exist (probably came from libc). https://keith.github.io/xcode-man-pages/dyld_info.1.html My guess is something changed some place else. Such as XCode or tcl.
Feb 23 2023
parent tastyminerals gmail.com <tastyminerals gmail.com> writes:
On Thursday, 23 February 2023 at 12:28:35 UTC, Richard (Rikki) 
Andrew Cattermole wrote:
 On 24/02/2023 1:10 AM, tastyminerals gmail.com wrote:
 The symbol exists if I understood correctly.
-imports shows you the imports of the binary, not the exports. So no it does not exist (probably came from libc). https://keith.github.io/xcode-man-pages/dyld_info.1.html My guess is something changed some place else. Such as XCode or tcl.
Yes, you're correct. I managed to resolve it. So "_memcmp" was missing and it is part of the libc library. I remember that MacPorts asked me to reclaim some space by removing the deps of inactive ports. When agreed, it removed almost complete port library including many libs used for compilation of other ports. I managed to restore most of them but looks like glibc2 was still missing. After installing it and libgcc with deps, the project compiled without issues.
Feb 24 2023