Build Rtems failed with Clang

yangwei weiyang wei.a.yang at gmail.com
Wed Feb 22 13:37:44 UTC 2012


Hi all:
Now i have build RTEMS source code successfully for i386 with Clang
compiler. But there are still
some problems to be fixed. As follow:

1.clang does not find the newlib header files by default (now modify the
clang code to fix it)
2.clang has problem to handle the "-B" option (it does not seach the header
file under the directory
   specified by option "-B", now add CPPFLAGS to rtems configure system)
3.clang can handle the "-specs" option but you must with the
  format "-specs=specs_file" instand of "-specs specs_file" by default.
4.clang does not preprocess score/cpu/i386/cpu_asm.S the same as gcc.
Generates incorrect code.
  http://llvm.org/bugs/show_bug.cgi?id=10298
5.There are maybe some bugs in the rtems configure system. when attach the
  CC_FOR_TARGET,CC_FOR_BUILD flags to the cofigure command, it will
generate
  some config.status inside which will add CC="cross compiler" to every
subdir,
  but some subdir do not expect this CC, like in dir
i386-rtems4.11/c/pc386/lib/libbsp/i386/pc386/tools
  it contains some host code compiled by host compiler which should be auto
detected, if
  you add CC="cross compiler" it will failed.

The attachments are my configure log, build log and build script
1.c.log is configure log
2.b.log is my failed build log
3.c.log is my successful build log(when build failed i manually change the
CC flags in the
  i386-rtems4.11/c/pc386/lib/libbsp/i386/pc386/config.status).
4.build.sh is my build script.

Now about test case i only build sample test and also test all sample test
successfully,
but i found that the size of these test excutable file build by clang is
larger those build by gcc about 40%.

----------------------Build by
Clang--------------------------------------------
-rwxr-xr-x 1 root root 2463720 Feb 21 14:11 base_sp.exe
-rwxr-xr-x 1 root root 2808686 Feb 21 14:11 capture.exe
-rwxr-xr-x 1 root root 4554964 Feb 21 14:10 fileio.exe
-rwxr-xr-x 1 root root 2256130 Feb 21 14:10 hello.exe
-rwxr-xr-x 1 root root 3303244 Feb 21 14:10 loopback.exe
-rwxr-xr-x 1 root root 1846542 Feb 21 14:10 minimum.exe
-rwxr-xr-x 1 root root 2492752 Feb 21 14:10 nsecs.exe
-rwxr-xr-x 1 root root 2546250 Feb 21 14:09 paranoia.exe
-rwxr-xr-x 1 root root 3946616 Feb 21 14:09 pppd.exe
-rwxr-xr-x 1 root root 2491988 Feb 21 14:08 ticker.exe
-rwxr-xr-x 1 root root 2478225 Feb 21 14:09 unlimited.exe

---------------------Build by i386-rtems-gcc-------------------------------
-rwxr-xr-x 1 root root 1366763 Feb 21 15:42 base_sp.exe
-rwxr-xr-x 1 root root 1645500 Feb 21 15:42 capture.exe
-rwxr-xr-x 1 root root 2854663 Feb 21 15:42 fileio.exe
-rwxr-xr-x 1 root root 1286709 Feb 21 15:42 hello.exe
-rwxr-xr-x 1 root root 2025570 Feb 21 15:42 loopback.exe
-rwxr-xr-x 1 root root 1157628 Feb 21 15:42 minimum.exe
-rwxr-xr-x 1 root root 1395591 Feb 21 15:42 nsecs.exe
-rwxr-xr-x 1 root root 1455086 Feb 21 15:42 paranoia.exe
-rwxr-xr-x 1 root root 2632300 Feb 21 15:42 pppd.exe
-rwxr-xr-x 1 root root 1393107 Feb 21 15:42 ticker.exe
-rwxr-xr-x 1 root root 1379450 Feb 21 15:42 unlimited.exe

WeiY
Best Regards

2012/2/19 yangwei weiyang <wei.a.yang at gmail.com>

> Hi all:
>      When i build Rtems using Clang there is a problem i encounter. It
> seems that it is related with configuration which can not probe the right
> CC.
> My configure command is :
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> CPU=i386
> ../rtems/configure --target=${CPU}-rtems4.11 --with-newlib \
>   --prefix=/sdb1/rtems-llvm/rtems-install \
>   CC_FOR_BUILD="clang " \
>   CC_FOR_TARGET="clang -ccc-host-triple ${CPU}-rtems4.11 -ccc-gcc-name
> ${CPU}-rtems4.11-gcc "
>
> -----------------------------------------------------------------------------------------------------------------------------------------------------
> And it is OK, configure log is attached (named c.log)
> Then i make RTEMS_BSP="pc386", it will failed when execut
> c/src/lib/libbsp/i386/pc386/tools/configure. I see the
> c/src/lib/libbsp/i386/pc386/tools/config.log
> , when it check the build i686-pc-linux-gnu-gcc it using CC_FOR_TARGET. So
> this is absolutely wrong.
> I also attached make log (named b.log) and
> c/src/lib/libbsp/i386/pc386/tools/config.log.
>
> Wenjie
> Best Regards
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120222/dffb4429/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.sh
Type: application/x-sh
Size: 418 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120222/dffb4429/attachment-0001.sh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: a.log
Type: application/octet-stream
Size: 1125397 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120222/dffb4429/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: b.log
Type: application/octet-stream
Size: 113282 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120222/dffb4429/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: c.log
Type: application/octet-stream
Size: 10102 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20120222/dffb4429/attachment-0005.obj>


More information about the devel mailing list