EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: anyone ever crosscompile pvaPy?
From: Peter Milne via Tech-talk <tech-talk at aps.anl.gov>
To: "Veseli, Sinisa" <sveseli at anl.gov>, "Johnson, Andrew N." <anj at anl.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Sat, 23 May 2020 23:36:55 +0100
Hi Sinisa

Thank you very much for your help as well as Andrew.

Reporting Success!: the server/client example pair works.

Method repeated below for reference (builds HOST and TARGET).
For general use, the key is to introduce $(T_A) HEADER and LIB search paths that are valid for the
cross compile to work. Also, I had to set HAVE_BOOST_PYTHON_NUM_PY = 0, surprised as not in the make config

If we can automate this with a template for "make configure" rather than hacking
the generated file configure/CONFIG_SITE.local, it would be better.

Best regards


Peter


Our embedded system uses buildroot, so that influences where to look for embedded headers and libs.

Proceeded as follows:
make configure EPICS_BASE=$HOME/PROJECTS/EPICS/base \
   EPICS4_DIR=$HOME/PROJECTS/EPICS/base PYTHON_VERSION=3

Modified CONFIG_SITE.local as follows.

pgm@staffa3 pvaPy]$ git diff 5048ae703c1ae1b5bd5e2ec2bea34983b2828c6a
diff --git a/CONFIG_SITE_ACQ400.local b/CONFIG_SITE_ACQ400.local
new file mode 100644
index 0000000..c8e033e
--- /dev/null
+++ b/CONFIG_SITE_ACQ400.local
@@ -0,0 +1,28 @@
+
+ifeq ($(T_A),linux-arm)
+BR_BASE_HDR = $(HOME)/PROJECTS/acq400_buildroot/output/host/arm-buildroot-linux-gnueabihf/sysroot
+BR_BASE_LIB = $(HOME)/PROJECTS/acq400_buildroot/output/target
+PVA_PY_CPPFLAGS = -I$(BR_BASE_HDR)/usr/include -I$(BR_BASE_HDR)/usr/include/python3.8
+PVA_PY_LDFLAGS = -L$(BR_BASE_LIB)/lib -L$(BR_BASE_LIB)/usr/lib
+PVA_PY_SYS_LIBS = boost_python38 python3.8
+PYTHON_VERSION = 3.8
+endif
+
+

diff --git a/src/pvaccess/Makefile b/src/pvaccess/Makefile
index 8e0a376..5581fdb 100644
--- a/src/pvaccess/Makefile
+++ b/src/pvaccess/Makefile
@@ -41,7 +41,7 @@ endif
# Build the Python pvaccess loadable library -LOADABLE_LIBRARY_HOST += pvaccess
+LOADABLE_LIBRARY += pvaccess


... this seems simple enough "when you know how", if you're planning a more canonical method, I'll be happy to try it.


Run time:

acq2106_182> /mnt/local/server.py
pvAccess Server v7.1.1-SNAPSHOT
Active configuration (w/ defaults)
EPICS_PVAS_INTF_ADDR_LIST = 0.0.0.0:5075
EPICS_PVAS_BEACON_ADDR_LIST =
EPICS_PVAS_AUTO_BEACON_ADDR_LIST = YES
EPICS_PVAS_BEACON_PERIOD = 15
EPICS_PVAS_BROADCAST_PORT = 5076
EPICS_PVAS_SERVER_PORT = 5075
EPICS_PVAS_PROVIDER_NAMES = local
Runtime: 27.08; Counter:    100000, Rate: 3.69 [kHz]
Runtime: 71.83; Counter:    200000, Rate: 2.78 [kHz]
Runtime: 122.71; Counter:    300000, Rate: 2.44 [kHz]

acq2106_182> /mnt/local/client.py
STARTING MONITOR for counter at 1590272853.3175964
STOP MONITOR at 1590272913.3814576
FINAL STATS:
counter: Received:   74716 (  1.24 [kHz]); Missed:       0 (  0.00%)




On 22/05/2020 19:46, Veseli, Sinisa wrote:
Hi,

On 5/22/20 12:10 PM, Peter Milne wrote:
Hi Andrew

On 22/05/2020 16:27, Johnson, Andrew N. wrote:
Hi Peter,

On May 22, 2020, at 3:23 AM, Peter Milne via Tech-talk
<tech-talk at aps.anl.gov<mailto:tech-talk at aps.anl.gov>> wrote:

We have a requirement to run pvaPy on a linux-arm system.
The ARM system is configured to provide a full EPICS7, Boost lib.

Following
https://github.com/epics-base/pvaPy/blob/master/README.md

Custom Build:

Seems to build fine for EPICS_HOST_ARCH=linux-x86_64

It's also putting in hooks for linux-arm:
ls ./src/pvaccess/O.linux-arm
Makefile

...
pgm TOP ../../.. T_A linux-arm
make[3]: Nothing to be done for 'install'.
make[3]: Leaving directory
'/home/pgm/PROJECTS/EPICS/pvaPy/src/pvaccess/O.linux-arm'
make[2]: Leaving directory '/home/pgm/PROJECTS/EPICS/pvaPy/src/pvaccess'
make[1]: Leaving directory '/home/pgm/PROJECTS/EPICS/pvaPy/src'


.... does nothing..


Is there any way to enable a cross-compile?
I don't see any PROD_HOST entries that could be changed to PROD, for
example.


The important entry in src/pvaccess/Makefile is the line

LOADABLE_LIBRARY_HOST += pvaccess

Since pvaPy is a dynamic library that gets loaded by Python, there
are no binaries to create so no use of the PROD or PROD_HOST
variables in the Makefile. Change the above to LOADABLE_LIBRARY and
it should start cross-compiling for your target.

Yes, that's it!. Thank you. And, really generically the same idea as
PROD_HOST, should have spotted that.

So, the good news, it's trying to build.
The bad news, there are errors, maybe just one:

/usr/include/python3.7m/pyconfig.h:4:10: fatal error: pyconfig-32.h:

So the next step is to get it to look at the linux-arm version of the
python headers rather than the HOST version..

... and that suddenly becomes really site-specific..


The build looks into configure/CONFIG_SITE.local file to determine any
site specific settings, which might also include a custom python build.

Specifically, variables that can be modified are PVA_PY_CPPFLAGS and
PVA_PY_LDFLAGS. In one of my builds I have the following:

bluegill2> more configure/CONFIG_SITE.local
PVA_PY_CPPFLAGS = -I/local/sveseli/MARTY/CONDA/include/python3.7m
-I/local/sveseli/MARTY/opt/boost-python-1.70.0/include
PVA_PY_LDFLAGS = -L/local/sveseli/MARTY/CONDA/lib
-L/local/sveseli/MARTY/opt/boost-python-1.70.0/lib/linux-x86_64 -lpython3.7m
PVA_PY_SYS_LIBS = boost_python37  boost_numpy37
PVA_API_VERSION = 482
PVA_RPC_API_VERSION = 482
HAVE_BOOST_NUM_PY = 0
HAVE_BOOST_PYTHON_NUM_PY = 1
PYTHON_VERSION = 3.7
PVA_PY_PYTHON = /local/sveseli/MARTY/CONDA/bin/python3
PVA_PY_PYTHONPATH =
/local/sveseli/MARTY/pvapy-sv/lib/python/3.7/linux-x86_64
PVA_PY_LD_LIBRARY_PATH =
/local/sveseli/MARTY/CONDA/lib:/local/sveseli/MARTY/opt/boost-python-1.70.0/lib/linux-x86_64
PVA_PY_SPHINX_BUILD = /local/sveseli/MARTY/CONDA/bin/sphinx-build
PVA_PY_EPICS_BASE = /local/sveseli/MARTY/opt/epics-7.0.3.1
PVA_PY_EPICS4_DIR = /local/sveseli/MARTY/opt/epics-7.0.3.1
PVA_PY_HOST_ARCH = linux-x86_64
PVA_PY_SETUP_SH =
/local/sveseli/MARTY/pvapy-sv/bin/linux-x86_64/pvapy_setup_full.3.7.sh

Automatic configuration should work for the host architecture that you
are building on, but at the moment it will likely not work for
cross-compiles.


Hopefully you and Sinisa can work out some way to adjust the build so
cross-builds like this can be configured more easily, but I suspect
it may always need some kind of manual configuration to enable it.

.. as confirmed above.

Should be possible to make a configure/ option of course..

Thanks again Andrew

Cheers


I talked to Andrew about making this easier.

Sinisa


Peter




- Andrew


--
Complexity comes for free, simplicity you have to work for.







--
Peter Milne
Director of Sales
www.d-tacq.com

Replies:
Re: anyone ever crosscompile pvaPy? Veseli, Sinisa via Tech-talk
References:
anyone ever crosscompile pvaPy? Peter Milne via Tech-talk
Re: anyone ever crosscompile pvaPy? Johnson, Andrew N. via Tech-talk
Re: anyone ever crosscompile pvaPy? Peter Milne via Tech-talk
Re: anyone ever crosscompile pvaPy? Veseli, Sinisa via Tech-talk

Navigate by Date:
Prev: Re: EPICS 7 & Petalinux 2019.2 Heinz Junkes via Tech-talk
Next: Re: EPICS 7 & Petalinux 2019.2 Hu, Yong via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: Re: anyone ever crosscompile pvaPy? Veseli, Sinisa via Tech-talk
Next: Re: anyone ever crosscompile pvaPy? Veseli, Sinisa via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 28 May 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·