$ (perl -MConfig -e 'print $Config{cc}')
x86_64-linux-gnu-gcc$
####
$ (perl -MExtUtils::Embed -e ccopts -e ldopts)
-Wl,-E -fstack-protector-strong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.26/CORE -lperl -ldl -lm -lpthread -lc -lcrypt
-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.26/CORE $
##
##
$ locate EXTERN.h
/usr/lib/x86_64-linux-gnu/perl/5.26.1/CORE/EXTERN.h
$
##
##
$ pwd
/usr/lib/x86_64-linux-gnu/perl
$ ls -l 5.26*
lrwxrwxrwx 1 root root 6 Jul 18 2018 5.26 -> 5.26.1
##
##
/usr/bin/ld: cannot find -lperl
collect2: error: ld returned 1 exit status
##
##
Update the package index:
# sudo apt-get update
Install libperl-dev deb package:
# sudo apt-get install libperl-dev
##
##
$ x86_64-linux-gnu-gcc perl_embed_argv_signal.c -Wl,-E -fstack-protector-strong -I/usr/lib/x86_64-linux-gnu/perl/5.26.1/CORE -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.26.1/CORE -lperl -ldl -lm -lpthread -lc -lcrypt -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o embedex
$ ls
1.84.txt 2.analyse_text.pl embedex
1.analyse_text.pl 2.bliako.pl hs_ref_GRCh38.p12_chr20.fa
1.bliako.pl 2.bliako.txt hs_ref_GRCh38.p12_chr20.fa.3.state
1.bliako.txt 2.create.bash hs_ref_GRCh38.p12_chr20.fa.gz
1.c_calls_perl.c 3.bliako.txt Markov
1.em_perl.c 84-0.txt perl_embed_argv_signal.c
1.manifest 84.state 'Untitled Document 1'
1.predict.pl bliako1.pm 'Untitled Document 2'
$ ./embedex fruit flying dutchman
./embedex : perl_alloc()
./embedex : perl_construct()
./embedex : executing :
#$SIG{INT} = sub { print "Caught your ctrl-c and exiting!\n"; exit(0); };
$SIG{INT} = sub { print "Caught your ctrl-c but ignoring it!\n" };
print "$0: ARGV:"; print ' '.$_ foreach(@ARGV); print "\n";
print "my pid $$\n";
print "now sleeping, and you ctrl-c me\n";
for(1..100){sleep(1);print"$_\n";}
-e: ARGV: fruit flying dutchman
my pid 21007
now sleeping, and you ctrl-c me
1
2
3
4
5
^CCaught your ctrl-c but ignoring it!
6
7
8
9
^CCaught your ctrl-c but ignoring it!
10
11
12
13
...
99
100
./embedex : done.
$
##
##
$ x86_64-linux-gnu-gcc 2.perl_embed_argv_signal.c -Wl,-E -fstack-protector-strong -I/usr/lib/x86_64-linux-gnu/perl/5.26.1/CORE -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.26.1/CORE -lperl -ldl -lm -lpthread -lc -lcrypt -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -o embedex2
$ ./embedex2 slithy toves wirr and wimbel
./embedex2 : perl_alloc()
./embedex2 : perl_construct()
./embedex2 : executing :
$SIG{INT} = sub { print "Caught your ctrl-c and exiting!\n"; exit(0); };
#$SIG{INT} = sub { print "Caught your ctrl-c but ignoring it!\n" };
print "$0: ARGV:"; print ' '.$_ foreach(@ARGV); print "\n";
print "my pid $$\n";
print "now sleeping, and you ctrl-c me\n";
for(1..15){sleep(1);print"$_\n";}
-e: ARGV: slithy toves wirr and wimbel
my pid 21094
now sleeping, and you ctrl-c me
1
2
3
4
5
^CCaught your ctrl-c and exiting!
$