Thread overview
FreeBSD linking problem
Aug 11, 2011
s4mmael
Aug 11, 2011
Adam D. Ruppe
Aug 11, 2011
Jacob Carlborg
August 11, 2011
Hi folks,

During linking a very simple "hello world" program with "dmd2 -run hello.d" I got the following errors:

/usr/bin/ld: unrecognized option '--no-warn-search-mismatch' /usr/bin/ld: use the --help option for usage information

I was trying this on two different machines, one of them is clear just installed FreeBSD. Results is the same.

OS: FreeBSD 8.2 Release
DMD: both 2.053 and 2.054
LD: GNU ld version 2.15 [FreeBSD] 2004-05-23

How do I overcome this error? It's quite clear dmd2 is trying to link an object file with an incorrect for this ld version options, but how to fix that?

Google did not help.
Thank you in advance for any help. It's greatly appreciated.
August 11, 2011
Find your dmd.conf. It's usually in the same folder as the dmd binary.

In there there's a line like:

lib32 -L-L%@P%/../lib64 -L--no-warn-search-mismatch -L--export-dynamic -L-lrt


just delete the -L--no-warn-search-mismatch from there.
August 11, 2011
On 2011-08-11 15:48, s4mmael wrote:
> Hi folks,
>
> During linking a very simple "hello world" program with "dmd2 -run hello.d" I
> got the following errors:
>
> /usr/bin/ld: unrecognized option '--no-warn-search-mismatch'
> /usr/bin/ld: use the --help option for usage information
>
> I was trying this on two different machines, one of them is clear just
> installed FreeBSD. Results is the same.
>
> OS: FreeBSD 8.2 Release
> DMD: both 2.053 and 2.054
> LD: GNU ld version 2.15 [FreeBSD] 2004-05-23
>
> How do I overcome this error? It's quite clear dmd2 is trying to link an
> object file with an incorrect for this ld version options, but how to fix that?
>
> Google did not help.
> Thank you in advance for any help. It's greatly appreciated.

Just remove the flag "--no-warn-search-mismatch" from the dmd.conf file. I think that flag lets you specify both 32 and 64bit libraries and it will not warn when it finds the wrong architecture.

-- 
/Jacob Carlborg