www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - FreeBSD linking problem

reply s4mmael <s4mmael gmail.com> writes:
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.
Aug 11 2011
next sibling parent Adam D. Ruppe <destructionator gmail.com> writes:
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.
Aug 11 2011
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
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
Aug 11 2011
prev sibling parent reply s4mmael <s4mmael gmail.com> writes:
Dr. Adam Ruppe and Jacob Carlborg,

Thank you very much for your help!



An error now is as follows:

/usr/bin/ld: cannot find -lphobos2
--- errorlevel 1



[Environment]

DFLAGS=-I/usr/local/include/d/phobos2 -I/usr/local/include/d/druntime/import
-L-L/usr/local/lib32 -L-L% P%/../lib64 -L--export-dynamic -L-lrt
Aug 11 2011
parent reply Jacob Carlborg <doob me.com> writes:
On 2011-08-11 16:10, s4mmael wrote:
 Dr. Adam Ruppe and Jacob Carlborg,

 Thank you very much for your help!



 An error now is as follows:

 /usr/bin/ld: cannot find -lphobos2
 --- errorlevel 1



 [Environment]

 DFLAGS=-I/usr/local/include/d/phobos2 -I/usr/local/include/d/druntime/import
 -L-L/usr/local/lib32 -L-L% P%/../lib64 -L--export-dynamic -L-lrt
Seems it cannot find libphobos2.a in any of the specified search paths. The specified search paths are: /usr/local/lib32 % P%/../lib64 Where % P% is relative to the binary. Also all the search paths for all the regular C libraries: /usr/lib, /usr/local/lib and so on, don't know the exact search paths on FreeBSD. -- /Jacob Carlborg
Aug 11 2011
parent reply s4mmael <s4mmael gmail.com> writes:
I added /usr/local/lib to my config:


[Environment]

DFLAGS=-I/usr/local/include/d/phobos2 -I/usr/local/include/d/druntime/import
-L-L/usr/local/lib32  -L-L/usr/local/lib -L-L% P%/../lib64 -L--export-dynamic
-L-lrt

Now it's OK.
Your help was very useful, thank you!
Aug 12 2011
parent Jacob Carlborg <doob me.com> writes:
On 2011-08-12 09:16, s4mmael wrote:
 I added /usr/local/lib to my config:


 [Environment]

 DFLAGS=-I/usr/local/include/d/phobos2 -I/usr/local/include/d/druntime/import
 -L-L/usr/local/lib32  -L-L/usr/local/lib -L-L% P%/../lib64 -L--export-dynamic
-L-lrt

 Now it's OK.
 Your help was very useful, thank you!
No problem. -- /Jacob Carlborg
Aug 12 2011