This is quick and dirty faq for gentoo on amd64 feel free to add something and correct me.

VERY IMPORTANT
If you ask the question about something that doesn't work please post relevant/related information(for example "emerge info" or dmesg output if the error is shown there), so we dont have to deduce it.It is wise to check https://bugs.gentoo.org because there is a possibility that your particular problem is already listed there. Also you might try this amd64 howto . It is also a good idea to check gentoo-wiki site cause it might help alot. Here is a nice article: 64-bit computing: Co-existing in a 32-bit world which might explain you better how 32bit emulation work on 64bit linux. If you are going to use hardened profile, hardened multilib is not supported in the kernel so you might get problems with 32-bit applications.

COMMON MISTAKES
Many people tend to forget to enable 32bit emulation in kernel, so CONFIG_IA32_EMULATION=y.
Please read the technotes and have a look at gentoo on amd64 HANDBOOK .

Q: Will performance suffer if I use 32-bit emulation?
A: The 32-bit binaries will run as fast as you'd expect from a modern processor. The performance loss is insignificant.

Q: Example CFLAGS for amd64
A: CFLAGS="-march=athlon64 -O2 -pipe" should be stable enough. Search the forums for this because there is pretty much info availible. Please don't add -m64 to your CFLAGS! Some posts about it.
Here is a post about -ffast-math. Here is a document from amd with recommended cflags.

Q: Example CFLAGS for 32 bit installation on athlon64/opertron
A: Just like normal athlons but you can use sse2. You can also use -march=athlon64 if you use gcc3.4+ and install using x86 livecd. This will imply sse. Also see here for more details.

Q: mplayer / xine dont play some movies , *.wmv/*.rm/win32codecs dont work
A: You need 32bit mplayer to use 32bit codecs (for stuff like wmv9 and real). No win64codecs are currently availible.
Take a look at this guide and this topics: xine thread or this mplayer thread or just search for "mplayer" in amd64 forum what will answer your questions on this topic more completely. 32bit realpayer also works on amd64 if you want to play *.rm files.
See here what gentoo-wiki has to say about it.

Q: How to compile in 32 bits on amd64?
A: You have to have to compile gcc with "multilib" in your USE flags. Then take your software you want to compile and run

Code:

CFLAGS="-march=i386 -m32 " LDFLAGS="-m32" ./configure --prefix=/usr

It works for me in 99% of cases. Check the question below about wine. Remember, you will also need 32 bit libs for ur package installed. I tested this method so far on freespace2 linux port, libaal , openal and it worked.

Q: How do i enable nx (non-execute) on amd64
A: This kernel boot parameters do the job : noexec=on and noexec32=on for 32 bit applications. Here are some amd64 boot parameters.

Q: The realtime clock of my pc runs at insane rate, clock is too fast/slow
A: Try using "clock=pmtmr notsc" as kernel parameters. Some people report to have more success with "noapictimer" kernel paramter. Also try "no_timer_check=0".

Q: "Warning: many lost ticks. Your time source seems to be instable or some driver is hogging resources."
A: Check this post.

Q: My 32 bit software needs * libraries.
A: 1) Check if you installed all emul- ebuilds with "emerge -s emul-linux-x86"
2) Use filename on google to get library name, get 32 bit library from some other 32 bit distribution (I prefer fedora core). Convert rpm to tar.gz by using rpm2targz. Copy unpacked libs in /usr/lib32, run ldconfig. Hope it works

Q: How to install some ebuild which are masked.
A: Dont use ACCEPT_KEYWORDS="x86" because it tends to break!
There are several methods to do this.
1) Just add "<package name> amd64" to your /etc/portage/package.keywords
2) You can use "ekeyword" from the gentoolkit-dev package:

Code:

ekeyword \amd64 /usr/portage/x11-libs/wxGTK/wxGTK-2.5.1-r1.ebuild

3) edit the ebuild manually like and add "amd64" in KEYWORDS variable, for example

Code:

nano /usr/portage/x11-libs/wxGTK/wxGTK-2.5.1-r1.ebuild

and then just "emerge wxGTK".

Q: Wine/Cedega with amd64 ?
This post deals with latest problems people have with wine. Also here is a nice amd64 cedega faq at transgaming.

Q: My flash / java / some other 32bit plugin doesn`t work.
A: At the moment if you want to use 32 plugins with 64 bit browser your only choice is to use konqueror or to use 32 bit browser. How to use 32 bit plugins with 64 bit Konqueror here , post with a package here
32bit flash/32 bit java wont work with 64 bit browser so you have to either live with 32bit browser or dont use flash.

Q: I want to try reiser4 on amd64
A:There is a user created livecd which has theese features. Also see this wiki for more info. I myself use reiser4 with
nitro sources without any problems.

Q: I am having problems with 32bit games/opengl applications
A: Please be sure you installed your nvidia or ati card correctly. Then run "glxinfo" to check if you have hardware accelerated rendering. You can also fix lots of 32bit opengl software by
"export LD_PRELOAD=/usr/lib32/libGL.so.1" or/and "export LD_LIBRARY_PATH=/usr/lib32".
Also try "export LD_LIBRARY_PATH=/usr/lib32/opengl/nvidia/lib/" if you get this error with nvidia card.

Q: DRI OpenGL doesn't work with 32-bit applications (et, ut, whatever) on ATI, what can I do?
A:

somewhere in your environment I suggest /etc/env.d/99local
For more details see this howto.

Q: Teamspeak (ts2) Runtime error 234 at 0805D21F
A: Please READ the first post in this thread as it will solve your problem with 99% probablility. Also this and this bugzilla links might give you the clue.

15) What card should I buy?
At the moment it's not recommend to buy a prism based 802.11g card, because all new cards are SoftMAC cards which are stating being supported. You may be more lucky with another card with opensource linux drivers. Ralink is an example.

Check linux-wlan-ng(it is also in portage) if you have Intersil Prism2/2.5/3. Broadcom-based cards work with this 64bit windows driver if loaded with ndiswrapper, also check this thread. Here is a very usefull list if you don't know exactly what chipset does your wlan card have. Also Linuxant DriverLoader might be a solution for you.
If you want to get WPA working you probably schould try something like this:

Q: Which video card to buy for amd64?
A: Nvidia: works great for most of us 32bit/64bit with full 3D.
Ati : Here is also a little howto for it

Q: What about Motherboard recommendations?
A DFI Lan Party causes problems also here for some people. Here is a thread with reccomendations on pci-express motherboards. Most resent thread on this topic. Old one.sis 939 thread.

Q: What about Memory?
A: Note, that athlon64 is quite picky about it's memory because of the onboard memory controller. The only way to fix problems with memory is a bios update or to lower the timings in bios. Check this thread.

I usually edit ebuild of this software in /usr/portage/......ebuild and add there amd64 to the KEYWORDS. It may not always work but often does. Example: nano /usr/portage/x11-libs/wxGTK/wxGTK-2.5.1-r1.ebuild

You can also use ekeyword from the gentoolkit-dev package:

Code:

ekeyword \~amd64 /usr/portage/x11-libs/wxGTK/wxGTK-2.5.1-r1.ebuild

Or if you are using stable:

Code:

ekeyword amd64 /usr/portage/x11-libs/wxGTK/wxGTK-2.5.1-r1.ebuild

_________________clue = if 0 == 0 then clue else error "The poster didn't have any clue when he posted this."

Q: Will performance suffer if I use 32-bit emulation?
A: It's not actually emulation; 32-bit binaries are executed natively. They won't be as fast as optimised 64-bit binaries, but they will be as fast as you'd expect from a modern processor.

Q: Will performance suffer if I use 32-bit emulation?
A: It's not actually emulation; 32-bit binaries are executed natively. They won't be as fast as optimised 64-bit binaries, but they will be as fast as you'd expect from a modern processor.

If you run in 64-bit mode (64-bit O.S.), it'll run emulated, so it won't run at native speeds. If you run it in 32-bit mode, then it will. (That's in the white papers of AMD for x86-64)

That seems somewhat doubtful to me, Deathwing, although I suppose it depends on your definition of 'emulated'... it certainly isn't running a little program which takes 32-bit instructions one at a time and interprets them, which would be the normal meaning.

I'm running gentoo with a 64-bit kernel, and some apps get better performance when compiled 32-bit. For example, mplayer. I know these are optimised for x86, but if my system was only emulating an x86 system then it would be slower regardless.

I don't have a full 32-bit install to test on, so perhaps someone could verify this... how does 32-bit performance under a 64-bit kernel compare to 32-bit performance under a 32-bit kernel?

That seems somewhat doubtful to me, Deathwing, although I suppose it depends on your definition of 'emulated'... it certainly isn't running a little program which takes 32-bit instructions one at a time and interprets them, which would be the normal meaning.

I'm running gentoo with a 64-bit kernel, and some apps get better performance when compiled 32-bit. For example, mplayer. I know these are optimised for x86, but if my system was only emulating an x86 system then it would be slower regardless.

I don't have a full 32-bit install to test on, so perhaps someone could verify this... how does 32-bit performance under a 64-bit kernel compare to 32-bit performance under a 32-bit kernel?

If you are running the a 64-bit operating system, the CPU flags go 110. If you run a 32 bit app in a 64-bit os, it'll use the compatibility 32 bit mode for that application, that is 101. There are minor issues with that, you might not notice a problem with that application at all, but as the paper states, CPU effectivity decreases when running concurrently 64-bit and 32-bit apps.

Quote:

Compatibility Mode
Compatibility mode allows operating systems to implement binary compatibility with existing
16-bit and 32-bit x86 applications. It allows these applications to run, without recompilation,
under a 64-bit operating system in long mode. In compatibility mode, applications can only access the first 4GBytes of virtual-address space. Standard x86 instruction prefixes toggle
between 16-bit and 32-bit address and operand sizes.
As with 64-bit mode, compatibility mode is enabled by the operating system on an individual
code-segment basis. Unlike 64-bit mode, however, x86 segmentation functions normally, using
16-bit or 32-bit protected-mode semantics. From the applications viewpoint, compatibility mode
looks like a legacy x86 protected-mode environment. From the operating systems viewpoint,
address translation, interrupt and exception handling, and system data structures use the 64-bit
long mode mechanisms.
Legacy Mode
When LMA=0, the processor is said to be running in legacy mode. None of the 64-bit features
are available and the processor operates as a standard x86 processor. Legacy mode is completely
compatible with existing 32-bit implementations of the x86 architecture. This includes support
for current technologies like segmented memory, and 32-bit GPRs and instruction pointer.

I updated gcc flags, question about emulation and memory recomendation. g0su, can u explain it more detailed about firefox (i assume firefox bin) and what do u mean with "rendering"? dri? I am writing from work from a win machine so i can't check cdrdao. Are u sure it always need gnome or only when one has gnome installed? Also some people say nvdia's agp works with amd64, but it never did to me. I will check it out and post if i succeed.

Probably you haven't enabled the legacy, deprecated and old /proc/sys/ cpufreq interface. use /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq for determining current speed instead, and
/sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed to set a specific frequency if using the userspace governor

You should also enable different governors here. I use "userspace" to change speed with "echo <speed in herz>

While we're crazy, we're not that crazy. It's kHz, not Hz

crazycat wrote:

> /proc/sys/cpu/0/speed"

Better use the non-deprecated interface in /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed [only available for userspace governor, of course]

crazycat wrote:

and read speed with cat /proc/sys/cpu/0/speed.

Better use /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq or cpuinfo_cur_freq. The latter is only available to root and reads the frequency settings from hardware registers.

That whole thing is crazy. u have to type half an hour just to change the speed, i always mess up theese zeros when i type echo 2000000 . I updated it in the faq. If u use my method u just can tab 3 last words in the path

That whole thing is crazy. u have to type half an hour just to change the speed, i always mess up theese zeros when i type echo 2000000 . I updated it in the faq. If u use my method u just can tab 3 last words in the path :D

a) Linus preferred it that way, and its technically cleaner. Under normal circumstances, you want to use the "ondemand" cpufreq governor anyways.

b) just use a good userspace tool... or if that doesn't work, write a script/tool...

You could add that using grub-static is not nesseary if you have compiled grub with multilib support. then you can use normal grub. _________________The idea isn't about how do you see or hear it, it's about how do you experience it...
--//--
Asus K8V Deluxe, Athlon64 3500+, nVidia 7600 GT, 3Gb 400MHz DDR, IDE HD 160Gb, IDE HD 850Mb and SATA HD 250Gb