[haiku-development] Re: /usr/local/bin/ld: cannot find -ldl , what is this?

  • From: "Alexander von Gluck IV" <kallisti5@xxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 05 Jun 2019 12:43:55 +0000

June 4, 2019 11:30 PM, "Thomas Mueller" <mueller6723@xxxxxxx> wrote:

I am again trying to cross-compile Haiku (master branch) from FreeBSD, but 
the build (jam -q
@anyboot-image, or jam -q @nightly-anyboot) quickly fails. What is -ldl?

Past attempts didn't fail so quickly or for this reason.

This is for amd64. Configure script for x86-gcc2 hybrid consistency failed 
apparently because of
something incompatible in the gcc2 part:

collect2: error: ld returned 1 exit status
*** The command 'gcc -m32 -o conftest -O2 -U_FORTIFY_SOURCE conftest.c' 
failed.
*** You must set the environment variable CC to a working compiler.

What does that mean? I set CC to the path to gcc.


It means people don't build on FreeBSD enough :-)

Try this:

diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup
index 076a14879b..0fcfc6bd2c 100644
--- a/build/jam/BuildSetup
+++ b/build/jam/BuildSetup
@@ -398,7 +398,10 @@ if $(HOST_PLATFORM_HAIKU_COMPATIBLE) {
        HOST_CCFLAGS += $(compatibilityHeader) ;
        HOST_C++FLAGS += $(compatibilityHeader) ;
 } else {
-       HOST_LINKFLAGS += -lm -ldl ;
+       HOST_LINKFLAGS += -lm ;
+       if $(HOST_PLATFPRM) != freebsd {
+               HOST_LINKFLAGS += -ldl ;
+       }
        HOST_LIBSTDC++ = stdc++ ;
        if $(HOST_PLATFORM) = mingw {
                HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR


We call -ldl for dlopen and other functions with the host tools,
and these seem to exist within libc on FreeBSD

Thanks!

 -- Alexander von Gluck IV

Other related posts: