Solved make buildworld can not compile 32 bit libraries

Hello,
I've rent a virtual 64 bit Server at the company Netcup and like to compile the FreeBSD system, after a minimal install. When it comes to building 32 bit libraries the build crashes with "/libc.so.7: unsupported file layout" after a compile command "clang -m32 -DCOMPAT_32BIT......"

For this system I got 2 dedicated cores of the CPU "Intel® Xeon® E5-2680V4". On other systems I had not have that problem.

What could that be?

Isn't it not possible on a "Intel® Xeon® E5-2680V4" to build 32 bit libraries? Form CD I could install them.

How could I test if 32bit programs run on 64bit FreeBSD system? It is necessary to have this 32bit option for some programs form the ports?

Thanks
 
Of course it is possible to build 32bit on 64bit platform we have done it all the time and I don't recall some specific x64 CPU restricted to do that or even concerned at all. You just need the proper compiler and toolchains to cross-compile and for amd64 to i386 you virtually need no more than what you have already had.
When I failed on buildworld or buildkernel, most of the time it is because of the leftover of some flags on make.conf, src.conf or env CFLAGS (usually just a simple optimization like -O2 -pipe etc.). You'd better start clear off all that flags, just specify TARGET_ARCH=i386 when buildworld (otherwise it will default to your current FreeBSD platform), see src/Makefile[.inc1] for other options.
To run 32bit on 64bit platform you need 32bit libraries. System essentials like libc, crypto, z, dialog.. already shipped in (see them in /usr/lib32, or customizable by setting ldconfig32_paths in rc.conf()). If you need different (lower) version then get (install), for example, compat7x-i386 (change 7x to your required version). Other than that you have to build yourself.
Lastly, you should mentioned release version of the src you've been building, there's continuous upgrade of clang (recently major upgrade from 3 to 4 in source 20170302), read src/UPDATING notes 20141231 to see whether and how are you affected.
 
When I failed on buildworld or buildkernel, most of the time it is because of the leftover of some flags on make.conf, src.conf or env CFLAGS (usually just a simple optimization like -O2 -pipe etc.). You'd better start clear off all that flags, just specify TARGET_ARCH=i386..."
Thank you for you advices. I had first tried this with some make.conf options. But then totally without any make.conf flags, but both failed.
Thank you also that you give me clearness that lib32 are needed.

clang -v gives me:
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
Target: x86_64-unknown-freebsd11.0
Thread model: posix
InstalledDir: /usr/bin

I thing this is the latest one.
(otherwise it will default to your current FreeBSD platform).."
That seems to be so. I found in the log i.e.
"building shared library libc.so.7
cc -m32 -DCOMPAT_32BIT -march=i686"
So it takes i686 than i386.

My library path is set to:
LD_LIBRARY_PATH=.:/usr/local/lib:/usr/local/info/lib:/usr/lib:/lib:/usr/local/X11/lib:/

I will try TARGET_ARCH=i386 in make.conf and see if it helps. I will give feedback, too.


EDIT: I have done:
With TARGET_ARCH=i386 it crashes when it comes to 64 bit compilation of libc.so.7
building shared library libc.so.7
Code:
clang  -nodefaultlibs -Wl,--version-script=Version.map  -shared -Wl,-x -Wl,--fatal-warnings -Wl,--warn-shared-textrel  -o libc.so.7 
--- libc.a ---
ranlib -D libc.a
./libc.so.7: unsupported file layout
make[4]: "/usr/src/lib/libc/Makefile" line 179: warning: "make -B -C /usr/src/lib/msun -V ARCH_SUBDIR" returned non-zero status
--- _libinstall ---
--- _NLSINS_be_BY.UTF-8.cat ---
--- _libinstall ---
./libc.so.7: unsupported file layout
*** [_libinstall] Error code 1
 
-march=i686 is a cpu opt/cflags not target platform, 64bit platform would be amd64. But why are you building 64bit libc.so.7, are you sure it's been building an 64bit libc?

I was asking you about src release not clang version. I assumed it extracted from official dist src.txz of 11-RELEASE then, and you're trying to buildworld 32bit platform under 64bit installed FreeBSD right?

Just curious, why don't you just grab 32 bit FreeBSD?
 
-march=i686 is a cpu opt/cflags not target platform, 64bit platform would be amd64. But why are you building 64bit libc.so.7, are you sure it's been building an 64bit libc?

I was asking you about src release not clang version. I assumed it extracted from official dist src.txz of 11-RELEASE then, and you're trying to buildworld 32bit platform under 64bit installed FreeBSD right?
No - I just describe what errors I see - and I do not understand why they are there. To give a better view I include 3 completely log files of the eleven, "11", builds I have try; each 1.5 hours long.

Just curious, why don't you just grab 32 bit FreeBSD?
I have installing 64 bit FreeBSD form disk after partition it. You told me to use TARGET_ARCH=i386 in make.conf. Or, I'm sorry, if I do not understand you quit well, because my english is not so good.
I give up know. After eleven build without any success (it hangs every time at building 32 bit lib's how I do assume, and how I described) I can not find any basis why this is so.

Thanks for Your try to help me.
 

Attachments

  • buildworld-08_11-0_no_make_conf_src_conf-after update-p8.zip
    1.7 MB · Views: 284
  • buildworld-09_11-0_no_make_conf_WITHOUT_LIB32.zip
    1.5 MB · Views: 271
  • buildworld-04_11-0-0_march=broadwell_j2.zip
    1.5 MB · Views: 272
I have installing 64 bit FreeBSD form disk after partition it. You told me to use TARGET_ARCH=i386 in make.conf.

I meant to put them on buildworld arguments. And sorry for my rusty brain, I got it mixed, it would be TARGET to specify cross-compile.
Code:
make buildworld TARGET=i386 TARGET_ARCH=i386
I thought if you specify TARGET_ARCH=i386 it should know that TARGET also i386, but not in your case, I guess you still building 64bit platform then.

BTW, WITHOUT_LIB32 is for building 64bit platform, it skip building libraries for 32 bit programs, wouldn't make any sense if you building 32bit platform. Maybe it will do nothing anyway.

To speed up buildworld you can omit some in /etc/src.conf, for example:
Code:
WITHOUT_EXAMPLES=1
WITHOUT_GAMES=1
WITHOUT_HTML=1
WITHOUT_INFO=1
WITHOUT_KERNEL_SYMBOLS=1
WITHOUT_MAN=1
WITH_MAN_UTILS=1
WITHOUT_PROFILE=1
WITHOUT_SHAREDOCS=1

Actually I just extract and comment them from manpage
Code:
man src.conf | col -b | sed "s/^/# /" > src.conf_manpage

Then I edit (delete leading "#" and spaces, add "=1") which ones I'd like to be included, and feed it in back to src.conf

Code:
sed -n '/^[A-Z]/p' src.conf_manpage > src.conf

One more thing, delete /usr/obj (or wherever your OBJDIR) before buildworld
(to make sure you start fresh, not cluttered with something from previous build error).
 
Thanks all for there hints.
In between I could get more fixed out:

To remember: the error "/libc.so.7: unsupported file layout" comes when it builds 32 bit libraries. To set the option "WITHOUT_LIB32=yes" fixed it, but this is not the solution.

I have try to get more out about libc.so.7 and search for it with tree in /usr/src and /usr/obj. I found it in: /usr/obj/usr/src/lib/libc/libc.so.7 and /usr/obj/usr/src/world32/usr/src/lib/libc/libc.so.7.
I changed then the directory to /usr/obj/usr/src/world32/usr/src/lib/libc and thenI go to cd libc
whoops: the error was also there:
"/libc.so.7: unsupported file layout"

(1) I am now on an other (older and slower) machine but get the same compiling error.
(2) changing into this directory gives also the same error.
So after thinging about it, I suppose that something with my environment could be wrong because changing the directory is not compiling something. I do a lot of try and error, but to keep it short I find out that when I do .tcshrc disable by renaming it to something like: _no_.tcshrc, log out and log in again, and do then a make buildworld it finished without any error !!!
So something of my setting in .tcshrc bring the error; nothing else. I like to asking what this could be in a new thread. This problem I asked for this has now been solved.

Thanks again for any help.
 
Back
Top