[haiku-development] Re: Cross-compiling Haiku with jam under Freebsd: fails consistently on undefined references

  • From: "Thomas Mueller" <mueller6723@xxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 15 Aug 2017 05:56:19 +0000

from Adrien Destugues:

On Mon, Aug 14, 2017 at 09:58:49AM +0000, Thomas Mueller wrote:
To replace -lstdc++ with appropriate linker flags, where would I do that?  
Would I have to edit something in the haiku tree?  Or maybe something in 
the generated build/BuildConfig (use UserBuildConfig?)?

I again ran
grep -rn "HOST_PLATFORM" haiku
to find the HOST_PLATFORM-sensitive things.

I found some things that are suspicious regarding FreeBSD.

One was in haiku/build/jam/BuildSetup

  } else if $(HOST_PLATFORM) = freebsd {
                if $(HOST_CPU) = x86_64 {
                        # amd64 FreeBSD 8 doesn't come without a shared 
libsupc++, and the
                        # static one prevents us from building shared 
libraries. So we have
                        # to work around by using the shared libstdc++.
                        HOST_LIBSUPC++ = stdc++ ;
                        HOST_LIBSTDC++ = ;
                }
        }

        # Unlike glibc FreeBSD's libc doesn't have built-in regex support.
        if $(HOST_PLATFORM) = freebsd {
                HOST_LIBROOT += /usr/lib/libgnuregex.so ;
                HOST_STATIC_LIBROOT += /usr/lib/libgnuregex.so ;
        } else if $(HOST_PLATFORM) = darwin {
                HOST_LIBROOT += libgnuregex_build.so ;
                HOST_STATIC_LIBROOT += libgnuregex_build.so ;
        }

Reference to FreeBSD 8 was suspicious in that the oldest supported version 
of FreeBSD, at FreeBSD end, is 10.3.  Things have changed since FreeBSD 8.x.

Yes, that looks like the right place to change. If you can figure out
the correct options for current versions of FreeBSD we can update this.

I would also have liked to try building Haiku from NetBSD, but it seems 
that setting up requires knowledge of not only where everything is in 
NetBSD but Haiku as well, including extended attributes.

You can disable the use of extended attributes when configuring haiku,
in fact, this is the default behavior unless you specify --use-xattr or
--use-xattr-ref. However, in that case we use an emulation of xattrs (as
separate files) which is known to have some limitations. Sometimes it
will fall out of sync with the actual files. But you should still be
able to build Haiku with it.

Would I do better with Linux?

Possibly, it seems most Haiku devs are working from Linux these days.
But it would be nice to restore FreeBSD support, especially if it is
just about tweaking some linker flags.

I think I mistakenly changed the subject on my last post, so now I corrected 
the subject.

Sorry if it breaks the thread, I am not a good cyber seamster.

I tried 
export CC=/usr/local/gcc5-aux/bin/g++
but that took about two seconds to fail.

CC is supposed to refer to cc, gcc, gcc5 or the like, can even be clang.

I couldn't find supc or stdc in FreeBSD base system libs, found in NetBSD base 
system /usr/lib, found in FreeBSD ports but location depends on particular 
FreeBSD package.

It could be /usr/local/gcc-aux/lib or /usr/local/gcc5-aux/lib, or other such as 
/usr/local/lib/gcc5, and other like possibilities.

How to put that in a BuildSetup file?  Maybe require a user-supplied LIBPATH, 
or what would be the way to specify this, other than by editing BuildSetup and 
other relevant files on a case-by-case basis?

Or is there a place where I could specify HOST_LIBROOT, HOST_STATIC_LIBROOT, 
HOST_LIBSUPC++ and HOST_LIBSTDC++ ?  Maybe BuildConfig or UserBuildConfig?

FreeBSD switched from gcc 4.2.1 to clang, at least on i386 and amd64, to build 
the system, beginning with FreeBSD 9.0.  That alters HOST_LIBSUPC++ and 
HOST_LIBSTDC++.

Another snag appears to be in 
haiku/src/bin/makebootable/platform/bios_ia32/makebootable.cpp  , determining 
the base device name in FreeBSD and NetBSD.  Would this hurt me?

Tom


Other related posts: