Cc1 error code model kernel does not support pic model

I've been trying to compile the latest Linux v4.8.9 kernel on Ubuntu 16.10 and this error keeps popping up after I've made the default .config, modified it with menuconfig and ran make by itself. I...

I’ve been trying to compile the latest Linux v4.8.9 kernel on Ubuntu 16.10 and this error keeps popping up after I’ve made the default .config, modified it with menuconfig and ran make by itself. I’ve also run make mrproper as soon as I untarred the file. This is the output right after I run make:

scripts/kconfig/conf  --silentoldconfig Kconfig
  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_32_ia32.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_64_x32.h
  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_64.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h
  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h
  HOSTCC  arch/x86/tools/relocs_32.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTLD  arch/x86/tools/relocs
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
  WRAP    arch/x86/include/generated/asm/clkdev.h
  WRAP    arch/x86/include/generated/asm/cputime.h
  WRAP    arch/x86/include/generated/asm/dma-contiguous.h
  WRAP    arch/x86/include/generated/asm/early_ioremap.h
  WRAP    arch/x86/include/generated/asm/mcs_spinlock.h
  WRAP    arch/x86/include/generated/asm/mm-arch-hooks.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  CC      kernel/bounds.s
kernel/bounds.c:1:0: error: code model kernel does not support PIC mode
 /*

Kbuild:45: recipe for target 'kernel/bounds.s' failed
make[1]: *** [kernel/bounds.s] Error 1
Makefile:1015: recipe for target 'prepare0' failed
make: *** [prepare0] Error 2

I’ve also tried compiling with the -no-pie option after the make command but it renders a set of new errors, constantly saying that there are «missing targets». I have gcc version 6.2.0. I also have gcc-5 installed because I assumed in the beginning it might be because gcc was too new but the same problem persists in gcc-5. Someone in the mailing lists or another forum mentioned that the problem was resolved by directly cloning from git but that didn’t help in my scenario either.

I’m curious if anyone else has run into this problem and if so, what a possible fix might be?

NOTE:I’m running Ubuntu in Virtualbox on a Mac if that might be a possible source of problems.

asked Nov 20, 2016 at 6:45

John Long's user avatar

John LongJohn Long

1631 gold badge1 silver badge7 bronze badges

The issue is with your gcc installation, in gcc 6+ versions PIE( position independent executables) is enabled by default. So in order to compile you need to disable it.
Even gcc 5 has the issue.
This is a known bug for gcc. Bug Link.

So far there is no official patch from gcc side, so the workaround is to patch the Makefile of kernel source.

If you are familiar with patching the source file use the codes from this link to create the patch file then try to compile.Patch File

Let me know if you are having difficulties installing the patch.

answered Nov 21, 2016 at 1:45

Joy's user avatar

JoyJoy

1561 silver badge5 bronze badges

9

Open the Makefile, look for CFLAGS_EXTRA and add the following option to it -fno-pie

I had the line:

EXTRA_CFLAGS += $(CFLAGS_EXTRA)

I changed it for:

EXTRA_CFLAGS += $(CFLAGS_EXTRA) -fno-pie

For building kernel 4, above flag is: KBUILD_CFLAGS.

And it started compiling again.

abu_bua's user avatar

abu_bua

10.1k10 gold badges41 silver badges60 bronze badges

answered Jan 26, 2018 at 9:22

Natim's user avatar

NatimNatim

88311 silver badges23 bronze badges

2

GamingAori


Registered Member

Posts
5
Karma
0

cc1: error: code model kernel does not support PIC mode

Fri Mar 15, 2019 8:02 am

Hey,
I bought me a new WIFI USB Adapter the dootoper AC1200 which use the RTL88x2B according to the driver documentation. When I try compile the driver for installing it I get the error cc1: error: code model kernel does not support PIC mode. How can I solve this problem?

NoNameNoBlame

Karma
0

Re: cc1: error: code model kernel does not support PIC mode

Fri Mar 15, 2019 11:34 am

First of all:

Plug your device in.

Then use:

$ ubuntu-drivers —help

Did You do this?

GamingAori


Registered Member

Posts
5
Karma
0

Re: cc1: error: code model kernel does not support PIC mode

Fri Mar 15, 2019 12:06 pm

NoNameNoBlame wrote:First of all:

Plug your device in.

Then use:

$ ubuntu-drivers —help

Did You do this?

No, I didn’t. What does that?

NoNameNoBlame

Karma
0

Re: cc1: error: code model kernel does not support PIC mode

Fri Mar 15, 2019 12:21 pm

It installs the driver from Ubuntu,
if one exists.

If You don’t know what PIC
(position independent code)
as a compile-option does, and
whether Your kernel supports it
and if yes, how it does, then:

Please ask at the Ubuntu-Forum.
They provide KDE neon’s kernels and drivers.

But, if this doesn’t satisfy You, say so.

GamingAori


Registered Member

Posts
5
Karma
0

Re: cc1: error: code model kernel does not support PIC mode

Fri Mar 15, 2019 1:28 pm

NoNameNoBlame wrote:It installs the driver from Ubuntu,
if one exists.

If You don’t know what PIC
(position independent code)
as a compile-option does, and
whether Your kernel supports it
and if yes, how it does, then:

Please ask at the Ubuntu-Forum.
They provide KDE neon’s kernels and drivers.

But, if this doesn’t satisfy You, say so.

Okay just try it with ubuntu-drivers and it didn’t work. So how exactly do I compile and install the driver?

NoNameNoBlame

Karma
0

Re: cc1: error: code model kernel does not support PIC mode

Fri Mar 15, 2019 1:50 pm

I don’t know.

The last Linux-kernel, I compiled was over 15 years ago.

The last kernel I compiled myself, was a BSD-kernel. Also,
many years ago.

Follow my hint and go to the Ubuntu-forums.
And provide necessary details:

Where did You download the driver-source?
Give full location!

Did You follow the compile-instructions of the
driver’s included README files? Etc.

NoNameNoBlame

Karma
0

Re: cc1: error: code model kernel does not support PIC mode

Fri Mar 15, 2019 2:25 pm

And don’t forget to provide hardware info.
Like this:

Code: Select all
$ lspci -vvv | grep 11

03:00.0 Network controller: Broadcom Inc. and subsidiaries BCM4322 802.11a/b/g/n Wireless LAN Controller (rev 01)

$ lspci -vvv -n | grep -A1 03:00.0

03:00.0 0280: 14e4:432b (rev 01)
        Subsystem: 106b:008e

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© Copyright 2012 KDE Community Forum Team. All rights reserved.
KDE Community Forums has no liability for any content or post. All messages belong to and are the opinion of their respective authors.
KDE and K Desktop Environment are trademarks of KDE e.V. • For more details, contact the Forum Administrators.

  • Печать

Страницы: [1]   Вниз

Тема: Ошибка при компиляции cc1: error: code model kernel does not support PIC mode  (Прочитано 3529 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
ConnaiSSant

Ubuntu 18.04 64x
Компилирую драйвер usb для преобразователя интерфейса RS485

Полный выхлоп команды make:

 make:

make -C /lib/modules/4.15.0-20-generic/build M=/home/user/Загрузки/epsolar-tracer/xr_usb_serial_common-1a
make[1]: вход в каталог «/usr/src/linux-headers-4.15.0-20-generic»
  CC [M]  /home/user/Загрузки/epsolar-tracer/xr_usb_serial_common-1a/xr_usb_serial_common.o
cc1: error: code model kernel does not support PIC mode
scripts/Makefile.build:339: recipe for target '/home/user/Загрузки/epsolar-tracer/xr_usb_serial_common-1a/xr_usb_serial_common.o' failed
make[2]: *** [/home/user/Загрузки/epsolar-tracer/xr_usb_serial_common-1a/xr_usb_serial_common.o] Error 1
Makefile:1552: recipe for target '_module_/home/user/Загрузки/epsolar-tracer/xr_usb_serial_common-1a' failed
make[1]: *** [_module_/home/user/Загрузки/epsolar-tracer/xr_usb_serial_common-1a] Error 2
make[1]: выход из каталога «/usr/src/linux-headers-4.15.0-20-generic»
Makefile:9: recipe for target 'all' failed
make: *** [all] Error 2

В гугле предлагают какие то патчи

gcc —version
gcc (Ubuntu 7.3.0-16ubuntu3) 7.3.0

« Последнее редактирование: 15 Мая 2018, 22:15:45 от ConnaiSSant »


Оффлайн
bezbo

Пояснение:

The issue is with your gcc installation, in gcc 6+ versions PIE( position independent executables) is enabled by default. So in order to compile you need to disable it. Even gcc 5 has the issue. This is a known bug for gcc.

Решение:

Open the Makefile, look for CFLAGS_EXTRA and add the following option to it -fno-pie

I had the line:

EXTRA_CFLAGS += $(CFLAGS_EXTRA)

I changed it for:

EXTRA_CFLAGS += $(CFLAGS_EXTRA) -fno-pie

And it started compiling again.


Оффлайн
ConnaiSSant

Отсутствует CFLAGS_EXTRA

obj-m := xr_usb_serial_common.o

KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD       := $(shell pwd)

EXTRA_CFLAGS    := -DDEBUG=0

all:
        $(MAKE) -C $(KERNELDIR) M=$(PWD)

modules_install:
        $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install

clean:
        rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions vtty


Пользователь добавил сообщение 16 Мая 2018, 08:31:37:


Или как вариант, собрать gcc без pie


Пользователь добавил сообщение 16 Мая 2018, 21:06:32:


Но это долгий способ. Давайте сначало, какой Makefile нужно изменить? То что собираемся компилировать или при сборке gcc имеется ввиду? Если компилируемый код, то можно просто добавить целиком строку из вышеперечисленного ответа?

« Последнее редактирование: 16 Мая 2018, 21:06:32 от ConnaiSSant »


  • Печать

Страницы: [1]   Вверх

2018-10-29, 12:47

Posts: 17
Joined: 2018-Oct

Reputation: 0

code model kernel does not support PIC mode

Hello,

When I’m building «make bin-x86_64-pcbios/ipxe.lkrn», I get this error:

Code:

cc1: error: code model kernel does not support PIC mode
Makefile.housekeeping:936: recipe for target 'bin-x86_64-pcbios/__umoddi3.o' failed
make: *** [bin-x86_64-pcbios/__umoddi3.o] Error 1

And when I build it in 32 bit, I get a different error:

Code:

util/zbin.c:7:10: fatal error: lzma.h: No such file or directory
#include <lzma.h>
          ^~~~~~~~
compilation terminated.
Makefile.housekeeping:1381: recipe for target 'util/zbin' failed
make: *** [util/zbin] Error 1

Find all posts by this user

Quote this message in a reply

2018-10-29, 16:31

RE: code model kernel does not support PIC mode

I found a way to solve the «kernel does not support PIC mode». You just add «-fno-pie» at the end of this line in Makefile.housekeeping. Apparently it’s a bug with gcc v5+. link

Code:

CFLAGS          += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS) -fno-pie

On both architecture, I get the lzma.h error. Does anybody have a clue?

Find all posts by this user

Quote this message in a reply

2018-10-29, 19:10

RE: code model kernel does not support PIC mode

Any particular reason you are building bin-x86_64-pcbios instead of bin-i386-pcbios ?
in regards to lzma, check the http://ipxe.org/download#source_code page, relevant prerequsit: «liblzma or xz header files»

Are you building from latest git master? or what is the git commit that you are using?


Use GitHub Discussions
VRAM bin

Visit this user's website

Find all posts by this user

Quote this message in a reply

2018-10-31, 11:19

RE: code model kernel does not support PIC mode

Just needed to reinstall the liblzma package. Don’t know why but now it works. Thanks!

Find all posts by this user

Quote this message in a reply

2019-04-26, 10:30

RE: code model kernel does not support PIC mode

Hello,
I have a similar issue , after cloning the ipxe code source, the command «Make » generate a set of errors and the final result is as you see below:
Makefile.housekeeping:938: recipe for target ‘bin/__umoddi3.o’ failed
make: *** [bin/__umoddi3.o] Error 1

anyone have an idea about this ?
thank you

Find all posts by this user

Quote this message in a reply

2019-04-26, 20:03

RE: code model kernel does not support PIC mode

(2019-04-26 10:30)labba7 Wrote:  Hello,
I have a similar issue , after cloning the ipxe code source, the command «Make » generate a set of errors and the final result is as you see below:
Makefile.housekeeping:938: recipe for target ‘bin/__umoddi3.o’ failed
make: *** [bin/__umoddi3.o] Error 1

anyone have an idea about this ?
thank you

Have you done as the OP did and make sure that you have liblzma headers installed?

If so, what are you compiling on? (example Ubuntu 16 or similar)


Use GitHub Discussions
VRAM bin

Visit this user's website

Find all posts by this user

Quote this message in a reply

View previous topic :: View next topic  
Author Message
grellyd
n00b
n00b

Joined: 11 Oct 2016
Posts: 21

PostPosted: Wed Mar 14, 2018 6:34 am    Post subject: [solved]Kernel Build Fails: Kbuild does not support PIC mode Reply with quote

Hi all,

I am having some troubles after the 17.0 upgrade. In particular with the -PIC flag on the new gcc 6+ compiler and building the kernel.

I am experiencing the same symptoms from https://bugs.gentoo.org/621848.

I have corrected all emerge errors and every package has been rebuilt successfully on my system. However the problem comes when attempting to add new kernel flags.

After doing `make menuconfig` and selecting a few new options, when I go to do `make` I get:

Code:

  CHK     include/config/kernel.release

  CHK     include/generated/uapi/linux/version.h

  CHK     include/generated/utsrelease.h

  CC      kernel/bounds.s

kernel/bounds.c:1:0: error: code model kernel does not support PIC mode

 /*

 

make[1]: *** [Kbuild:45: kernel/bounds.s] Error 1

make: *** [Makefile:986: prepare0] Error 2

After extensive searching and trying the fixes suggested in various forum threads and the above bug thread, nothing has resolved my issue.

I also noted the bug thread was marked as ‘Fixed and Resolved’, yet I did not see where or how. Thinking it may just be in the most recent Linux tree, I re-emerged the Linux sources and tried to upgrade to Linux-4.9, but to no avail.

Any help would be highly appreciated.

—Grellyd

_______________________

My emerge -info as suggested in: https://forums.gentoo.org/viewtopic-t-1071006-highlight-kbuild.html

Code:

Portage 2.3.24 (python 3.6.3-final-0, default/linux/amd64/17.0/desktop, gcc-6.4.0, glibc-2.25-r10, 4.4.6-gentoo x86_64)

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

System uname: Linux-4.4.6-gentoo-x86_64-Intel-R-_Core-TM-_i7-4600U_CPU_@_2.10GHz-with-gentoo-2.4.1

KiB Mem:     8114852 total,    800900 free

KiB Swap:    8388604 total,   8386084 free

Timestamp of repository gentoo: Tue, 13 Mar 2018 22:30:01 +0000

Head commit of repository gentoo: 3f923ae8e40a95c604621adb4a25d5f23ceb5f93

sh bash 4.4_p12

ld GNU ld (Gentoo 2.29.1 p3) 2.29.1

app-shells/bash:          4.4_p12::gentoo

dev-java/java-config:     2.2.0-r3::gentoo

dev-lang/perl:            5.24.3::gentoo

dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo, 3.6.3-r1::gentoo

dev-util/cmake:           3.9.6::gentoo

dev-util/pkgconfig:       0.29.2::gentoo

sys-apps/baselayout:      2.4.1-r2::gentoo

sys-apps/openrc:          0.34.11::gentoo

sys-apps/sandbox:         2.12::gentoo

sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo

sys-devel/automake:       1.11.6-r3::gentoo, 1.15.1-r2::gentoo

sys-devel/binutils:       2.29.1-r1::gentoo

sys-devel/gcc:            6.4.0-r1::gentoo

sys-devel/gcc-config:     1.8-r1::gentoo

sys-devel/libtool:        2.4.6-r3::gentoo

sys-devel/make:           4.2.1::gentoo

sys-kernel/linux-headers: 4.13::gentoo (virtual/os-headers)

sys-libs/glibc:           2.25-r10::gentoo

Repositories:

gentoo

    location: /usr/portage

    sync-type: rsync

    sync-uri: rsync://rsync.gentoo.org/gentoo-portage

    priority: -1000

    sync-rsync-extra-opts:

    sync-rsync-verify-metamanifest: no

haskell

    location: /var/lib/layman/haskell

    masters: gentoo

    priority: 50

ACCEPT_KEYWORDS=»amd64″

ACCEPT_LICENSE=»* -@EULA»

CBUILD=»x86_64-pc-linux-gnu»

CFLAGS=»-O2 -pipe -march=haswell -mavx2″

CHOST=»x86_64-pc-linux-gnu»

CONFIG_PROTECT=»/etc /usr/share/gnupg/qualified.txt»

CONFIG_PROTECT_MASK=»/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c»

CXXFLAGS=»-O2 -pipe -march=haswell -mavx2″

DISTDIR=»/usr/portage/distfiles»

FCFLAGS=»-O2 -pipe»

FEATURES=»assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr»

FFLAGS=»-O2 -pipe»

GENTOO_MIRRORS=»rsync://gentoo.gossamerhost.com/gentoo-distfiles/ http://gentoo.gossamerhost.com http://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ ftp://mirror.csclub.uwaterloo.ca/gentoo-distfiles/ http://ftp.ucsb.edu/pub/mirrors/linux/gentoo/ ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/»

LANG=»en_CA.utf8″

LDFLAGS=»-Wl,-O1 -Wl,—as-needed»

MAKEOPTS=»-j8″

PKGDIR=»/usr/portage/packages»

PORTAGE_CONFIGROOT=»/»

PORTAGE_RSYNC_OPTS=»—recursive —links —safe-links —perms —times —omit-dir-times —compress —force —whole-file —delete —stats —human-readable —timeout=180 —exclude=/distfiles —exclude=/local —exclude=/packages —exclude=/.git»

PORTAGE_TMPDIR=»/var/tmp»

USE=»X a52 aac acl acpi alsa amd64 berkdb bluetooth branding bzip2 cairo cdda cdr cli consolekit crypt cups cxx dbus dri dts dvd dvdr emboss encode exif fam flac fortran gdbm gif git glamor google gpm gtk hscolour iconv ipv6 jit jpeg lcms ldap libnotify mad mmx mng modules mp3 mp4 mpeg multilib ncurses nls nptl nsplugin ogg opengl openmp pam pango pcre pdf png policykit ppds python qt3support qt5 readline sdl seccomp smp sound spell sse sse2 ssl startup-notification svg tcpd tiff truetype udev udisks unicode upower usb vim-syntax vorbis wxwidgets x264 xattr xcb xml xv xvid zlib» ABI_X86=»64″ ALSA_CARDS=»ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci» APACHE2_MODULES=»authn_core authz_core socache_shmcb unixd 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 cgi cgid 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» CALLIGRA_FEATURES=»kexi words flow plan sheets stage tables krita karbon braindump author» COLLECTD_PLUGINS=»df interface irq load memory rrdtool swap syslog» CPU_FLAGS_X86=»mmx mmxext sse sse2″ ELIBC=»glibc» GPSD_PROTOCOLS=»ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx» INPUT_DEVICES=»evdev libinput» KERNEL=»linux» LCD_DEVICES=»bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text» LIBREOFFICE_EXTENSIONS=»presenter-console presenter-minimizer» OFFICE_IMPLEMENTATION=»libreoffice» PHP_TARGETS=»php5-6 php7-0″ POSTGRES_TARGETS=»postgres9_5″ PYTHON_SINGLE_TARGET=»python3_6″ PYTHON_TARGETS=»python2_7 python3_6 python3_5″ RUBY_TARGETS=»ruby22 ruby23″ USERLAND=»GNU» VIDEO_CARDS=»intel» XTABLES_ADDONS=»quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account»

Unset:  CC, CPPFLAGS, CTARGET, CXX, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Last edited by grellyd on Wed Mar 14, 2018 10:37 pm; edited 1 time in total

Back to top

View user's profile Send private message

fedeliallalinea
Administrator
Administrator

Joined: 08 Mar 2003
Posts: 29426
Location: here

PostPosted: Wed Mar 14, 2018 6:59 am    Post subject: Reply with quote

It seems a gcc 6 bug, you have two workaround

  • Remove CONFIG_CC_STACKPROTECTOR_STRONG from kernel config
  • Apply a patch (not personal tested) to kernel Makefile

_________________
Questions are guaranteed in life; Answers aren’t.

Back to top

View user's profile Send private message

NeddySeagoon
Administrator
Administrator

Joined: 05 Jul 2003
Posts: 51961
Location: 56N 3W

PostPosted: Wed Mar 14, 2018 9:36 am    Post subject: Reply with quote

grellyd,

4.4.6-gentoo is an old kernel. Update it. Current stable is 4.9.76-r1
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-

those that do backups

those that have never had a hard drive fail.

Back to top

View user's profile Send private message

fedeliallalinea
Administrator
Administrator

Joined: 08 Mar 2003
Posts: 29426
Location: here

PostPosted: Wed Mar 14, 2018 9:46 am    Post subject: Reply with quote

NeddySeagoon wrote:
4.4.6-gentoo is an old kernel. Update it. Current stable is 4.9.76-r1



Mmm I don’t see that, thanks NeddySeagoon.

grellyd probably changing with a newest kernel is the best solution, forgets my workarounds
_________________
Questions are guaranteed in life; Answers aren’t.

Back to top

View user's profile Send private message

grellyd
n00b
n00b

Joined: 11 Oct 2016
Posts: 21

PostPosted: Wed Mar 14, 2018 7:51 pm    Post subject: Reply with quote

Quote:
4.4.6-gentoo is an old kernel. Update it. Current stable is 4.9.76-r1

Thanks for the replies you two. The kernel upgrade was one of the last things that I tried. That also doesn’t build.

Currently I get:

Code:

/usr/src/linux # eselect kernel list

Available kernel symlink targets:

  [1]   linux-4.4.6-gentoo

  [2]   linux-4.9.76-gentoo-r1 *

/usr/src/linux # make silentoldconfig

scripts/kconfig/conf  —silentoldconfig Kconfig

/usr/src/linux # make -j4

  CHK     include/config/kernel.release

  CHK     include/generated/uapi/linux/version.h

  CHK     include/generated/utsrelease.h

  HOSTCC  scripts/kallsyms

  CC      scripts/mod/empty.o

scripts/mod/empty.c:1:0: error: code model kernel does not support PIC mode

 /* empty file to figure out endianness / word size */

 

  HOSTCC  scripts/selinux/genheaders/genheaders

make[2]: *** [scripts/Makefile.build:259: scripts/mod/empty.o] Error 1

make[1]: *** [scripts/Makefile.build:403: scripts/mod] Error 2

make[1]: *** Waiting for unfinished jobs….

  HOSTCC  scripts/selinux/mdp/mdp

make: *** [Makefile:545: scripts] Error 2

make: *** Waiting for unfinished jobs….

which seems to be the same error as before?

The one thing I have not tried yet is nuking the directory as suggested in https://wiki.gentoo.org/wiki/Kernel/Upgrade#Solving_build_problems. I’ll try that next.

Back to top

View user's profile Send private message

grellyd
n00b
n00b

Joined: 11 Oct 2016
Posts: 21

PostPosted: Wed Mar 14, 2018 7:56 pm    Post subject: Reply with quote

Quote:
The one thing I have not tried yet is nuking the directory as suggested in https://wiki.gentoo.org/wiki/Kernel/Upgrade#Solving_build_problems. I’ll try that next.

That got a bit farther, but same produced the same result:

Code:

/usr/src/linux # cp .config /usr/src/kernel_config_bk

/usr/src/linux # ls /usr/src

kernel_config_bk  linux  linux-4.12.12-gentoo  linux-4.12.5-gentoo  linux-4.4.6-gentoo  linux-4.9.76-gentoo-r1

/usr/src/linux # make distclean

  CLEAN   .

  CLEAN   arch/x86/entry/vdso

  CLEAN   arch/x86/kernel/cpu

  CLEAN   arch/x86/kernel

  CLEAN   arch/x86/realmode/rm

  CLEAN   arch/x86/lib

  CLEAN   drivers/firmware/efi/libstub

  CLEAN   drivers/tty/vt

  CLEAN   drivers/video/logo

  CLEAN   firmware

  CLEAN   lib

  CLEAN   security/selinux

  CLEAN   usr

  CLEAN   arch/x86/boot/compressed

  CLEAN   arch/x86/boot

  CLEAN   arch/x86/tools

  CLEAN   .tmp_versions

  CLEAN   scripts/basic

  CLEAN   scripts/kconfig

  CLEAN   scripts/mod

  CLEAN   scripts/selinux/genheaders

  CLEAN   scripts/selinux/mdp

  CLEAN   scripts

  CLEAN   include/config include/generated arch/x86/include/generated

  CLEAN   .config .config.old .version Module.symvers

/usr/src/linux # mv /usr/src/kernel_config_bk .config

/usr/src/linux # make -j9

  HOSTCC  scripts/basic/fixdep

  HOSTCC  scripts/kconfig/conf.o

  SHIPPED scripts/kconfig/zconf.tab.c

  SHIPPED scripts/kconfig/zconf.lex.c

  SHIPPED scripts/kconfig/zconf.hash.c

  HOSTCC  scripts/kconfig/zconf.tab.o

  HOSTLD  scripts/kconfig/conf

scripts/kconfig/conf  —silentoldconfig Kconfig

  SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_32_ia32.h

  SYSHDR  arch/x86/entry/syscalls/../../include/generated/asm/unistd_64_x32.h

  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_32.h

  SYSTBL  arch/x86/entry/syscalls/../../include/generated/asm/syscalls_64.h

  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_32.h

  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_64.h

  SYSHDR  arch/x86/entry/syscalls/../../include/generated/uapi/asm/unistd_x32.h

  CHK     include/config/kernel.release

  UPD     include/config/kernel.release

  WRAP    arch/x86/include/generated/asm/clkdev.h

  WRAP    arch/x86/include/generated/asm/cputime.h

  WRAP    arch/x86/include/generated/asm/dma-contiguous.h

  WRAP    arch/x86/include/generated/asm/early_ioremap.h

  WRAP    arch/x86/include/generated/asm/mcs_spinlock.h

  WRAP    arch/x86/include/generated/asm/mm-arch-hooks.h

  CHK     include/generated/uapi/linux/version.h

  UPD     include/generated/uapi/linux/version.h

  CHK     include/generated/utsrelease.h

  UPD     include/generated/utsrelease.h

  HOSTCC  scripts/kallsyms

  HOSTCC  scripts/conmakehash

  HOSTCC  scripts/pnmtologo

  HOSTCC  scripts/sortextable

  CC      scripts/mod/empty.o

  HOSTCC  scripts/selinux/genheaders/genheaders

scripts/mod/empty.c:1:0: error: code model kernel does not support PIC mode

 /* empty file to figure out endianness / word size */

 

make[2]: *** [scripts/Makefile.build:259: scripts/mod/empty.o] Error 1

make[1]: *** [scripts/Makefile.build:403: scripts/mod] Error 2

make[1]: *** Waiting for unfinished jobs….

  HOSTCC  scripts/selinux/mdp/mdp

make: *** [Makefile:545: scripts] Error 2

make: *** Waiting for unfinished jobs….

Back to top

View user's profile Send private message

grellyd
n00b
n00b

Joined: 11 Oct 2016
Posts: 21

PostPosted: Wed Mar 14, 2018 9:22 pm    Post subject: Reply with quote

While looking back at your comment @fedeliallalinea

Quote:
Remove CONFIG_CC_STACKPROTECTOR_STRONG from kernel config

I wanted to see if it was set, and how I could remove it. So I grepped the file.

Code:
/usr/src/linux # grep STACKPROTECTOR .config

CONFIG_HAVE_CC_STACKPROTECTOR=y

# CONFIG_CC_STACKPROTECTOR is not set

CONFIG_CC_STACKPROTECTOR_NONE=y

# CONFIG_CC_STACKPROTECTOR_REGULAR is not set

# CONFIG_CC_STACKPROTECTOR_STRONG is not set

Does this look correct for a 4.9 Kernel? ‘STRONG’ does not appear to be set.

Could I have made an error while upgrading my kernel?

Back to top

View user's profile Send private message

Jaglover
Watchman
Watchman

Joined: 29 May 2005
Posts: 8291
Location: Saint Amant, Acadiana

PostPosted: Wed Mar 14, 2018 9:40 pm    Post subject: Reply with quote

After setting the symlink with eselect you need to do:

Code:
cd ../linux


_________________
My Gentoo installation notes.

Please learn how to denote units correctly!

Back to top

View user's profile Send private message

grellyd
n00b
n00b

Joined: 11 Oct 2016
Posts: 21

PostPosted: Wed Mar 14, 2018 9:59 pm    Post subject: Reply with quote

Jaglover wrote:
After setting the symlink with eselect you need to do:

Code:
cd ../linux

Ah that makes sense. Otherwise I’m still in the wrong directory.

I’ll try that now. It seems promising.

I missed that on https://wiki.gentoo.org/wiki/Kernel/Upgrade I’ll put in a wiki edit.

Back to top

View user's profile Send private message

grellyd
n00b
n00b

Joined: 11 Oct 2016
Posts: 21

PostPosted: Wed Mar 14, 2018 10:26 pm    Post subject: Reply with quote

My kernel compile is now running well.

Thanks for the help everyone.

My wiki edit to hopefully stop someone making the same mistake in the future: https://wiki.gentoo.org/wiki/Kernel/Upgrade#Moving_to_the_new_folder

Back to top

View user's profile Send private message

Display posts from previous:   

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

I am using Linux Mint 19 with kernel version 3.19.0-15.
I’ve been trying to install my D-Link DWA-131 E1 wireless adapter driver, but a constant same error appears. First I tried this custom patched version of manufacturer’s version — https://github.com/Mange/rtl8192eu-linux-driver.

After this, I thought that maybe my kernel version is older, so I should try the manufacturer’s driver version — http://files.dlink.com.au/products/DWA- … .3.1.1.zip. But the same error appears.

Please help me install the drivers of my wireless adapter.

This is what I did.

Code: Select all

sudo dkms install rtl8192eu/1.0

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
'make' all KVER=3.19.0-32-generic...(bad exit status: 2)
Error! Bad return status for module build on kernel: 3.19.0-32-generic (x86_64)
Consult /var/lib/dkms/rtl8192eu/1.0/build/make.log for more information.

And This is what was inside the /var/lib/dkms/rtl8192eu/1.0/build/make.log

Code: Select all

DKMS make.log for rtl8192eu-1.0 for kernel 3.19.0-32-generic (x86_64)
Fri Nov  2 22:51:00 IST 2018
make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/3.19.0-32-generic/build M=/var/lib/dkms/rtl8192eu/1.0/build  modules
make[1]: Entering directory '/usr/src/linux-headers-3.19.0-32-generic'
arch/x86/Makefile:114: stack-protector enabled but compiler support broken
Makefile:669: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
  CC [M]  /var/lib/dkms/rtl8192eu/1.0/build/core/rtw_cmd.o
cc1: error: code model kernel does not support PIC mode
scripts/Makefile.build:257: recipe for target '/var/lib/dkms/rtl8192eu/1.0/build/core/rtw_cmd.o' failed
make[2]: *** [/var/lib/dkms/rtl8192eu/1.0/build/core/rtw_cmd.o] Error 1
Makefile:1395: recipe for target '_module_/var/lib/dkms/rtl8192eu/1.0/build' failed
make[1]: *** [_module_/var/lib/dkms/rtl8192eu/1.0/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-3.19.0-32-generic'
Makefile:1700: recipe for target 'modules' failed
make: *** [modules] Error 2

[Sorry for my bad English, not my native language. I hope you all understood what I meant.]

Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.

Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.

  • Home
  • Forum
  • The Ubuntu Forum Community
  • Ubuntu Specialised Support
  • Development & Programming
  • Packaging and Compiling Programs
  • CC1 ERROR after running the make command

  1. CC1 ERROR after running the make command

    Hey, im building a kernel module and for some reason after a few times that it worked i get the following error:

    «cc1: error: code model kernel does not support PIC mode.»

    i looked around tried all kinds of things and nothing seems to work, even installed ubuntu again because i thought i courrupted some files, help please! thank you.


  2. Re: CC1 ERROR after running the make command


  3. Re: CC1 ERROR after running the make command

    i tried to add the EXTRA_FLAGS line it didnt work.
    about the comment with the patch — i didnt understand so idk ..

    i wierd stuff that i already build modules before and it suddenly happend.
    thanks for the quick replay!


  4. Re: CC1 ERROR after running the make command

    Can you paste the contents of Makefile at paste.ubuntu.com and post a link?


  5. Re: CC1 ERROR after running the make command

    its the simplest module ever:

    obj-m += x.o

    all:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

    clean:
    make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules

    ————————————————————————————


  6. Re: CC1 ERROR after running the make command

    What kernel and Ubuntu version? Also check

    Code:

    cat /usr/src/linux-headers-$(uname -r)/Makefile | grep -i pie

  7. Re: CC1 ERROR after running the make command

    ok i have no idea how it happend but it fixed itself, thank for the help!


Bookmarks

Bookmarks


Posting Permissions

Понравилась статья? Поделить с друзьями:
  • Cc id 231 ошибка бмв
  • Cd0600 ошибка бмв
  • Cc id 167 ошибка бмв
  • Cd0487 bmw ошибка f30
  • Cd rom drive error diablo 2