I've extracted driver from cd that came with my wireless card and modified it to build on kernel versions up to 4.15. Thanks to similar drivers already patched for new kernels it was an easy task. I've added RPI_ARM platform to Makefile. Even with my modifications when I build it on Raspbian I get following output with error:

make ARCH=arm CROSS_COMPILE= -C /lib/modules/4.14.34+/build M=/home/pi/rtl8821CU  modules
make[1]: Entering directory '/usr/src/linux-headers-4.14.34+'
  CC [M]  /home/pi/rtl8821CU/core/rtw_cmd.o
gcc: error: -mfloat-abi=soft and -mfloat-abi=hard may not be used together
scripts/Makefile.build:328: recipe for target '/home/pi/rtl8821CU/core/rtw_cmd.o' failed
make[2]: *** [/home/pi/rtl8821CU/core/rtw_cmd.o] Error 1
Makefile:1528: recipe for target '_module_/home/pi/rtl8821CU' failed
make[1]: *** [_module_/home/pi/rtl8821CU] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-4.14.34+'
Makefile:1906: recipe for target 'modules' failed
make: *** [modules] Error 2

I am using hardfloat image of Raspbian. There is no -mfloat-abi=soft in Makefile or in entire source. This driver builds on ubuntu with 4.15 kernel and even on Raspberry Pi if I disable -mfloat-abi=hard. How can I disable -mfloat-abi=soft?

My repo: https://github.com/whitebatman2/rtl8821CU

3 Answers 3


I further examined the driver and I managed to build it without modifying anything outside the driver. In many realtek drivers(those for AC cards) there is a CONFIG_MP_VHT_HW_TX_MODE flag. When you disable it in rtlXXXXx.mk file(where XXXXx is model number without last letter, e.g. 8821c), the driver doesn't use floating point variables at all. From what I've seen this driver doesn't support VHT modes so disabling it doesn't do anything bad. I added ifeq for Raspberry Pi platform so that this flag isn't set and the driver will work both on soft float and hard float os versions.


Does this driver run even without the -mfloat-abi=hard?

I ask this because figuring out where the problem lies may involve looking for defaults.

First, does your system have the directory: /lib/arm-linux-gnueabihf ? That directory has your library files in it compiled for hard float.

If the directory is missing, then you may not have a hard-float linux.

If you have the directory /lib/arm-linux-gnueabi then you have a soft float linux.

I don't know what happens if you have both of them. It's probably like crossing the beams or something.

I'm doing this on very little sleep, so the best I can further say is that the build system has defaults for compiler switches. There seems to be a switch set for mfloat-abi=soft somewhere in the build system.

  • I think your reference to "crossing the beams" is wrong - it's "streams", not "beams", as in, "Don't cross the streams", "It would be bad"; Egon in "Ghostbusters" :) Thanks - I needed that!
    – Seamus
    May 31, 2018 at 13:27
  • I've checked and my system has only /lib/arm-linux-gnueabihf directory. It's the official image from raspberrypi website. When I comment out mfloat-abi=hard it builds, but I don't remember the error I was getting when installing built module. May 31, 2018 at 13:40
  • When using softfloat module I have a lot of unknown symbols in dmesg starting with _aeabi, for example [12425.063686] 8821cu: Unknown symbol __aeabi_ui2d (err 0) May 31, 2018 at 14:37
  • Did you download any part of your build chain after you created the SD Card for Raspian?
    – NomadMaker
    May 31, 2018 at 15:14
  • Everything was downloaded through apt-get. This flag is set in Makefile from raspberrypi-kernel-headers package. Should I set ARCH to something different than ARM or are there different kernel headers that contain armhf version of Makefile? May 31, 2018 at 15:28

I found a solution to get this and possibly other drivers to build, but it porobably isn't the best one.

Kernel headers on Raspberry Pi and probably many different platforms prevent developers from using floating point variables in their modules by adding -msoft-float to gcc options. You can remove it from

/lib/modules/`uname -r`/build/arch/arm/Makefile

for the time of build and than after executing make add it back.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.