GentooThis forum is for the discussion of Gentoo Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have been building binaries by including the following with every emerge
--buildpkg --buildpkg-exclude "virtual/* sys-kernel/*-sources"
Now I plan to upgrade my Host-OS to Gentoo; will the binary pkgs work if I transfer '/user/portage' from the Guest-Machine to the Host-Machine??
I ask this cause I ran the following commands on both the Host & Guest machines and did a diff; found significant differences, especially in the flags. (diff at the end of post)
I understand that VirtualBox is a “level-2” hypervisor and not all features of the Host CPU will be exposed to the Guest OS and thus some difference should be expected.
But I don't know how much it will affect the binaries, if at all ?
Off the top of my head I can predict that since the Guest “CPU” is a subset (reduced version) of the actual(Physical) CPU, things should be fine :-P but that's just my 2 cent.
I have not had any issues when using the binaries in a desktop environment. I cannot see what would the effects of VirtualBox in the binaries.
Humm..., this is very encouraging
But what I was wondering is that, Core-i5 has all the feature of Core-2-Duo *PLUS* some more!
So will the binaries compiled in core-2-Duo be able to take advantage all the features in Core-i5?
Excuse me if the above question sounded foolish, I am new to compiling from code :P
But what I was wondering is that, Core-i5 has all the feature of Core-2-Duo *PLUS* some more!
So will the binaries compiled in core-2-Duo be able to take advantage all the features in Core-i5?
I am not an expert, and I have often search for similar questions ;-)
As far as I can understand, the binaries in core-2-Duo will not be able to take advantage of the features in Core-i5. Nevertheless, as they share the same architecture, the binaries produced from the Core-2-Duo will run on the Core-i5.
I am not an expert, and I have often search for similar questions ;-)
I see
Quote:
Originally Posted by mimosinnet
As far as I can understand, the binaries in core-2-Duo will not be able to take advantage of the features in Core-i5. Nevertheless, as they share the same architecture, the binaries produced from the Core-2-Duo will run on the Core-i5.
I am not an expert, and I have often search for similar questions ;-)
As far as I can understand, the binaries in core-2-Duo will not be able to take advantage of the features in Core-i5. Nevertheless, as they share the same architecture, the binaries produced from the Core-2-Duo will run on the Core-i5.
Cheers!
Hi
I know that it's been a while, but I finally figured it out....
The answer was given in one of the links that I provided!
I just can't believe how I missed it the first time around :-P
Some readers might wonder if compiling outside the target machine with a strictly inferior CPU or GCC sub-architecture will result in inferior optimization results (compared to a native compilation). The answer is simple: No. Regardless of the actual hardware on which the compilation takes place and the CHOST for which GCC was built, as long as the same arguments are used (except for -march=native) and the same version of GCC is used (although minor version might be different), the resulting optimizations are strictly the same.
I have started to compile binaries with the following option in /etc/make.conf
Edited: re-reading it I noticed this doesn't mean what it was meant to mean. So, rewrote it.
Object code, indeed, depends only upon the compiler version used and the flags used, as said, except for -march=native, logically.

That's also why, by default, when you compile gcc, it bootstraps itself in a three stage process, so, imagine you have gcc-version-A installed, and want to upgrade to gcc-version-B. When you launch the compilation of gcc-version-B, you use gcc-version-A to compile gcc-version-B-stage1. stage1 will be able to product the same exact code that stage2 and 3 will be able to.
So, why not stop at this point: well, gcc-version-B stage1 can produce the same object code, but the object code of the binaries of gcc-version-B-stage1 is not as optimized as it could be, which means compilations will take a bit longer to end when you use this compiler.
So, now gcc uses gcc-version-B-stage1 to produce gcc-version-B-stage2, which will produce version-B object code and will be as efficient as any other version-B produced binary. So, we could indeed stop at this point.
The 3rd stage is used just as a check. It's compared against stage2 and they should be exact copies, if not, then there's some odd bug in the compiled that needs attention.
Humm..., I guess that makes good sense, at least from a software/compiler point of view.
After all it's normal to expect later version (of GCC) to perform better than previous version.
As for myself, I was more concerned form a Hardware point of view.
Will code compiled on a relatively "inferior" hardware perform optimally on a "superior" hardware?
Hence I was more impressed by the use of "-march="
Distribution: LFS 9.0 Custom, Merged Usr, Linux 4.19.x
Posts: 616
Rep:
As primarily a Linux From Scratch user, I fiddle with compiler flags quite a bit. Note that I prefer "reliably fast" to "insane w/ segfaults". I do most of this on a VM.
My best results come from setting the architecture to be broad and the tune to be narrow. Basically it builds code to run on a lot of similar CPUs, but lines things up to run best on a specific microarchitecture.
For the base LFS system, which is basically the Gnu toolchain, kernel and sysadmin CLI tools I use: -march=core2 -mtune=generic -O2 Which provides max stability in the toolchain.
After the minimal first boot I use: -march=core2 -mtune=native -O2. In this case, the code will run on any core2 or newer, but runs best on a Haswell, which is where it was built. You could try this for building on your VM for the host. Heck, when I do core2/generic I use that base for both my IvyBridge laptop and my Haswell desktop.
For the base LFS system, which is basically the Gnu toolchain, kernel and sysadmin CLI tools I use: -march=core2 -mtune=generic -O2 Which provides max stability in the toolchain.
After the minimal first boot I use: -march=core2 -mtune=native -O2. In this case, the code will run on any core2 or newer, but runs best on a Haswell, which is where it was built. You could try this for building on your VM for the host. Heck, when I do core2/generic I use that base for both my IvyBridge laptop and my Haswell desktop.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.