EPICS Home

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  <20192020  2021  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  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: cross-compiling (kind of) with Buildroot
From: Pierrick M Hanlet via Tech-talk <[email protected]>
To: "[email protected]" <[email protected]>
Date: Fri, 28 Jun 2019 14:58:15 +0000

Dear all,
Hi Tom,
I found a similar query in tech-talk back in 2013, but I didn't understand Andrew's resolution.

I'm attempting to build EPICS base for a VMIVME7805 intel based VME card.  The kernel I
have is 3.16.7.  We are using Buildroot on an SL7.5 host machine.  I'm attempting to build
3.14.12.8.

I had found Bruno Martins'  wiki page: https://wiki-ext.aps.anl.gov/epics/index.php/How_To_cross_compile_EPICS_and_a_IOC_to_an_old_x86_Linux_system
which is very helpful.  However, Buildroot segregates the build tools from the lib & bin & include
files.

From Buildroot, my build tools are in:
.../host/usr/bin/i686-buildroot-linux-uclibc/
And, my staged lib & include & bin files are in:
.../host/staging/.

So, here's what I have in ./base/configure/os/CONFIG_SITE.Common.linux-686:
# Location of the cross-compile toolchain
VMIVME=/usr/local/products/elsd/vmivme7805/linux-3.16.7_generic/output
GNU_DIR=$(VMIVME)/host/usr
GNU_TARGET=i686-buildroot-linux-uclibc

SHRLIB_DEPLIB_DIRS += $(VMIVME)/staging/usr/lib
PROD_DEPLIB_DIRS   += $(VMIVME)/staging/usr/lib

In order to get the headers correct, I also modified ./base/configure/CONFIG.CrossCommon:
#GNU_TARGET_INCLUDE_DIR = $(wildcard $(GNU_TARGET:%=$(GNU_DIR)/%/include))
#GNU_TARGET_LIB_DIR = $(wildcard $(GNU_TARGET:%=$(GNU_DIR)/%/lib))
GNU_TARGET_INCLUDE_DIR = $(VMIVME)/staging/usr/include
GNU_TARGET_LIB_DIR     = $(VMIVME)/staging/usr/lib



It appears that I can compile everything; for example (the last compile command):
/usr/local/products/elsd/vmivme7805/linux-3.16.7_generic/output/host/usr/bin/i686-buildroot-linux-uclibc-g++ -o libCom.so.3.14 -shared -fPIC -L/usr/local/products/elsd/vmivme7805/linux-3.16.7_generic/output/staging/usr/lib -Wl,-rpath,/usr/local/products/elsd/vmivme7805/linux-3.16.7_generic/output/staging/usr/lib        -m32    -L/usr/local/products/elsd/vmivme7805/linux-3.16.7_generic/output/host/usr/../../staging/usr/lib            bucketLib.o epicsRingPointer.o epicsRingBytes.o postfix.o calcPerform.o cvtFast.o resourceLib.o epicsOnce.o epicsSingletonMutex.o dbmf.o ellLib.o envSubr.o envData.o errlog.o errSymLib.o errSymTbl.o fdmgr.o fdManager.o freeListLib.o gpHashLib.o iocsh.o registry.o libComRegister.o iocLog.o logClient.o macCore.o macEnv.o macUtil.o aToIPAddr.o adjustment.o cantProceed.o epicsConvert.o epicsExit.o epicsStdlib.o epicsString.o truncateFile.o ipAddrToAsciiAsynchronous.o epicsUnitTest.o epicsThread.o epicsMutex.o epicsEvent.o epicsTime.o epicsMessageQueue.o epicsMath.o epicsGeneralTime.o osiClockTime.o osdSock.o osdSockAddrReuse.o osiSock.o systemCallIntMech.o epicsSocketConvertErrnoToString.o osdAssert.o osdFindSymbol.o osdInterrupt.o osdPoolStatus.o osdSignal.o osdEnv.o epicsReadline.o epicsTempFile.o epicsStdio.o osdStdio.o osdThread.o osdMutex.o osdEvent.o osdTime.o osdProcess.o osdNetIntf.o osdMessageQueue.o devLibVME.o devLibVMEOSD.o taskwd.o epicsTimer.o timer.o timerQueue.o timerQueueActive.o timerQueueActiveMgr.o timerQueuePassive.o tsDefs.o      -lpthread   -lreadline -lncurses -lm -lrt -ldl -lgcc

But when it comes to loading shared libraries, it fails (next command in make):
/scratch/products/elsd/vmivme7805/linux-3.16.7_generic/output/host/usr/bin/../lib/gcc/i686-buildroot-linux-uclibc/4.8.3/../../../../i686-buildroot-linux-uclibc/bin/ld: cannot find /lib/libubacktrace.so.0
collect2: error: ld returned 1 exit status
make[3]: *** [libCom.so.3.14] Error 1


Firstly, I didn't understand why libubacktrace.so (used by uclibc) appears to have a hard-coded path.
However, when I created a softlink (yes, a cheat) so that it was found, the build failed next on readline;
which tells me, if I understand it, that SHRLIB_DEPLIB_DIRS += $(VMIVME)/staging/usr/lib didn't work
as expected.  From Andrew's response to the 2013 query, the problem appears to be more
subtle; i.e. don't build a linux-x86 system on a linux-x86 system since it will always build for the
host first.

I would greatly appreciate a better understanding of the problem and how to implement a remedy?
The application developer's guide does not appear (perhaps I'm missing something) to deal with
the situation presented by Buildroot's segregating build tools from target libraries, header files, etc.
Thank you,
Pierrick


On 6/26/19 2:35 PM, Bruno Martins wrote:
Hi Pierrick,

I am glad this document has been useful to you. From the description of the NOTE that you mention, it seems that the following (added to CONFIG_SITE.Common.linux-686) would be enough:

SHRLIB_DEPLIB_DIRS += /first/path/to/libs /second/path/to/libs     (and so on)
PROD_DEPLIB_DIRS += /first/path/to/libs    (and so on)

If that doesn't work, it's worth asking this question on tech-talk, which has people with way more knowledge of the EPICS build system than I do :)


HTH,

Bruno


On Wed, Jun 26, 2019 at 3:18 PM Pierrick M Hanlet <[email protected]> wrote:
Hi Bruno,
I'm following your wiki page "How To cross compile EPICS and a IOC to an
old x86 Linux system"
as I have a similar task.  So far it's been very helpful; however, I
have a slight difference as I'm
not using Crosstool-NG, but Buildroot.

In the Buildroot model, the binaries required for building are in a
separate/parallel path to the
shared libraries and header files.  Hence the GNU_TARGET definition in my
CONFIG_SITE.Common.linux-686 file isn't enough.  At the top of the same
file, there is a "NOTE
for SHARED_LIBRARIES: ..." which deals with my situation.  I'd like to
implement suggestion b),
but I don't know how to implement it.  Can you shed some light on this
for me?
Thank you,
Pierrick

--
Pierrick Hanlet
Fermi National Accelerator
Accelerator Front End Controls
+1-630-840-5555 -- lab
+1-312-687-4980 -- mobile

"Whether you think you can or think you can't, you're right" -- Henry Ford


-- 
Pierrick Hanlet
Fermi National Accelerator
Accelerator Front End Controls
+1-630-840-5555 -- lab
+1-312-687-4980 -- mobile

"Whether you think you can or think you can't, you're right" -- Henry Ford

Replies:
Fwd: cross-compiling (kind of) with Buildroot Pierrick M Hanlet via Tech-talk

Navigate by Date:
Prev: procServ v2.8.0 available Ralph Lange via Tech-talk
Next: Re: Re:Re: .opi from CSS to Phoebus Hinko Kocevar 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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: [EXTERNAL] procServ v2.8.0 available Ralph Lange via Tech-talk
Next: Fwd: cross-compiling (kind of) with Buildroot Pierrick M Hanlet 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  <20192020  2021  2022  2023  2024