Bug 1362511

Summary: RFE: Build BlocksRuntime
Product: [Fedora] Fedora Reporter: Dr. David Alan Gilbert <dgilbert>
Component: compiler-rtAssignee: Ron Olson <tachoknight>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: airlied, davejohansen, gdubreui, jv+fedora, tachoknight
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-14 02:28:42 UTC Type: Bug
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: 1295115    

Description Dr. David Alan Gilbert 2016-08-02 12:10:27 UTC
Description of problem:
clang has a lambda like feature called 'blocks', to use it you apparently need a library called BlocksRuntime; we don't seem to have it on Fedora, but I can see that it is in the compile-rt/libs source directory but never gets built.
Without it when using clang with -fblocks  we get a:
  undefined reference to `_NSConcreteGlobalBlock'
and everything I've found points to needing that lib


Debian has it as a separate libblocksruntime

Version-Release number of selected component (if applicable):
clang-3.8.0-2.fc24.x86_64
compiler-rt-3.8.0-2.fc24.x86_64


How reproducible:
100%

Steps to Reproduce:
1. compile the test program below with -fblocks
2.
3.

clang t2.c -fblocks

#include <stdio.h>

#define FOO(p, body) ( ^(char *x) body (p) )

int main(int argc, char *argv[])
{
  printf("%x\n", FOO(argv[0], { return (x[0] != 'a'); }));
}


Actual results:
/tmp/t2-79d578.o:(.rodata+0x20): undefined reference to `_NSConcreteGlobalBlock'


Expected results:
We should have a library, (preferably linkable with -lBlocksRuntime to be consistent ??) that has that symbol.

Additional info:

Also see https://en.wikipedia.org/wiki/Blocks_(C_language_extension)

Comment 1 Fedora End Of Life 2017-07-25 22:12:38 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 2 Fedora End Of Life 2017-08-08 16:10:04 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.

Comment 3 Gilles Dubreuil 2017-10-26 22:36:02 UTC
Let's reopen this one as it's desperately needed to build Swift. 

The latest input allows to do so with the help from:
https://github.com/mackyle/blocksruntime/pull/5

Comment 4 Ron Olson 2018-01-29 15:00:53 UTC
FYI: This is now available in Fedora: https://bugzilla.redhat.com/show_bug.cgi?id=1534747

Comment 5 Dr. David Alan Gilbert 2018-01-29 15:08:23 UTC
Ron: Thanks for letting us know; I must give that feature another try.

Comment 6 Ron Olson 2018-01-29 15:15:50 UTC
BTW, your sample does run when compiled as you described:

clang tb.c -fblocks -lBlocksRuntime

This is on a Fedora 27 VM with libBlocksRuntime-static installed (which will bring in -devel and the runtime)

Comment 7 Ron Olson 2018-04-14 02:28:17 UTC
I've been using this for building Swift on Fedora on 27, 28, and Rawhide, so I think we can close this ticket as it's libBlocksRuntime is available and working.

Comment 8 Tom Stellard 2018-04-14 02:34:39 UTC
Is there some reason why this is its own package and not a sub-package of compiler-rt?

Comment 9 Ron Olson 2018-04-14 02:39:18 UTC
It's a weird catch-22 regarding building Swift, which builds its own compiler-rt tool chain, but funny enough needs libBlockRuntime already available for it to build properly (errors out otherwise).