Bug 803433 - triplet path not being properly set/detected by clang/llvm
triplet path not being properly set/detected by clang/llvm
Status: NEW
Product: Fedora
Classification: Fedora
Component: llvm (Show other bugs)
24
arm Linux
unspecified Severity unspecified
: ---
: ---
Assigned To: Adam Jackson
Fedora Extras Quality Assurance
:
Depends On:
Blocks: ARMTracker F-ExcludeArch-ARM
  Show dependency treegraph
 
Reported: 2012-03-14 13:26 EDT by D. Marlin
Modified: 2016-02-24 08:11 EST (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)
llvm-3.2-clang-driver-secondary-arch-triplets.patch (951 bytes, patch)
2013-02-12 05:33 EST, Jens Petersen
no flags Details | Diff

  None (edit)
Description D. Marlin 2012-03-14 13:26:46 EDT
Description of problem:

The hfsplus-tools package fails to build on ARM systems.

  http://arm.koji.fedoraproject.org/koji/taskinfo?taskID=475427

Version-Release number of selected component (if applicable):

  hfsplus-tools-540.1.linux3-1.fc17
  clang-3.0-6.fc16.armv7hl

How reproducible:

  Always


Steps to Reproduce:
1.  submit an hfsplus-tools build to koji or mock on an ARM system.
2.
3.
  
Actual results:

    :
make[1]: Entering directory `/builddir/build/BUILD/diskdev_cmds-540.1.linux3/newfs_hfs.tproj'
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\"   -c -o hfs_endian.o hfs_endian.c
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\"   -c -o makehfs.o makehfs.c
clangclang: [0;1;35mwarning: [0m[1munknown platform, assuming -mfloat-abi=soft[0m
: [0;1;35mwarning: [0m[1munknown platform, assuming -mfloat-abi=soft[0m
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\"   -c -o newfs_hfs.o newfs_hfs.c
clang: warning: unknown platform, assuming -mfloat-abi=soft
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\" -Wl,--build-id -L/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -o newfs_hfs hfs_endian.o makehfs.o newfs_hfs.o -lcrypto
/usr/bin/ld: cannot find crtbegin.o: No such file or directory
/usr/bin/ld: cannot find -lgcc
/usr/bin/ld: cannot find -lgcc_s
clang: [0;1;31merror: [0m[1mlinker command failed with exit code 1 (use -v to see invocation) [err_drv_command_failed][0m
make[1]: Leaving directory `/builddir/build/BUILD/diskdev_cmds-540.1.linux3/newfs_hfs.tproj'
make[1]: *** [newfs_hfs] Error 1


Expected results:

  Build without errors.


Additional info:

- This particular build was on an ARMv7 hard-float (armv7hl) system.
- hfsplus-tools-332.14-12.fc15 did successfully build for F15 on both 
  armv7hl (hard-float) and armv5tel (soft-float):
    http://arm.koji.fedoraproject.org/koji/buildinfo?buildID=42023
Comment 1 D. Marlin 2012-03-14 14:34:26 EDT
Looking at this a bit more, it seems the bug may be in the clang tools.  I can reproduce the error with a simple hello.c program:

  $ clang -D LINUX=1 -D BSD=1 -c -o hello.o hello.c
  clang: warning: unknown platform, assuming -mfloat-abi=soft

  $ clang -D LINUX=1 -D BSD=1 hello.o -o hello
  /bin/ld: cannot find crtbegin.o: No such file or directory
  /bin/ld: cannot find -lgcc
  /bin/ld: cannot find -lgcc_s
  clang: error: linker command failed with exit code 1 (use -v to see invocation)


Changing component to llvm.
Comment 2 Peter Robinson 2012-06-17 16:42:35 EDT
The triplet is being incorrectly set. clang believes its armv7l-unknown-linux-gnueabi where our gcc puts the gcc bits in armv7hl-redhat-linux-gnueabi where crtbegin.o resides.
Comment 3 Peter Robinson 2012-06-17 17:18:16 EDT
More details here 

http://www.advogato.org/person/redi/diary/228.html
Comment 4 Jens Petersen 2013-02-12 05:33:37 EST
Created attachment 696461 [details]
llvm-3.2-clang-driver-secondary-arch-triplets.patch

I wonder if this patch might be enough for llvm-3.2.

For llvm-3.1 there seems to be no ARMHFTriples, just ARMTriples though.
Comment 5 Peter Robinson 2013-02-13 06:19:04 EST
(In reply to comment #4)
> Created attachment 696461 [details]
> llvm-3.2-clang-driver-secondary-arch-triplets.patch
> 
> I wonder if this patch might be enough for llvm-3.2.
> 
> For llvm-3.1 there seems to be no ARMHFTriples, just ARMTriples though.

I think land it in the release and we'll review and evolve as necessary.
Comment 6 Jens Petersen 2013-02-14 01:19:16 EST
I committed the above patch to pkg git master.

I should check upstream svn to see if llvm-3.3 will have any such anticipated triplet changes.
Comment 7 Jens Petersen 2013-02-20 03:53:34 EST
Wasn't good enough - trying another patch.
Comment 8 Jens Petersen 2013-02-21 02:32:08 EST
Changing "redhat-linux-gnueabi" to "redhat-linux" in the patch didn't help. Still got:

# clang -v -fsyntax-only -x c++ /dev/null
clang version 3.2 (tags/RELEASE_32/final)
Target: armv7hl-redhat-linux-gnu
Thread model: posix
clang: warning: unknown platform, assuming -mfloat-abi=soft
 "/usr/bin/clang" -cc1 -triple armv4t-redhat-linux-gnu -fsyntax-only -disable-free -disable-llvm-verifier -main-file-name null -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-abi apcs-gnu -target-cpu arm7tdmi -msoft-float -mfloat-abi soft -target-feature +soft-float -target-feature +soft-float-abi -target-feature -neon -target-linker-version 2.23.51.0.9 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.2/include -internal-externc-isystem /usr/include -internal-externc-isystem /usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.0/include -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir / -ferror-limit 19 -fmessage-length 174 -mstackrealign -fno-signed-char -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ /dev/null
clang -cc1 version 3.2 based upon LLVM 3.2svn default target armv7hl-redhat-linux-gnu
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/bin/../lib/clang/3.2/include
 /usr/include
 /usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.0/include
End of search list.

Not sure where the armv4t-redhat-linux-gnu is coming from...

Well there are a couple of simple workarounds:

1) most direct is using -mfloat-abi=hard, eg:

# clang -v -fsyntax-only -x c++ /dev/null -mfloat-abi=hard
clang version 3.2 (tags/RELEASE_32/final)
Target: armv7hl-redhat-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple armv4t-redhat-linux-gnu -fsyntax-only -disable-free -disable-llvm-verifier -main-file-name null -mrelocation-model static -mdisable-fp-elim -fmath-errno -mconstructor-aliases -target-abi apcs-gnu -target-cpu arm7tdmi -mfloat-abi hard -target-linker-version 2.23.51.0.9 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.2 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.2/include -internal-externc-isystem /usr/include -internal-externc-isystem /usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.0/include -fdeprecated-macro -fno-dwarf-directory-asm -fdebug-compilation-dir / -ferror-limit 19 -fmessage-length 174 -mstackrealign -fno-signed-char -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -x c++ /dev/null

2) probably the simplest hack would just be to patch clang on armv7hl,
etc to default to hard float.

That is a trivial one line patch but it would be better to straighten out
the redhat triplets for ARM (and any other secondary archs needed)
as others have also said.

Perhaps some patching is also needed to llvm, not just clang.
Comment 9 Fedora Admin XMLRPC Client 2013-02-27 10:11:25 EST
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.
Comment 10 Fedora End Of Life 2013-04-03 09:34:00 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19
Comment 11 Jens Petersen 2013-04-03 22:48:59 EDT
(In reply to comment #8)
> 2) probably the simplest hack would just be to patch clang on armv7hl,
> etc to default to hard float.

I see ausil did this in llvm-3.2-3.fc20.
Comment 12 Jens Petersen 2013-04-03 23:41:26 EDT
Hopefully llvm-3.2-4.fc20 with fixed old bogus date will complete in arm koji.
Comment 13 Jens Petersen 2013-04-04 02:08:02 EDT
For the record with llvm-3.2-2.fc20 (before the hack patch) I see:

make[1]: Entering directory `/builddir/build/BUILD/diskdev_cmds-540.1.linux3/fsck_hfs.tproj'
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\"   -c -o fsck_hfs.o fsck_hfs.c
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\"   -c -o utilities.o utilities.c
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\"   -c -o cache.o cache.c
clang -g3 -Wall -fblocks -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/BlocksRunTime -I/builddir/build/BUILD/diskdev_cmds-540.1.linux3/include -DDEBUG_BUILD=0 -D_FILE_OFFSET_BITS=64 -D LINUX=1 -D BSD=1 -D VERSION=\"540.1.linux3\"   -c -o fsck_messages.o fsck_messages.c
clangclangclangclang: : : warning: warning: warning: unknown platform, assuming -mfloat-abi=softunknown platform, assuming -mfloat-abi=soft
unknown platform, assuming -mfloat-abi=soft
clangclang: clang: warning: : warning: unknown platform, assuming -mfloat-abi=softwarning: unknown platform, assuming -mfloat-abi=soft
unknown platform, assuming -mfloat-abi=soft
: warning: unknown platform, assuming -mfloat-abi=soft
clang: warning: unknown platform, assuming -mfloat-abi=soft
In file included from In file included from fsck_messages.c:25:
In file included from /usr/include/assert.hIn file included from :36cache.c:
:In file included from /usr/include/features.h24::
399In file included from :
/usr/include/errno.h:28/usr/include/gnu/stubs.h:
In file included from :/usr/include/features.h7::39911:
: fatal error: /usr/include/gnu/stubs.h'gnu/stubs-soft.h' file not found:
7:11: fatal error: 'gnu/stubs-soft.h' file not found
# include <gnu/stubs-soft.h># include <gnu/stubs-soft.h>
          ^          ^
In file included from utilities.c:56:
In file included from /usr/include/sys/types.h:25:
In file included from /usr/include/features.h:399:
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-soft.h' file not found
# include <gnu/stubs-soft.h>
          ^
fsck_hfs.c:23:

(In reply to comment #12)
> Hopefully llvm-3.2-4.fc20 with fixed old bogus date will complete in arm
> koji.

The original llvm-3.2-3.fc20.armv7hl build failure was a perl issue and it is built now.
Comment 14 Jens Petersen 2013-04-04 02:13:12 EDT
I filed a bug upstream finally about the ARM triplets:
http://llvm.org/bugs/show_bug.cgi?id=15666
Comment 15 Jens Petersen 2013-04-04 03:46:23 EDT
Unforunately Dennis' patch to default to hw fp didn't help much:

:
clang: warning: unknown platform, assuming -mfloat-abi=hard
In file included from In file included from cache.c:24:
In file included from /usr/include/errno.h:28:
In file included from /usr/include/features.h:399:
/usr/include/gnu/stubs.h:7:11: fatal error: 'gnu/stubs-soft.h' file not found
# include <gnu/stubs-soft.h>
          ^
fsck_messages.c:25:
:

so looks like we really need a proper triplet fix indeed.
Comment 16 Peter Robinson 2013-04-04 11:29:11 EDT
Upstream bug report: http://llvm.org/bugs/show_bug.cgi?id=15557
Comment 17 Florian Weimer 2014-06-10 04:32:12 EDT
I see only one usage site for the clang blocks extension.  I can port it to C++11 or even C99 so that the program can be compiled with GCC.  Would that help?
Comment 18 Florian Weimer 2014-06-10 04:33:38 EDT
(In reply to Florian Weimer from comment #17)
> I see only one usage site for the clang blocks extension.  I can port it to
> C++11 or even C99 so that the program can be compiled with GCC.  Would that
> help?

I should have said that this offer refers to the original hfsplus-tools build failure.
Comment 19 Peter Robinson 2014-06-10 04:59:43 EDT
FWIW flterm is another package that needs llvm/clang and was FTBFS, I updated it and tested it and it built fine with the attempted fix. I'm not sure if that's due to the fix or due to changes in the new upstream version though.
Comment 20 Adam Jackson 2014-06-11 08:47:38 EDT
(In reply to Florian Weimer from comment #18)
> (In reply to Florian Weimer from comment #17)
> > I see only one usage site for the clang blocks extension.  I can port it to
> > C++11 or even C99 so that the program can be compiled with GCC.  Would that
> > help?
> 
> I should have said that this offer refers to the original hfsplus-tools
> build failure.

That would be lovely!  I would much prefer to build with gcc.
Comment 21 Adam Jackson 2014-06-18 13:07:29 EDT
(In reply to Adam Jackson from comment #20)
 
> That would be lovely!  I would much prefer to build with gcc.

I got morbidly curious about just what the blocks usage was for, and it turned out to be entirely straightforward to rewrite in C89.  So that's fixed, at least, but clang still doesn't really work on arm.
Comment 22 Fedora End Of Life 2015-01-09 12:04:15 EST
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 23 Fedora End Of Life 2015-11-04 05:40:18 EST
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 24 Jan Kurik 2016-02-24 08:11:31 EST
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Note You need to log in before you can comment on or make changes to this bug.