mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] how to configure perl scripting to compile with thread support?
@ 2014-04-22  8:49 Martin Hollingsworth
  2014-04-22 11:00 ` Bernhard Walle
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Hollingsworth @ 2014-04-22  8:49 UTC (permalink / raw)
  To: ptxdist

Hi folks,
I am using PTXDIST 2013.01.0 to cross compile for the phyCORE-AM335x board using the OSELAS.Toolchain-2012.12.1 on Ubuntu 12.04 LTS 32bit.
Now I would like to add PERL scripting to my target, which works fine by using "ptxdist menu" and enabling PERL in the settings.

Unfortunately this builds PERL without the thread mechanisms, which have to be enabled before compiling PERL.
As "ptxdist menu" doesn't offer specific settings for PERL, I suppose I have to modify the ptxdist PERL rule (make) file from
/usr/local/lib/ptxdist-2013.01.0/rules/perl.make

This is where I stumble in adding the correct calling parameter into the rules file. 
The parameter I am looking for is described in the PERL documentation:
http://search.cpan.org/~shay/perl/INSTALL#Threads

If someone knows how to correctly modify the ptxdist PERL rule file I would appreciate your help.
Thanks in advance and regards,
Martin

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22  8:49 [ptxdist] how to configure perl scripting to compile with thread support? Martin Hollingsworth
@ 2014-04-22 11:00 ` Bernhard Walle
  2014-04-22 12:09   ` Martin Hollingsworth
  2014-04-22 14:48   ` Michael Olbrich
  0 siblings, 2 replies; 13+ messages in thread
From: Bernhard Walle @ 2014-04-22 11:00 UTC (permalink / raw)
  To: ptxdist

* Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de> [2014-04-22 10:49]:
> 
> This is where I stumble in adding the correct calling parameter into the rules file. 
> The parameter I am looking for is described in the PERL documentation:
> http://search.cpan.org/~shay/perl/INSTALL#Threads

Just copy /usr/local/lib/ptxdist-<version>/rules/perl.make to your BSP
(create the rules directory if it doesn't exist yet) and make following
modification:

Add '-Dusethreads' to PERL_CONF_OPT.

I'll send a patch to make this configurable.

At least the configure output looks like Perl is build with threads
after that modification. I didn't test on a target (or QEMU), though.


Regards,
Bernhard

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 11:00 ` Bernhard Walle
@ 2014-04-22 12:09   ` Martin Hollingsworth
  2014-04-22 12:20     ` Bernhard Walle
  2014-04-22 14:48   ` Michael Olbrich
  1 sibling, 1 reply; 13+ messages in thread
From: Martin Hollingsworth @ 2014-04-22 12:09 UTC (permalink / raw)
  To: ptxdist

Hi Bernhard,
thanks for the quick answer.

After changing the makefile with your proposed changes, I get output from "ptxdist go", which suggests indeed that perl is build with threadding enabled. After running "ptxdist images" and writing the new kernel and rootfs to target, unfortunately I still get the error message from perl:
"This Perl not built to support threads"

Any idea what could have gone wrong? My only idea is, that for some reason an old build of perl without threadding might have been integrated into the target image when running "ptxdist images". I will run a "ptxdist distclean", rebuild and post the result, just to make sure. But this will take a while on my machine.

Greetings, Martin

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 12:09   ` Martin Hollingsworth
@ 2014-04-22 12:20     ` Bernhard Walle
  2014-04-22 12:45       ` Martin Hollingsworth
  0 siblings, 1 reply; 13+ messages in thread
From: Bernhard Walle @ 2014-04-22 12:20 UTC (permalink / raw)
  To: ptxdist

* Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de> [2014-04-22 14:09]:
> 
> Any idea what could have gone wrong? My only idea is, that for some
> reason an old build of perl without threadding might have been
> integrated into the target image when running "ptxdist images". I will
> run a "ptxdist distclean", rebuild and post the result, just to make
> sure. But this will take a while on my machine.

Can you run 'readelf -d /usr/bin/perl' on the target (or on the host,
but be sure that's the same binary as on the target). At least here it
links against pthread.so.


Regards,
Bernhard

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 12:20     ` Bernhard Walle
@ 2014-04-22 12:45       ` Martin Hollingsworth
  2014-04-22 13:07         ` Bernhard Walle
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Hollingsworth @ 2014-04-22 12:45 UTC (permalink / raw)
  To: ptxdist

On the target readelf is not available, but when running it from the host onto the targets binary perl application file it results in a dependency to libpthread.so.0
0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]

Regards, 
Martin

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 12:45       ` Martin Hollingsworth
@ 2014-04-22 13:07         ` Bernhard Walle
  2014-04-22 13:50           ` Martin Hollingsworth
  0 siblings, 1 reply; 13+ messages in thread
From: Bernhard Walle @ 2014-04-22 13:07 UTC (permalink / raw)
  To: ptxdist

* Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de> [2014-04-22 14:45]:
> On the target readelf is not available, but when running it from the host onto the targets binary perl application file it results in a dependency to libpthread.so.0
> 0x00000001 (NEEDED)                     Shared library: [libpthread.so.0]

Do you have a Perl one-liner to test if threads are enabled?


Regards,
Bernhard

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 13:07         ` Bernhard Walle
@ 2014-04-22 13:50           ` Martin Hollingsworth
  2014-04-22 20:55             ` Bernhard Walle
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Hollingsworth @ 2014-04-22 13:50 UTC (permalink / raw)
  To: ptxdist

Hello Bernhard,
a simple one liner could be like this. Including the threads module already causes the error.
---------test.pl----------
#!/usr/bin/perl
use threads;
print "\n Hello World";
---------------------------
In the meantime a complete rebuild of the target after "ptxdist distclean" has finished, but the error still appears.

Regards, 
Martin

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 11:00 ` Bernhard Walle
  2014-04-22 12:09   ` Martin Hollingsworth
@ 2014-04-22 14:48   ` Michael Olbrich
  1 sibling, 0 replies; 13+ messages in thread
From: Michael Olbrich @ 2014-04-22 14:48 UTC (permalink / raw)
  To: ptxdist

On Tue, Apr 22, 2014 at 01:00:09PM +0200, Bernhard Walle wrote:
> * Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de> [2014-04-22 10:49]:
> > 
> > This is where I stumble in adding the correct calling parameter into the rules file. 
> > The parameter I am looking for is described in the PERL documentation:
> > http://search.cpan.org/~shay/perl/INSTALL#Threads
> 
> Just copy /usr/local/lib/ptxdist-<version>/rules/perl.make to your BSP
> (create the rules directory if it doesn't exist yet) and make following
> modification:
> 
> Add '-Dusethreads' to PERL_CONF_OPT.
> 
> I'll send a patch to make this configurable.

I don't use much perl, so I don't know what's common here but I think we
should enable it, without an option. Or are there any good reason why s.o.
might want to switch threading off?

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 13:50           ` Martin Hollingsworth
@ 2014-04-22 20:55             ` Bernhard Walle
  2014-04-23 11:50               ` Martin Hollingsworth
  0 siblings, 1 reply; 13+ messages in thread
From: Bernhard Walle @ 2014-04-22 20:55 UTC (permalink / raw)
  To: ptxdist

Hello Martin,

* Martin Hollingsworth <Martin.Hollingsworth@itk-engineering.de> [2014-04-22 15:50]:
> a simple one liner could be like this. Including the threads module already causes the error.
> ---------test.pl----------
> #!/usr/bin/perl
> use threads;
> print "\n Hello World";
> ---------------------------
> In the meantime a complete rebuild of the target after "ptxdist distclean" has finished, but the error still appears.

my patch to enable Perl is now against git master of ptxdist (which has
an updated version of Perl).

I tested in on a target (Raspberry Pi) and it works:

Disabled threads:

    root@vetero:~ perl -mthreads -e 'print "x\n";'
    This Perl not built to support threads
    Compilation failed in require.
    BEGIN failed--compilation aborted.

Enabled threads:

    root@vetero:~ perl -mthreads -e 'print "x\n";'
    x

Regards,
Bernhard

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-22 20:55             ` Bernhard Walle
@ 2014-04-23 11:50               ` Martin Hollingsworth
  2014-04-23 14:44                 ` Martin Hollingsworth
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Hollingsworth @ 2014-04-23 11:50 UTC (permalink / raw)
  To: ptxdist

Hello Bernhard,
thanks for the patch and for testing it on a target system. I appreciate your efforts!

Unfortunately I can't get it working on my system. I would like to avoid updating to the latest PTXdist version, since I want to keep my build environment as close as possible to the vendor supplied board support package. As I understood your previous message, it should be sufficient to copy the perl.make file to the rules directory of my board support package. I can verify that the build process runs the make script, by adding an invalid line to the file which creates an expected error during build.

I verified with the PERL manual of the used version, that the build flag is the same in the older version  5.14.2
http://search.cpan.org/~flora/perl-5.14.2/INSTALL#Threads

My perl.make file looks a little different than the one from the current GIT version, but I assume that's due to the different ptxdist and perl versions. Maybe this could be the source of problems, but I don't know ptxdist internals that well to find the problem.
This is the section of my perl.make file:
--------------
PERL_CONF_OPT	:= \
	--prefix=/usr \
	$(CROSS_AUTOCONF_ARCH) \
	--target=$(PTXCONF_GNU_TARGET) \
	--set-ld=$(CROSS_CC) \
	-Dusethreads
--------------

Several builds and tests later I wonder: What am I missing here at this point? Any idea where it could go wrong but the image actually compile without any error?
Thanks and Regards, 
Martin

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-23 11:50               ` Martin Hollingsworth
@ 2014-04-23 14:44                 ` Martin Hollingsworth
  2014-04-24  7:49                   ` Michael Olbrich
  0 siblings, 1 reply; 13+ messages in thread
From: Martin Hollingsworth @ 2014-04-23 14:44 UTC (permalink / raw)
  To: ptxdist

Here some more info I found in the meantime.
You can call "perl -V" which gives a lot of information about the build settings.
The target system outputs:
---------
[...]
  Platform:
    osname=linux, osvers=current, archname=arm-linux
    uname='arm-cortexa8-linux-gnueabihf'
    config_args='-Dusethreads -A ldflags=-pthread --prefix=/usr --host=arm-cortexa8-linux-gnueabihf --build=i686-host-linux-gnu --host=arm-cortexa8-linux-gnueabihf --target=arm-cortexa8-linux-gnueabihf --set-ld=arm-cortexa8-linux-gnueabihf-gcc --keeplog --mode=target --target=arm-cortexa8-linux-gnueabihf --targetarch=arm-cortexa8-linux-gnueabihf'
[...]
    useithreads=undef, usemultiplicity=undef
[...]
---------

As one can see from config_args the flag -Dusethreads is received, but the Perl internal flag "useithreads" stays undef. On my host this value is "defined" and threading works.
When you look into the config.sh file  (Shortened path: /BSP/phyCORE-AM335x-XXX/platform-XXX/build-target/perl-5.14.2/config.sh) which is generated by perl itself during the ptxdist build process, you will find this particular flag undef here as well.
I suppose this is the root of all evil - the perl config.sh file is not generated correctly. The question now is why...?

Greetings, 
Martin

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-23 14:44                 ` Martin Hollingsworth
@ 2014-04-24  7:49                   ` Michael Olbrich
  2014-04-24 11:28                     ` Martin Hollingsworth
  0 siblings, 1 reply; 13+ messages in thread
From: Michael Olbrich @ 2014-04-24  7:49 UTC (permalink / raw)
  To: ptxdist

On Wed, Apr 23, 2014 at 02:44:14PM +0000, Martin Hollingsworth wrote:
> Here some more info I found in the meantime.
> You can call "perl -V" which gives a lot of information about the build settings.
> The target system outputs:
> ---------
> [...]
>   Platform:
>     osname=linux, osvers=current, archname=arm-linux
>     uname='arm-cortexa8-linux-gnueabihf'
>     config_args='-Dusethreads -A ldflags=-pthread --prefix=/usr --host=arm-cortexa8-linux-gnueabihf --build=i686-host-linux-gnu --host=arm-cortexa8-linux-gnueabihf --target=arm-cortexa8-linux-gnueabihf --set-ld=arm-cortexa8-linux-gnueabihf-gcc --keeplog --mode=target --target=arm-cortexa8-linux-gnueabihf --targetarch=arm-cortexa8-linux-gnueabihf'
> [...]
>     useithreads=undef, usemultiplicity=undef
> [...]
> ---------
> 
> As one can see from config_args the flag -Dusethreads is received, but the Perl internal flag "useithreads" stays undef. On my host this value is "defined" and threading works.
> When you look into the config.sh file  (Shortened path: /BSP/phyCORE-AM335x-XXX/platform-XXX/build-target/perl-5.14.2/config.sh) which is generated by perl itself during the ptxdist build process, you will find this particular flag undef here as well.
> I suppose this is the root of all evil - the perl config.sh file is not generated correctly. The question now is why...?

Just speculating here: Did you try to set -Duseithreads instread of
-Dusethreads? At least in 5.18.2 these seem to be separate options. I have
no idea what the difference is.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [ptxdist] how to configure perl scripting to compile with thread support?
  2014-04-24  7:49                   ` Michael Olbrich
@ 2014-04-24 11:28                     ` Martin Hollingsworth
  0 siblings, 0 replies; 13+ messages in thread
From: Martin Hollingsworth @ 2014-04-24 11:28 UTC (permalink / raw)
  To: ptxdist

> Just speculating here: Did you try to set -Duseithreads instread of -Dusethreads? 
> At least in 5.18.2 these seem to be separate options. I have no idea what the difference is.
Yes, I tried both separately which had no effect. 

When using both flags together perl seems to be built with threading enabled (perl -V gives: "useithreads=define"), but starting any of the previous mentioned test code snippets result in a Segmentation Fault as soon as any thread related feature is used.

My current make file looks like this, the only modifications from stock ptxdist are the -Duse(i)thread lines.
--------------
PERL_CONF_OPT	:= \
	-Dusethreads -A ldflags=-pthread\
	-Duseithreads -A ldflags=-pthread\
	--prefix=/usr \
	$(CROSS_AUTOCONF_ARCH) \
	--target=$(PTXCONF_GNU_TARGET) \
	--set-ld=$(CROSS_CC)
--------------

Regards,
Martin

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2014-04-24 11:28 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-22  8:49 [ptxdist] how to configure perl scripting to compile with thread support? Martin Hollingsworth
2014-04-22 11:00 ` Bernhard Walle
2014-04-22 12:09   ` Martin Hollingsworth
2014-04-22 12:20     ` Bernhard Walle
2014-04-22 12:45       ` Martin Hollingsworth
2014-04-22 13:07         ` Bernhard Walle
2014-04-22 13:50           ` Martin Hollingsworth
2014-04-22 20:55             ` Bernhard Walle
2014-04-23 11:50               ` Martin Hollingsworth
2014-04-23 14:44                 ` Martin Hollingsworth
2014-04-24  7:49                   ` Michael Olbrich
2014-04-24 11:28                     ` Martin Hollingsworth
2014-04-22 14:48   ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox