D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 459 - Setting LIB in dmd/bin/sc.ini has no effect on linking
Summary: Setting LIB in dmd/bin/sc.ini has no effect on linking
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 major
Assignee: Walter Bright
URL:
Keywords: link-failure, patch
Depends on:
Blocks:
 
Reported: 2006-10-25 17:50 UTC by Bradley Smith
Modified: 2015-06-09 05:11 UTC (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Bradley Smith 2006-10-25 17:50:43 UTC
Please read carefully. This sequence is different than Issue 454.
To reproduce problem:

Extract dmc.zip to C:\
Extract dmd.172.zip to C:\
Change directory to an alternate drive, for example "cd d:"
Create file test.d with the following contents:
  import std.stdio;
  void main() {
    writefln("test");
  }

set PATH=c:\dm\bin;c:\dmd\bin;%PATH%
dmd test.d
  --- Fails to link because phobos.lib is not found ---

Edit c:\dmd\bin\sc.ini to contain the following:
  LIB="%@P%\..\lib";"%@P%\..\..\dm\lib"

dmd test.d
  --- Still fails to link because phobos.lib is not found ---

Edit c:\dm\bin\sc.ini to contain the following:
  LIB="%@P%\..\lib";"%@P%\..\..\dmd\lib";"%@P%\..\mfc\lib";%LIB%

dmd test.d
  --- Now links successfully ---
Comment 1 Gide Nwawudu 2008-04-18 07:30:20 UTC
Have a similar issue after downloading dmd-win32snapshot-0.4.0.zip from www.fsdev.net and unzipping it to my D: drive. I edited the sc.ini to switch from Tango to Phobos and I got the following error:

hello.d
-------
import std.stdio;

void main() {	
	writefln("Hello World");
}

D:\test>dmd hello.d
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
SNN.lib
 Warning 2: File Not Found SNN.lib
hello.obj(hello)
 Error 42: Symbol Undefined ......

To fix, I changed LIB line in D:\dmd-win32snapshot-0.4.0\dmd\dmd\bin\sc.ini as follows:
  LIB="%@P%\..\lib";\dm\lib
- to -
  LIB="%@P%\..\lib;%@P%\..\..\dm\lib"

Can the sc.ini's in dmc and dmd zips be fixed?

Comment 2 Gide Nwawudu 2009-05-23 03:51:59 UTC
If DMD does not require DMC then should sc.ini be modified to the following?

  [Environment]
  LIB="%@P%\..\lib";\dm\lib
  ...
- to -
  [Environment]
  LIB="%@P%\..\lib"
  ...
Comment 3 Brad Roberts 2009-06-07 13:37:09 UTC
Can someone who uses windows update this bug with it's status for 1.x and 2.x?  There's been changes in how dmd is packaged since this was originally filed so I suspect it might be resolved.
Comment 4 Don 2010-08-14 12:43:31 UTC
(In reply to comment #3)
> Can someone who uses windows update this bug with it's status for 1.x and 2.x? 
> There's been changes in how dmd is packaged since this was originally filed so
> I suspect it might be resolved.

This has certainly not been an issue since 2.025, when dmd stopped using dmc during compilation. It might also have been fixed in 2.004, when the contents of sc.ini were changed.

Still, the change described in comment 2 has not been made in the official download; though I've discovered that my DMD development directory has that form of sc.ini, and I've used it for over a year without any problems.

I think it would be a good idea to remove the /dm/lib from  dmd/windows/bin/sc.ini
It might be responsible for some of the weird linking errors people sometimes get -- I think they might be getting an old lib files from an old dmc installation, if they've corrupted their dmd directory somehow.
Comment 5 Brad Anderson 2013-10-19 21:10:39 UTC
Inclusion of dm/lib resolved by https://github.com/D-Programming-Language/dmd/pull/2684