Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using clang, prefer clang++ over g++ #32

Merged
merged 1 commit into from Aug 5, 2015
Merged

When using clang, prefer clang++ over g++ #32

merged 1 commit into from Aug 5, 2015

Conversation

plicease
Copy link
Contributor

@plicease plicease commented Aug 4, 2015

On my system gcc / g++ is much older than the clang / clang++ used to build Perl, and does not support the -fstack-protector-strong option that was apparently used when building Perl. I suggest using clang++ instead of g++ when the $Config{cc} is clang. This PR works for me, although I am happy to adjust it and test if you have a preferred solution. I am also happy to coordinate with ExtUtils::CppGuess if you think detection logic should go in there. What follows is the test failure that I get without this patch.

twin% prove -b t/02basic.t
t/02basic.t .. Running Mkbootstrap for _02basic_t_bc90 ()
chmod 644 "_02basic_t_bc90.bs"
"/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/bin/perl5.23.1" "/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/lib/5.23.1/ExtUtils/xsubpp"  -typemap "/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/lib/5.23.1/ExtUtils/typemap" -typemap "/home/ollisg/.cpanm/work/1438655477.4985/Inline-CPP-0.71/_Inline/build/_02basic_t_bc90/CPP.map"   _02basic_t_bc90.xs > _02basic_t_bc90.xsc && mv _02basic_t_bc90.xsc _02basic_t_bc90.c
g++ -xc++  -D_FILE_OFFSET_BITS=64 -c  -I"/home/ollisg/.cpanm/work/1438655477.4985/Inline-CPP-0.71/t" -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"0.00\" -DXS_VERSION=\"0.00\" -fPIC "-I/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/lib/5.23.1/x86_64-linux-thread-multi/CORE"   _02basic_t_bc90.c
g++: error: unrecognized command line option ‘-fstack-protector-strong’
make: *** [_02basic_t_bc90.o] Error 1

A problem was encountered while attempting to compile and install your Inline
CPP code. The command that failed was:
  "make > out.make 2>&1" with error code 2

The build directory was:
/home/ollisg/.cpanm/work/1438655477.4985/Inline-CPP-0.71/_Inline/build/_02basic_t_bc90

To debug the problem, cd to the build directory, and inspect the output files.

Environment PATH = '/home/ollisg/opt/rust/1.0.0/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/clang/3.6.1/bin:/home/ollisg/.perlbrew/libs/perl-5.23.1t@dev/bin:/home/ollisg/perl5/perlbrew/bin:/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/bin:/home/ollisg/opt/rust/1.0.0/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/clang/3.6.1/bin:/home/ollisg/opt/clang/3.4.2/bin:/home/ollisg/opt/rust/1.0.0alpha/bin:/home/ollisg/bin:/home/ollisg/opt/rust/0.9/bin:/home/ollisg/opt/pkg-config/0.28/bin:/home/ollisg/opt/clang/3.4/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games'
Environment PATH_WITHOUT_PERLBREW = '/home/ollisg/opt/rust/1.0.0/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/clang/3.6.1/bin:/home/ollisg/opt/clang/3.4.2/bin:/home/ollisg/opt/rust/1.0.0alpha/bin:/home/ollisg/bin:/home/ollisg/opt/rust/0.9/bin:/home/ollisg/opt/pkg-config/0.28/bin:/home/ollisg/opt/clang/3.4/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games'
 at t/02basic.t line 34.
        ...propagated at /home/ollisg/.perlbrew/libs/perl-5.23.1t@dev/lib/perl5/Inline/C.pm line 869.
BEGIN failed--compilation aborted at t/02basic.t line 34.
# Looks like your test exited with 2 before it could output anything.
t/02basic.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 12/12 subtests

Test Summary Report
-------------------
t/02basic.t (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: Bad plan.  You planned 12 tests but ran 0.
Files=1, Tests=0,  1 wallclock secs ( 0.02 usr  0.01 sys +  0.80 cusr  0.07 csys =  0.90 CPU)
Result: FAIL

@daoswald
Copy link
Owner

daoswald commented Aug 4, 2015

Graham,

Thanks for the PR. I'll review it tomorrow (Tuesday) and try to get it
integrated.

In the longrun we're trying to move as much of the logic as possible into
ExtUtils::CppGuess, but that's proven to be an elusive goal, mostly because
I haven't had the time.

Thanks again,

Dave

On Mon, Aug 3, 2015 at 8:38 PM, Graham Ollis notifications@github.com
wrote:

On my system gcc / g++ is much older than the clang / clang++ used to
build Perl, and does not support the -fstack-protector-strong option that
was apparently used when building Perl. I suggest using clang++ instead
of g++ when the $Config{cc} is clang. This PR works for me, although I am
happy to adjust it and test if you have a preferred solution. I am also
happy to coordinate with ExtUtils::CppGuess if you think detection logic
should go in there. What follows is the test failure that I get without
this patch.

twin% prove -b t/02basic.t
t/02basic.t .. Running Mkbootstrap for _02basic_t_bc90 ()
chmod 644 "_02basic_t_bc90.bs"
"/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/bin/perl5.23.1" "/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/lib/5.23.1/ExtUtils/xsubpp" -typemap "/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/lib/5.23.1/ExtUtils/typemap" -typemap "/home/ollisg/.cpanm/work/1438655477.4985/Inline-CPP-0.71/_Inline/build/_02basic_t_bc90/CPP.map" _02basic_t_bc90.xs > _02basic_t_bc90.xsc && mv _02basic_t_bc90.xsc _02basic_t_bc90.c
g++ -xc++ -D_FILE_OFFSET_BITS=64 -c -I"/home/ollisg/.cpanm/work/1438655477.4985/Inline-CPP-0.71/t" -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2 -DVERSION="0.00" -DXS_VERSION="0.00" -fPIC "-I/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/lib/5.23.1/x86_64-linux-thread-multi/CORE" _02basic_t_bc90.c
g++: error: unrecognized command line option ‘-fstack-protector-strong’
make: *** [_02basic_t_bc90.o] Error 1

A problem was encountered while attempting to compile and install your Inline
CPP code. The command that failed was:
"make > out.make 2>&1" with error code 2

The build directory was:
/home/ollisg/.cpanm/work/1438655477.4985/Inline-CPP-0.71/_Inline/build/_02basic_t_bc90

To debug the problem, cd to the build directory, and inspect the output files.

Environment PATH = '/home/ollisg/opt/rust/1.0.0/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/clang/3.6.1/bin:/home/ollisg/.perlbrew/libs/perl-5.23.1t@dev/bin:/home/ollisg/perl5/perlbrew/bin:/home/ollisg/perl5/perlbrew/perls/perl-5.23.1t/bin:/home/ollisg/opt/rust/1.0.0/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/clang/3.6.1/bin:/home/ollisg/opt/clang/3.4.2/bin:/home/ollisg/opt/rust/1.0.0alpha/bin:/home/ollisg/bin:/home/ollisg/opt/rust/0.9/bin:/home/ollisg/opt/pkg-config/0.28/bin:/home/ollisg/opt/clang/3.4/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games'
Environment PATH_WITHOUT_PERLBREW = '/home/ollisg/opt/rust/1.0.0/bin:/home/ollisg/opt/sbt/bin:/home/ollisg/opt/scala/2.11.1/bin:/home/ollisg/opt/clang/3.6.1/bin:/home/ollisg/opt/clang/3.4.2/bin:/home/ollisg/opt/rust/1.0.0alpha/bin:/home/ollisg/bin:/home/ollisg/opt/rust/0.9/bin:/home/ollisg/opt/pkg-config/0.28/bin:/home/ollisg/opt/clang/3.4/bin:/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games'
at t/02basic.t line 34.
...propagated at /home/ollisg/.perlbrew/libs/perl-5.23.1t@dev/lib/perl5/Inline/C.pm line 869.
BEGIN failed--compilation aborted at t/02basic.t line 34.

Looks like your test exited with 2 before it could output anything.

t/02basic.t .. Dubious, test returned 2 (wstat 512, 0x200)
Failed 12/12 subtests

Test Summary Report

t/02basic.t (Wstat: 512 Tests: 0 Failed: 0)
Non-zero exit status: 2
Parse errors: Bad plan. You planned 12 tests but ran 0.
Files=1, Tests=0, 1 wallclock secs ( 0.02 usr 0.01 sys + 0.80 cusr 0.07 csys = 0.90 CPU)
Result: FAIL


You can view, comment on, or merge this pull request online at:

#32
Commit Summary

  • When using clang, prefer clang++ over g++

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#32.

David Oswald
daoswald@gmail.com

daoswald added a commit that referenced this pull request Aug 5, 2015
When using clang, prefer clang++ over g++
@daoswald daoswald merged commit ef12883 into daoswald:master Aug 5, 2015
@daoswald
Copy link
Owner

daoswald commented Aug 5, 2015

This has been merged, and will be included in the next CPAN release.

@plicease
Copy link
Contributor Author

plicease commented Aug 5, 2015

Thanks! It installs great now with that gcc / clang / perl combo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants