# emerge ati-drivers failed

## heyuxiang

i've tried many times,but i can't emerge ati-drivers,neither on amd64 nor ~amd64

here is the error messege:

```
 [32;01m*[0m Determining the location of the kernel source code

 [32;01m*[0m Found kernel source directory:

 [32;01m*[0m /usr/src/linux

 [32;01m*[0m Found kernel object directory:

 [32;01m*[0m /lib/modules/2.6.26-gentoo-r2/build

 [32;01m*[0m Found sources for kernel version:

 [32;01m*[0m 2.6.26-gentoo-r2

>>> Unpacking source...

Warning: target directory exists /var/tmp/portage/x11-drivers/ati-drivers-8.532/work

Verifying archive integrity... All good.

Uncompressing ATI Proprietary Linux Driver-8.532......................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................

 [32;01m*[0m Applying ati-powermode-opt-path-2.patch ...

[A[120C  [34;01m[ [32;01mok[34;01m ][0m

 [32;01m*[0m Converting 2.6.x/Makefile to use M= instead of SUBDIRS= ...

[A[120C  [34;01m[ [32;01mok[34;01m ][0m

>>> Unpacking ./../common/usr/src/ati/fglrx_sample_source.tgz to /var/tmp/portage/x11-drivers/ati-drivers-8.532/work/extra

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/x11-drivers/ati-drivers-8.532/work ...

 [32;01m*[0m Preparing fglrx module

make -C /usr/src/linux M=/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x modules

make[1]: Entering directory `/usr/src/linux-2.6.26-gentoo-r2'

  CC [M]  /var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function 'KCL_AMD64_COMPAT32_AllocUserSpace':

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:2085: error: implicit declaration of function 'compat_alloc_user_space'

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:2085: warning: return makes pointer from integer without a cast

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function '__ke_register_ioctl32_conversion':

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3164: error: implicit declaration of function 'register_ioctl32_conversion'

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function '__ke_unregister_ioctl32_conversion':

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3173: error: implicit declaration of function 'unregister_ioctl32_conversion'

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function '__ke_vm_phys_addr_str':

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3749: warning: return makes pointer from integer without a cast

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3750: warning: return makes pointer from integer without a cast

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3751: warning: return makes pointer from integer without a cast

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:3753: warning: return makes pointer from integer without a cast

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: At top level:

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:6368: warning: initialization from incompatible pointer type

/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:6394: warning: initialization from incompatible pointer type

make[2]: *** [/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o] Error 1

make[1]: *** [_module_/var/tmp/portage/x11-drivers/ati-drivers-8.532/work/common/lib/modules/fglrx/build_mod/2.6.x] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.26-gentoo-r2'

make: *** [kmod_build] Error 2

 [31;01m*[0m 

 [31;01m*[0m ERROR: x11-drivers/ati-drivers-8.532 failed.

 [31;01m*[0m Call stack:

 [31;01m*[0m ebuild.sh, line   49:  Called src_compile

 [31;01m*[0m environment, line 3263:  Called linux-mod_src_compile

 [31;01m*[0m environment, line 2472:  Called die

 [31;01m*[0m The specific snippet of code:

 [31;01m*[0m eval "emake HOSTCC="$(tc-getBUILD_CC)"                   CC="$(get-KERNEL_CC)"                   LDFLAGS="$(get_abi_LDFLAGS)"                   ${BUILD_FIXES}                   ${BUILD_PARAMS}                   ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CC="$(get-KERNEL_CC)" LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";

 [31;01m*[0m The die message:

 [31;01m*[0m Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CC=x86_64-pc-linux-gnu-gcc LDFLAGS=  GCC_VER_MAJ=4 KVER=2.6.26-gentoo-r2 KDIR=/usr/src/linux kmod_build

 [31;01m*[0m 

 [31;01m*[0m If you need support, post the topmost build error, and the call stack if relevant.

 [31;01m*[0m A complete build log is located at '/var/tmp/portage/x11-drivers/ati-drivers-8.532/temp/build.log'.

 [31;01m*[0m The ebuild environment file is located at '/var/tmp/portage/x11-drivers/ati-drivers-8.532/temp/environment'.

 [31;01m*[0m 
```

i've searched google and gentoo forum and also gentoo-wiki .nothing helps 

i'd say i really love gentoo,but i can't live with out X and please don't advise me to use opensource ati drivers

thank you for your advices

----------

## Logan11

Same Problem here:

Just tried to emerge the new   ati-drivers-8.542   and I get the same error:

```
/var/tmp/portage/x11-drivers/ati-drivers-8.542/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: In function ‘KCL_disable_pat’:

/var/tmp/portage/x11-drivers/ati-drivers-8.542/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:4082: error: too many arguments to function ‘smp_call_function’

/var/tmp/portage/x11-drivers/ati-drivers-8.542/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c: At top level:

/var/tmp/portage/x11-drivers/ati-drivers-8.542/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:5774: warning: initialization from incompatible pointer type

/var/tmp/portage/x11-drivers/ati-drivers-8.542/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.c:5800: warning: initialization from incompatible pointer type

make[2]: *** [/var/tmp/portage/x11-drivers/ati-drivers-8.542/work/common/lib/modules/fglrx/build_mod/2.6.x/firegl_public.o] Error 1

make[1]: *** [_module_/var/tmp/portage/x11-drivers/ati-drivers-8.542/work/common/lib/modules/fglrx/build_mod/2.6.x] Error 2

make[1]: Leaving directory `/usr/src/linux-2.6.27-git5'

make: *** [kmod_build] Error 2

 *

 * ERROR: x11-drivers/ati-drivers-8.542 failed.

 * Call stack:

 * ebuild.sh, line   49:  Called src_compile

 * environment, line 3300:  Called linux-mod_src_compile

 * environment, line 2509:  Called die

 * The specific snippet of code:

 * eval "emake HOSTCC="$(tc-getBUILD_CC)"                                               CC="$(get-KERNEL_CC)"                                           LDFLAGS="$(get_abi_LDFLAGS)"                                                ${BUILD_FIXES}                                          ${BUILD_PARAMS}            ${BUILD_TARGETS} " || die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CC="$(get-KERNEL_CC)" LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}";

 * The die message:

 * Unable to emake HOSTCC=x86_64-pc-linux-gnu-gcc CC=x86_64-pc-linux-gnu-gcc LDFLAGS=  GCC_VER_MAJ=4 KVER=2.6.27-git5 KDIR=/usr/src/linux kmod_build

 *

 * If you need support, post the topmost build error, and the call stack if relevant.

 * A complete build log is located at '/var/tmp/portage/x11-drivers/ati-drivers-8.542/temp/build.log'.

 * The ebuild environment file is located at '/var/tmp/portage/x11-drivers/ati-drivers-8.542/temp/environment'.
```

My emerge info:

```
emerge --info

WARNING: repository at /usr/portage-local is missing a repo_name entry

Portage 2.2_rc12 (default/linux/amd64/2008.0/desktop, gcc-4.3.1, glibc-2.8_p20080602-r0, 2.6.27-rc8-git7 x86_64)

=================================================================

System uname: Linux-2.6.27-rc8-git7-x86_64-AMD_Phenom-tm-_9550_Quad-Core_Processor-with-glibc2.2.5

Timestamp of tree: Fri, 17 Oct 2008 07:05:01 +0000

app-shells/bash:     3.2_p33

dev-java/java-config: 1.3.7, 2.1.6

dev-lang/python:     2.4.4-r13, 2.5.2-r7

dev-python/pycrypto: 2.0.1-r6

dev-util/cmake:      2.6.2

sys-apps/baselayout: 2.0.0

sys-apps/openrc:     0.3.0-r1

sys-apps/sandbox:    1.2.18.1-r2

sys-devel/autoconf:  2.13, 2.63

sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1-r1

sys-devel/binutils:  2.18-r3

sys-devel/gcc-config: 1.4.0-r4

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.23-r3

ACCEPT_KEYWORDS="amd64"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=amdfam10 -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config /var/lib/hsqldb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"

CXXFLAGS="-march=amdfam10 -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FEATURES="buildpkg candy distlocks fixpackages parallel-fetch preserve-libs protect-owned sandbox sfperms strict unmerge-orphans userfetch"

GENTOO_MIRRORS="ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/gentoo/"

LDFLAGS="-Wl,-O1"

LINGUAS="en el"

MAKEOPTS="-j9"

PKGDIR="/usr/portage/packages/phenom"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/portage-local"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="7zip X X509 a52 aac aalib acct acl acpi aiglx alsa amd amd64 amr amuled apache2 asf audiofile avi beagle berkdb bidi bl blas bluetooth branding bzip2 cairo cdda cddb cdio cdparanoia cdr chm cli cpudetection cracklib crypt cups curl dbus directfb djvu dmx dnd dri dts dv dvb dvd dvdr dvdread dvi edl eds emboss encode esd evo exif expat extrafilters fam fame fbcon ffmpeg firefox flac foomaticdb fortran freetype freetype2 gdbm ggi gif gimp gimpprint glib glitz gnome gnutls gphoto gphoto2 gpm graphviz gstreamer gtk gtk2 gtkhtml h264 hal hddtemp hdf5 hpn hwdata-gentoo iconv idn ieee1394 imagemagick imlib ipv6 isdnlog ithreads jack java joystick jpeg jpeg2k kde kdeenablefinal kdehiddenvisibility kdexdeltas kdrive kerberos keyring kipi lame lcms libcaca libnotify libsamplerate lirc live lm_sensors lua lzo matroska midi mime mjpeg mmap mmx mmx2 mmxext mng mod modplug mono motif mozcalendar mozilla mozsvg mp3 mp4 mpeg mpi mplayer msn mudflap multilib musepack mysql nas nautilus ncurses network nfs nls nntp nodrm nptl nptlonly nsplugin ogg openexr opengl openmp pam pch pcre pdf perl plotutils png pppd python qt qt3 qt3support qt4 quicktime quotas rdesktop readline reflection remote rtc ruby samba scanner screen sdl sensord session shout silc slang smp sndfile snmp sound speex spell spl sqlite sqlite3 sse sse2 ssl startup-notification stats stream subtitles subversion svg sysfs tcltk tcpd tetex tga theora threads tiff timidity truetype ucs2 unicode usb userlocales v4l v4l2 vcd vhosts vorbis widescreen winbind wma wmf wxgtk1 x264 xanim xcomposite xine xml xml2 xorg xpm xprint xscreensaver xulrunner xv xvid xvmc yv12 zlib" ALSA_CARDS="snd-hda-intel" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en el" USERLAND="GNU" VIDEO_CARDS="ati fglrx vesa"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

----------

## d2_racing

Hi, how many CPU do you have ?

```

MAKEOPTS="-j9" 

```

----------

## energyman76b

you are missing some kernel option

----------

## twinkle

@Logan11: These drivers are not compatible with kernel 2.6.27 and need a patch,

see:

https://forums.gentoo.org/viewtopic.php?p=5250560#5250560

----------

## Logan11

@ d2_racing

I have a 4core Phenom 9550.

I haven't had any problems with  MAKEOPTS="-j9"   so far.

 *Quote:*   

> you are missing some kernel option

 

What option might that be ??

 *Quote:*   

> 
> 
> @Logan11: These drivers are not compatible with kernel 2.6.27 and need a patch,
> 
> see:  https://forums.gentoo.org/viewtopic.php?p=5250560#5250560

 

How do I patch the kernel?  A "How-to patch the kernel for newbies"  link please?

----------

## energyman76b

the easy way to patch (you patch the driver, not the kernel)

put the patch into /usr/local/portage/x11-drivers/ati-drivers/files

(you might have to edit the patch from that link)

copy the ebuild into /usr/local/portage/x11-drivers/ati-drivers/files

add this line:

epatch "${FILESDIR}"/ati-drivers-2.6.27.patch

just above or below the other epatch line.

ebuild ... digest

emerge ati-drivers.

```

cat /usr/local/portage/x11-drivers/ati-drivers/files/ati-drivers-2.6.27.patch

--- common/lib/modules/fglrx/build_mod/firegl_public.c.orig     2008-09-19 10:57:09.000000000 +0200    

+++ common/lib/modules/fglrx/build_mod/firegl_public.c  2008-09-19 10:55:57.000000000 +0200            

@@ -199,6 +199,12 @@                                                                                   

 #define preempt_enable()                                                                              

 #endif                                                                                                

                                                                                                       

+/* Since 2.6.27 smp_call_function doesn't have a nonatomic/retry argument */                          

+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27)                                                      

+#define SMP_CALL_FUNCTION(func, info, retry, wait) smp_call_function(func, info, wait)                

+#else                                                                                                 

+#define SMP_CALL_FUNCTION(func, info, retry, wait) smp_call_function(func, info, retry, wait)         

+#endif                                                                                                

 // ============================================================                                       

 /* globals */                                                                                         

                                                                                                       

@@ -250,7 +256,7 @@                                                                                    

 const char BUILD_KERNEL_HAS_MODVERSIONS_CLEARED;                                                      

 #endif                                                                                                

                                                                                                       

-#ifdef __SMP__                                                                                        

+#ifdef CONFIG_SMP                                                                                     

 const unsigned long __ke_SMP_State = 1;                                                               

 const char BUILD_KERNEL_HAS_SMP_SET;                                                                  

 #else                                                                                                 

@@ -2516,8 +2522,8 @@                                                                                  

 {                                                                                                     

 /*Some kernel developer removed the export of symbol "flush_tlb_page" on 2.6.25 x86_64 SMP kernel.    

   Define a simple version here.*/                                                                     

-#if defined(__x86_64__) && defined(__SMP__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))         

-    on_each_cpu(KCL_flush_tlb_one, &va, 1, 1);                                                        

+#if defined(__x86_64__) && (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25))                             

+    on_each_cpu(KCL_flush_tlb_one, &va, 1);                                                           

 #else                                                                                                 

     flush_tlb_page(vma, va);                                                                          

 #endif                                                                                                

@@ -2902,7 +2908,7 @@                                                                                  

                                                                                                       

 /*****************************************************************************/                       

                                                                                                       

-#ifdef __SMP__                                                                                        

+#ifdef CONFIG_SMP                                                                                     

 static atomic_t cpus_waiting;

 static void deferred_flush(void* contextp)

@@ -2918,13 +2924,13 @@

        while (atomic_read(&cpus_waiting) > 0)

                barrier();

 }

-#endif /* __SMP__ */

+#endif /* CONFIG_SMP */

 int ATI_API_CALL __ke_flush_cache(void)

 {

-#ifdef __SMP__

+#ifdef CONFIG_SMP

     /* write back invalidate all other CPUs (exported by kernel) */

-       if (smp_call_function(deferred_flush, NULL, 1, 0) != 0)

+       if (SMP_CALL_FUNCTION(deferred_flush, NULL, 1, 0) != 0)

                panic("timed out waiting for the other CPUs!\n");

     /* invalidate this CPU */

@@ -2938,7 +2944,7 @@

        while (atomic_read(&cpus_waiting) > 0)

                barrier();

-#else /* !__SMP__ */

+#else /* !CONFIG_SMP */

 #if defined(__i386__) || defined(__x86_64__)

        asm volatile ("wbinvd":::"memory");

 #elif defined(__alpha__) || defined(__sparc__)

@@ -2946,7 +2952,7 @@

 #else

 #error "Please define flush_cache for your architecture."

 #endif

-#endif /* !__SMP__ */

+#endif /* !CONFIG_SMP */

     //for kernel 2.6.25, tlb_flush has been included when calling set_pages_*.

     #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)

@@ -4654,7 +4660,7 @@

    }

 #ifdef CONFIG_SMP

-   if (smp_call_function(KCL_setup_pat, NULL, 0, 1) != 0)

+   if (SMP_CALL_FUNCTION(KCL_setup_pat, NULL, 0, 1) != 0)

        return 0;

 #endif

    KCL_setup_pat(NULL);

@@ -4673,7 +4679,7 @@

     }

 #ifdef CONFIG_SMP

-    if (smp_call_function(KCL_restore_pat, NULL, 0, 1) != 0)

+    if (SMP_CALL_FUNCTION(KCL_restore_pat, NULL, 0, 1) != 0)

        return;

 #endif

     KCL_restore_pat(NULL);

```

----------

## Logan11

Thank you for the tips  energyman76b.   :Wink: 

It seems that the Gentoo devs beat me to it.

I did a:

emerge --sync

installed the  gentoo-sources-2.6.27 ,

rebooted the new kernel ,

installed the ati-drivers-8.542  again

and it did not complain at all.  No Errors.

```
>>> Emerging (1 of 1) x11-drivers/ati-drivers-8.542

 * ati-driver-installer-8-10-x86.x86_64.run RMD160 SHA1 SHA256 size ;-) ...  [ ok

]

 * checking ebuild checksums ;-) ...                                     [ ok ]

 * checking auxfile checksums ;-) ...                                    [ ok ]

 * checking miscfile checksums ;-) ...                                   [ ok ]

 * Determining the location of the kernel source code

 * Found kernel source directory:

 * /usr/src/linux

 * Found kernel object directory:

 * /lib/modules/2.6.27-gentoo/build

 * Found sources for kernel version:

 * 2.6.27-gentoo

>>> Unpacking source...

Warning: target directory exists /var/tmp/portage/x11-drivers/ati-drivers-8.542/wo

rk

Verifying archive integrity... All good.

Uncompressing ATI Proprietary Linux Driver-8.542

..................................

 * Applying ati-powermode-opt-path-2.patch ...                              [ ok ]

 * Applying ati-drivers-2.6.27.patch ...                                    [ ok ]

 * Converting 2.6.x/Makefile to use M= instead of SUBDIRS= ...              [ ok ]

>>> Unpacking......
```

----------

