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
Embedding perl with -DPERL_NO_SHORT_NAMES is not -Wall clean #14168
Comments
From afresh1@openbsd.orgCreated by afresh1@openbsd.orgWhen trying to build an embedded perl with -Wall and -DPERL_NO_SHORT_NAMES, cc This may be something I am missing in perlembed. $ cat perlbomb.c int $ cc -Wall -I. -DPERL_NO_SHORT_NAMES -o perlbomb perlbomb.c With blead: with 5.20.1: with 5.18.2: Perl Info
|
From @jkeenanOn Sat Oct 18 14:46:31 2014, afresh1@openbsd.org wrote:
On Linux, I tried to write and execute a program similar to your perlbomb.c. Results attached. But I have to confess that I don't understand why you are trying to compile a C program while including two Perl-specific headers. Can you clarify? Also, can you explain what this has to do with trying to build an embedded perl? That's a subject with which I (and I suspect many others) have no experience. Thank you very much. -- |
From @jkeenan$ cat perlbomb.c $ cc -Wall -I. -DPERL_NO_SHORT_NAMES -o perlbomb perlbomb.c |
The RT System itself - Status changed from 'new' to 'open' |
From andrew@afresh1.comI'm including those headers as directed in the perlembed manual. This would be used to include a perl interpreter in a program that isn't perl. http://perldoc.perl.org/perlembed.html On October 18, 2014 3:13:11 PM PDT, James E Keenan via RT <perlbug-followup@perl.org> wrote:
-- |
From @cpansproutOn Sat Oct 18 14:46:31 2014, afresh1@openbsd.org wrote:
PERL_NO_SHORT_NAMES is, unfortunately, unmaintained, and has been for a long time (maybe even a decade or more?). We have no infrastructure for testing it. Nor do we have any convention for documenting which items in perlapi.pod are macros (for which the Perl_ prefix would not work), and this has changed back and forth for many functions/macros. I wonder whether we should just remove it from perlembed.pod, or altogether. But there is certainly room for conflict with other C headers. So I don’t see any easy solution. -- Father Chrysostomos |
From @LeontOn Sun, Oct 19, 2014 at 1:19 AM, Father Chrysostomos via RT <
I successfully used it on 5.8, but 5.10 broke all hash functions. In Leon |
From @tonycozOn Sat Oct 18 16:19:44 2014, sprout wrote:
That isn't too hard to test, since we already test embedding. Patches attached.
This is the main problem. What should be available under PERL_NO_SHORT_NAMES? Should PL_* variables be available?
Tony |
From @tonycoz0001-Test-More-ify-lib-ExtUtils-t-Embed.t.patchFrom 84f5da0cd316cbeeed8b3bc635ecce7cdca31a07 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 30 Oct 2014 11:55:52 +1100
Subject: Test::More ify lib/ExtUtils/t/Embed.t
---
lib/ExtUtils/t/Embed.t | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t
index 4e05cfe..72e0726 100644
--- a/lib/ExtUtils/t/Embed.t
+++ b/lib/ExtUtils/t/Embed.t
@@ -12,6 +12,7 @@ use Config;
use ExtUtils::Embed;
use File::Spec;
use IPC::Cmd qw(can_run);
+use Test::More;
my $cc = $Config{'cc'};
if ( $Config{usecrosscompile} && !can_run($cc) ) {
@@ -23,7 +24,7 @@ print $fh <DATA>;
close($fh);
$| = 1;
-print "1..10\n";
+plan tests => 3;
my $cl = ($^O eq 'MSWin32' && $cc eq 'cl');
my $skip_exe = $^O eq 'os2' && $Config{ldflags} =~ /(?<!\S)-Zexe\b/;
@@ -136,13 +137,18 @@ if ($^O eq 'VMS' && !$status) {
print "# @cmd2\n";
$status = system(join(' ',@cmd2));
}
-print (($status? 'not ': '')."ok 1\n");
+is($status, 0, "build correctly");
my $embed_test = File::Spec->catfile(File::Spec->curdir, $exe);
$embed_test = "run/nodebug $exe" if $^O eq 'VMS';
print "# embed_test = $embed_test\n";
-$status = system($embed_test);
-print (($status? 'not ':'')."ok 10 # system returned $status\n");
+@out = `$embed_test`;
+chomp @out;
+is_deeply(\@out,
+ [ map "ok $_", 2..9 ],
+ "check test output");
+$status = $?;
+is($status, 0, "embedded code run correctly");
unlink($exe,"embed_test.c",$obj);
unlink("$exe.manifest") if $cl and $Config{'ccversion'} =~ /^(\d+)/ and $1 >= 14;
unlink("$exe$Config{exe_ext}") if $skip_exe;
--
1.7.10.4
|
From @tonycoz0002-roughly-fix-the-build-failures-for-PERL_NO_SHORT_NAM.patchFrom 4037d43257122e5784acf54ddd834cdfe76e1e1b Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 30 Oct 2014 12:07:41 +1100
Subject: roughly "fix" the build failures for PERL_NO_SHORT_NAMES builds
The AvFILL() definition uses mg_size(), a different solution would
be to change the AvFILL() definition to use Perl_mg_size().
The S__is_utf8_char_slow() change should be obvious.
All subject to change as we nail down what should be exposed under
PERL_NO_SHORT_NAMES.
---
inline.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/inline.h b/inline.h
index 5256e8c..63f9fa3 100644
--- a/inline.h
+++ b/inline.h
@@ -14,6 +14,8 @@
/* ------------------------------- av.h ------------------------------- */
+#ifndef PERL_NO_SHORT_NAMES
+
PERL_STATIC_INLINE SSize_t
S_av_top_index(pTHX_ AV *av)
{
@@ -23,6 +25,8 @@ S_av_top_index(pTHX_ AV *av)
return AvFILL(av);
}
+#endif
+
/* ------------------------------- cv.h ------------------------------- */
PERL_STATIC_INLINE GV *
@@ -239,7 +243,7 @@ S__is_utf8_char_slow(const U8 *s, const U8 *e)
PERL_ARGS_ASSERT__IS_UTF8_CHAR_SLOW;
assert(e >= s);
- utf8n_to_uvchr(s, e - s, &actual_len, UTF8_CHECK_ONLY);
+ Perl_utf8n_to_uvchr(aTHX_ s, e - s, &actual_len, UTF8_CHECK_ONLY);
return (actual_len == (STRLEN) -1) ? 0 : actual_len;
}
--
1.7.10.4
|
From @tonycoz0003-test-that-embedding-works-with-PERL_NO_SHORT_NAMES-d.patchFrom 55fb4a018a8dea027c6ffcdf24489d995ed4531a Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 30 Oct 2014 12:08:09 +1100
Subject: test that embedding works with PERL_NO_SHORT_NAMES defined
---
lib/ExtUtils/t/Embed.t | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/ExtUtils/t/Embed.t b/lib/ExtUtils/t/Embed.t
index 72e0726..f01a14c 100644
--- a/lib/ExtUtils/t/Embed.t
+++ b/lib/ExtUtils/t/Embed.t
@@ -24,8 +24,9 @@ print $fh <DATA>;
close($fh);
$| = 1;
-plan tests => 3;
+plan tests => 6;
+for my $short_names (0, 1) {
my $cl = ($^O eq 'MSWin32' && $cc eq 'cl');
my $skip_exe = $^O eq 'os2' && $Config{ldflags} =~ /(?<!\S)-Zexe\b/;
my $exe = 'embed_test';
@@ -53,6 +54,7 @@ if ($^O eq 'VMS') {
}
$crazy =~ s#/Obj[^=/]*=[\w\$\_\-\.\[\]\:]+##i;
push(@cmd,"/Include=(".join(',',@incs).")");
+ push(@cmd, "/Define=PERL_NO_SHORT_NAMES") if $short_names;
push(@cmd,$crazy);
push(@cmd,"embed_test.c");
@@ -74,6 +76,7 @@ if ($^O eq 'VMS') {
}
push(@cmd,"-I$inc",ccflags(),'embed_test.c');
+ push(@cmd, "-DPERL_NO_SHORT_NAMES") if $short_names;
if ($^O eq 'MSWin32') {
$inc = File::Spec->catdir($inc,'win32');
push(@cmd,"-I$inc");
@@ -149,12 +152,15 @@ is_deeply(\@out,
"check test output");
$status = $?;
is($status, 0, "embedded code run correctly");
-unlink($exe,"embed_test.c",$obj);
+unlink($exe,$obj);
unlink("$exe.manifest") if $cl and $Config{'ccversion'} =~ /^(\d+)/ and $1 >= 14;
unlink("$exe$Config{exe_ext}") if $skip_exe;
unlink("embed_test.map","embed_test.lis") if $^O eq 'VMS';
unlink(glob("./*.dll")) if $^O eq 'cygwin';
unlink($testlib) if $libperl_copied;
+}
+
+unlink("embed_test.c");
# gcc -g -I.. -L../ -o perl_test perl_test.c -lperl `../perl -I../lib -MExtUtils::Embed -I../ -e ccflags -e ldopts`
__END__
--
1.7.10.4
|
Migrated from rt.perl.org#123006 (status was 'open')
Searchable as RT123006$
The text was updated successfully, but these errors were encountered: