www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.ldc - local LDC install conflicts with system install cause linker error

reply mw <mingwu gmail.com> writes:
Hi,

My build suddenly failed after my OS upgrade to Ubuntu 22.04 LTS

$ cat /etc/issue.net
Ubuntu 22.04 LTS

$ dpkg -l | grep -i ldc
ii  ldc                                        1:1.28.0-1ubuntu1  
                      amd64        LLVM D Compiler
ii  libphobos2-ldc-shared-dev                  1:1.28.0-1ubuntu1  
                      amd64        LLVM D Compiler - Standard and 
runtime libraries, imports
ii  libphobos2-ldc-shared98:amd64              1:1.28.0-1ubuntu1  
                      amd64        LLVM D Compiler - Standard and 
runtime libraries

But, I'm using my local install ldc 1.29's dub to build, which 
pick up the ldc2 compiler correctly (see below the build dir 
name), but I run into lots of link errors:

/usr/bin/ld: 
//home//.dub/packages/dateparser-3.0.4/dateparser/source/datep
rser/package.d:752: undefined reference to
`_D3std8datetime8timezone9LocalTime7stdNameMxFNbNdNlNeZAya'

...

/usr/bin/ld: 
/home//.dub/packages/requests-1.1.7/requests/.dub/build/std-unittest-linux.posix-x86_64-ldc_v1.29.0-6C686308E30390EDCF080BEEC5E5A4C4/librequests.a(requests.pool.o):(.data._D29TypeInfo_S4core4time8Dur
tion6__initZ+0x40): undefined reference to
`_D4core4time8Duration8__xopCmpMxFKxSQBiQBgQBeZi'

After uninstall system packages:

$ sudo apt-get purge ldc libphobos2-ldc-shared98 
libphobos2-ldc-shared-dev

The build succeed. But I'm just wondering why it mess up the 
local install and the system install; maybe it confuse the two 
conf files?

/my/local/ldc2/etc/ldc2.conf

/etc/ldc2.conf
Aug 11 2022
parent kinke <noone nowhere.com> writes:
On Thursday, 11 August 2022 at 18:55:52 UTC, mw wrote:
 maybe it confuse the two conf files?

 /my/local/ldc2/etc/ldc2.conf
 /etc/ldc2.conf
A `../etc/ldc2.conf` relative to the executable should take precedence over system-wide `/etc/ldc2.conf`. Running with `-v` shows the used config file and the invoked C compiler cmdline for linking, which should contain a `-L<path to local lib dir> -lphobos2-ldc -ldruntime-ldc`, supposedly making sure the local libs take precedence over the system libs.
Aug 11 2022