Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 803433

Summary: triplet path not being properly set/detected by clang/llvm
Product: [Fedora] Fedora Reporter: D. Marlin <dmarlin>
Component: llvmAssignee: Tom Stellard <tstellar>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: ajax, bos, bressers, dmalcolm, fweimer, michel, pbrobinson, peterm, rth, samuel-rhbugs, tstellar, yury
Target Milestone: ---   
Target Release: ---   
Hardware: arm   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-08 11:40:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 245418, 485251    
Attachments:
Description Flags
llvm-3.2-clang-driver-secondary-arch-triplets.patch none

Description D. Marlin 2012-03-14 17:26:46 UTC
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 18:34:26 UTC
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 20:42:35 UTC
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 21:18:16 UTC
More details here 

http://www.advogato.org/person/redi/diary/228.html

Comment 4 Jens Petersen 2013-02-12 10:33:37 UTC
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 11:19:04 UTC
(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 06:19:16 UTC
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 08:53:34 UTC
Wasn't good enough - trying another patch.

Comment 8 Jens Petersen 2013-02-21 07:32:08 UTC
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 15:11:25 UTC
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 13:34:00 UTC
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-04 02:48:59 UTC
(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-04 03:41:26 UTC
Hopefully llvm-3.2-4.fc20 with fixed old bogus date will complete in arm koji.

Comment 13 Jens Petersen 2013-04-04 06:08:02 UTC
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 06:13:12 UTC
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 07:46:23 UTC
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 15:29:11 UTC
Upstream bug report: http://llvm.org/bugs/show_bug.cgi?id=15557

Comment 17 Florian Weimer 2014-06-10 08:32:12 UTC
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 08:33:38 UTC
(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 08:59:43 UTC
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 12:47:38 UTC
(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 17:07:29 UTC
(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 17:04:15 UTC
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 10:40:18 UTC
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 13:11:31 UTC
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

Comment 25 Tom Stellard 2017-03-20 20:40:48 UTC
Is this still an issue?

Comment 26 Fedora Admin XMLRPC Client 2017-05-04 13:57:25 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 27 Fedora End Of Life 2017-07-25 18:29:51 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. 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 '24'.

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 24 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 28 Fedora End Of Life 2017-08-08 11:40:34 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.