title: Using files generated by other recipes in Yocto
body: <p><em>Note: The general question is in bold at the end of this post.</em></p>
  
  <p>I'm trying to build PostGIS 2.2.7 with Yocto (Rocko) for my Linux i.MX6 based embedded system. First of all, I have installed PostgreSQL 9.4.15 from OpenEmbedded Layers (<a href="https://layers.openembedded.org/layerindex/recipe/5558/" rel="noreferrer">https://layers.openembedded.org/layerindex/recipe/5558/</a>) and all the (mandatory) dependencies I could find in the installation manual (<a href="https://download.osgeo.org/postgis/docs/postgis-2.2.7.pdf" rel="noreferrer">https://download.osgeo.org/postgis/docs/postgis-2.2.7.pdf</a>): GNU C, Proj4, GEOS, LibXML2 and JSON-C. Adding the following packages to my image (local.conf):</p>
  
  <pre><code>IMAGE_INSTALL_append += " postgresql postgresql-dev postgresql-server-dev proj proj-dev json-c json-c-dev geos geos-dev libxml2 libxml2-dev"
  </code></pre>
  
  <p>Then I tried to compile PostGIS inside my target system, and making some changes to a couple of files I succeeded.</p>
  
  <p>Finally, as long as I want to integrate PostGIS into my image with Yocto, I wrote the postgis recipe (I have a "files" folder with the postgis-2.2.7.tar.gz tar):</p>
  
  <pre><code>DESCRIPTION = "PostGIS is a spatial database extender for PostgreSQL object-relational database. It adds support for geographic objects allowing location queries to be run in SQL."
  
  SECTION = "devel"
  
  LICENSE = "GPL-3.0"
  LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891"
  
  DEPENDS += "gcc postgresql libxml2 geos proj json-c"
  
  RDEPENDS_${PN} = "postgresql-server-dev postgresql-dev"
  
  SRC_URI = "file://postgis-2.2.7.tar.gz"
  
  EXTRA_OECONF +=  "\
      --without-raster \
      --with-pgconfig=${STAGING_BINDIR_CROSS}"
  
  inherit autotools pkgconfig
  
  do_configure () {
      oe_runconf
  }
  
  do_compile () {
      oe_runmake
  }
  </code></pre>
  
  <p>But when I run bitbake in order to build my image, I get the following ERROR coming from PostGIS' do_configure function</p>
  
  <pre><code>| configure: error: the user-specified pg_config file /home/danlor/yocto-hmcu/build-hmcu/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/postgis/2.2.7-r0/recipe-sysroot/usr/bin/crossscripts does not exist 
  | NOTE: The following config.log files may provide further information. 
  | NOTE: /home/danlor/yocto-hmcu/build-hmcu/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/postgis/2.2.7-r0/build/config.log 
  | ERROR: configure failed | WARNING: exit code 1 from a shell command. 
  | ERROR: Function failed: do_configure (log file is located at /home/danlor/yocto-hmcu/build-hmcu/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/postgis/2.2.7-r0/temp/log.do_configure.45983)
  </code></pre>
  
  <p>Of course, this error is triggered because the executable pg_config is not located in <em>${STAGING_BINDIR_CROSS}</em>, either nowhere else but in the work folder of PostgreSQL (in ../image/usr/bin and ../package/usr/bin subfolders). My /tmp/sysroots folder is empty also.</p>
  
  <p><strong>So, the real question is: How can I access to the files generated by other recipes from my own recipe?</strong> I need to specify that path (along with others, from the rest of dependencies) in order to configure, compile and install PostGIS into my image.</p>
  
  <p><strong>EDIT 26/07/2018:</strong></p>
  
  <p>pg_config can be found in the following directories inside the postgresql ${WORKDIR}</p>
  
  <pre><code>./package/usr/bin/pg_config
  ./package/usr/bin/.debug/pg_config
  ./package/usr/src/debug/postgresql/9.4.15-r0/postgresql-9.4.15/src/bin/pg_config
  ./postgresql-9.4.15/src/bin/pg_config
  ./build/src/bin/pg_config
  ./build/src/bin/pg_config/pg_config
  ./packages-split/postgresql-dbg/usr/bin/.debug/pg_config
  ./packages-split/postgresql-dbg/usr/src/debug/postgresql/9.4.15-r0/postgresql-9.4.15/src/bin/pg_config
  ./packages-split/postgresql/usr/bin/pg_config
  ./image/usr/bin/pg_config
  </code></pre>