discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Cross-Compile issue with GNU Radio 3.8: cmake is


From: Toby Flynn
Subject: Re: [Discuss-gnuradio] Cross-Compile issue with GNU Radio 3.8: cmake is building an incorrect file
Date: Wed, 22 May 2019 11:22:26 -0400

Marcus and Andrej,
Based on the information from:
https://stackoverflow.com/questions/1242904/finding-python-site-packages-directory-with-cmake

I modified GrPython.cmake by adding a new variable, PYTHON_SITE:
########################################################################
# Sets the python realtive installation directory PYTHON_SITE
########################################################################
if(NOT DEFINED PYTHON_SITE)
execute_process(
  COMMAND "${PYTHON_EXECUTABLE}" -c "if True:
    from distutils import sysconfig as sc
    print(sc.get_python_lib(prefix='', plat_specific=True))"
  OUTPUT_VARIABLE PYTHON_SITE
  OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

and then changed the target install in 
swig/CmakeLists.txt to use PYTHON_SITE,

With these changes I can confirm GNU Radio builds and OOTs will build against this using both Yocto and local computer building.  I would like more testing on this solution and I am not sure it is the correct solution, but it is a working solution.

Toby




On Tue, May 21, 2019 at 4:42 PM Müller, Marcus (CEL) <address@hidden> wrote:
A-Ha! So, that leads us the next bigger question: How can we make
GR_PYTHON_DIR a relative path? I'm taking Andrej into CC, because he
did a lot of the actual "modern CMake" conversion and is back home :)

Best regards,
Marcus
On Tue, 2019-05-21 at 14:34 -0400, Toby Flynn wrote:
> Marcus,
>   I think I have found the issue, just not a correct solution yet.
> Based on the bug report:
> https://cmake.org/Bug/print_bug_page.php?bug_id=14367
> Which is  marked as not a bug, but explains the issue I am seeing
> very well.
> gnuradio-runtime.swig/CMakeLists.txt uses an absolute path for the
> DESTINATION ( or something that gets turned into an absolute path) in
> the lines:
> install(
>   TARGETS runtime_swig
>   EXPORT runtime_swig-export
>   DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
>   )
>
> The DESTINATION should point to a relative path, based on the above
> bug report.
>
> For testing I changed the last line to:
> DESTINATION lib/python3.5/site-packages/gnuradio/gr
> And rebuild gnuradio for cross-compiling.
> I then build OOT modules gr-iio from my fork and gr-paint38, both
> successful built.  I have not tried executing the code yet.
>
> I am not sure of the correct way to create a variable which will
> point to the relative path only of GR_PYTHON_DIR within the CMake
> process, and I think that is what is needed to correctly fix the
> issue. This may show up because the installed path is /usr/lib/... on
> the sysroot and not an actual PREFIX.
>
> Thanks
> Toby
>
> On Mon, May 20, 2019 at 1:44 PM Toby Flynn <
> address@hidden> wrote:
> > Marcus,
> >    The last file differences I sent are in a file created from
> > CMakeLists.txt, lines 74-78.  Swig builds with no issues, it is
> > when I link an OOT that the file _runtime_swig.so cannot be found
> > because the runtime_swigTargets-release.cmake file has the wrong
> > directory location, somehow it lost the variable which allows for a
> > PREFIX, ${_IMPORT_PREFIX}.  Looking at the difference it may be
> > that _IMPORT_PREFIX is not getting set correctly somewhere.  I am
> > still working on this issue.
> >
> > Toby
> >
> > On Mon, May 20, 2019 at 11:55 AM Müller, Marcus (CEL) <
> > address@hidden> wrote:
> > > Hi Toby,
> > >
> > > I don't really doubt it's a CMake issue; to be precise, I think
> > > it's an
> > > issue in the triangle between CMake, CMake instructing SWIG and
> > > detecting the right Python libs along the way.
> > >
> > > Anyway, I'll take a minute to literally parse your email :)
> > >
> > > Thanks!
> > > Marcus
> > >
> > > On Mon, 2019-05-20 at 09:09 -0400, Toby Flynn wrote:
> > > > Marcus,
> > > >    I think what you want to see if the configuration for CMake,
> > > the actual build line is fairly normal.  This is the contents of
> > > the file which configures CMake.  I believe this is a CMake
> > > issue, not a Python issue.   It is only the creation of one
> > > .cmake file which leads to OOT building errors.
> > > > Thanks
> > > > Toby
> > > >
> > > > # CMake system name must be something like "Linux".
> > > > # This is important for cross-compiling.
> > > >
> > > > set( CMAKE_SYSTEM_NAME Linux )
> > > > set( CMAKE_SYSTEM_PROCESSOR aarch64 )
> > > > set( CMAKE_C_COMPILER aarch64-poky-linux-gcc )
> > > > set( CMAKE_CXX_COMPILER aarch64-poky-linux-g++ )
> > > > set( CMAKE_ASM_COMPILER aarch64-poky-linux-gcc )
> > > > set( CMAKE_AR aarch64-poky-linux-ar CACHE FILEPATH "Archiver" )
> > > > set( CMAKE_C_FLAGS "  --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0=/usr/src/debug/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot= -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot-native=    --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot" CACHE STRING "CFLAGS" )
> > > > set( CMAKE_CXX_FLAGS "  --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0=/usr/src/debug/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot= -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot-native=  -fvisibility-inlines-hidden   
> > > --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot" CACHE STRING "CXXFLAGS" )
> > > > set( CMAKE_ASM_FLAGS "  --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0=/usr/src/debug/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot= -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot-native=    --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot" CACHE STRING "ASM FLAGS" )
> > > > set( CMAKE_C_FLAGS_RELEASE "-DNDEBUG" CACHE STRING "Additional
> > > CFLAGS for release" )
> > > > set( CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG" CACHE STRING
> > > "Additional CXXFLAGS for release" )
> > > > set( CMAKE_ASM_FLAGS_RELEASE "-DNDEBUG" CACHE STRING
> > > "Additional ASM FLAGS for release" )
> > > > set( CMAKE_C_LINK_FLAGS "  --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot  -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
> > > CACHE STRING "LDFLAGS" )
> > > > set( CMAKE_CXX_LINK_FLAGS "  --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot  -O2 -pipe -g -feliminate-unused-debug-types
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0=/usr/src/debug/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0
> > > -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot= -fdebug-prefix-
> > > map=/home/builduser/Development/38test/ultra/oe/build/tmp/work/aa
> > > rch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot-native=  -fvisibility-inlines-hidden   
> > > --
> > > sysroot=/home/builduser/Development/38test/ultra/oe/build/tmp/wor
> > > k/aarch64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-
> > > r0/recipe-sysroot -Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed"
> > > CACHE STRING "LDFLAGS" )
> > > >
> > > > # only search in the paths provided so cmake doesnt pick
> > > > # up libraries and tools from the native build machine
> > > > set( CMAKE_FIND_ROOT_PATH
> > > /home/builduser/Development/38test/ultra/oe/build/tmp/work/aarch6
> > > 4-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot
> > > /home/builduser/Development/38test/ultra/oe/build/tmp/work/aarch6
> > > 4-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot-native    )
> > > > set( CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY )
> > > > set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
> > > > set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
> > > > set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
> > > >
> > > > # Use qt.conf settings
> > > > set( ENV{QT_CONF_PATH}
> > > /home/builduser/Development/38test/ultra/oe/build/tmp/work/aarch6
> > > 4-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/qt.conf )
> > > >
> > > > # We need to set the rpath to the correct directory as cmake
> > > does not provide any
> > > > # directory as rpath by default
> > > > set( CMAKE_INSTALL_RPATH  )
> > > >
> > > > # Use native cmake modules
> > > > list(APPEND CMAKE_MODULE_PATH
> > > "/home/builduser/Development/38test/ultra/oe/build/tmp/work/aarch
> > > 64-poky-linux/gnuradio/3.8.0+gitAUTOINC+72aa97daab-r0/recipe-
> > > sysroot/usr/share/cmake/Modules/")
> > > >
> > > > # add for non /usr/lib libdir, e.g. /usr/lib64
> > > > set( CMAKE_LIBRARY_PATH /usr/lib /lib)
> > > >
> > > >
> > > > On Fri, May 17, 2019 at 4:46 PM Müller, Marcus (CEL) <
> > > address@hidden> wrote:
> > > > > Hi Toby,
> > > > >
> > > > > what's the verbatim cmake command line Yocto is executing?
> > > > >
> > > > > Since it's impossible for the build system to know by itself
> > > what the
> > > > > target python will be, unless you tell it which, we'll have
> > > to figure
> > > > > out a way to consistently set Python used during CMake,
> > > Python used
> > > > > during build, and Python used on target.
> > > > > It's a complicated thing, actually – the python that the
> > > build system
> > > > > internally (a lot!) doesn't have to be the one the used to
> > > link SWIG
> > > > > files against.
> > > > > So, I see no way but to set the PYTHON_LIBRARIES and
> > > > > PYTHON_INCLUDE_DIRS explitly in the cmake command line. (If
> > > anyone
> > > > > could point me towards an easier solution that doesn't trade
> > > project
> > > > > sanity for having one argument fewer in a OE layer, I'd be
> > > very happy.)
> > > > >
> > > > > Now, I don't know if all this is related to your problem. But
> > > then
> > > > > again, I don't know anything about the OOT module you're
> > > trying to
> > > > > build. So far, we don't have overly many 3.8-compatible OOTs,
> > > so if you
> > > > > can point us to the one you're working with, that would be
> > > highly
> > > > > appreciated. One of the main reasons of breakage is that the
> > > old CMake
> > > > > constructs we used to employ in GNU Radio have been replaced
> > > by more
> > > > > modern CMake patterns, which especially means that the notion
> > > of
> > > > > component dependencies and hence install targets has changed.
> > > > >
> > > > > Best regards,
> > > > > Marcus
> > > > >
> > > > > On Fri, 2019-05-17 at 13:21 -0400, Toby Flynn wrote:
> > > > > > I am attempting to install OOT modules using a
> > > Yocto/Openembedded
> > > > > > enviroment and the latest GNURadio 3.8.  This process was
> > > working
> > > > > > before the latest cmake changes to 3.8 were incorporated.
> > > I am now
> > > > > > having issues with the cross-complitaion.  I have tracked
> > > the issue
> > > > > > down to a file I believe is created by cmake:
> > > > > > build/gnuradio-
> > > > > >
> > > runtime/swig/CMakeFiles/Export/lib/cmake/gnuradio/runtime_swigTar
> > > gets
> > > > > > -release.cmake
> > > > > >
> > > > > > When building directly on a computer this file has
> > > difference, line
> > > > > > 10 than the one build using Yocto.
> > > > > > Direct build on a computer the line is:
> > > > > > IMPORTED_LOCATION_RELEASE
> > > "${_IMPORT_PREFIX}/lib/python3.6/dist-
> > > > > > packages/gnuradio/gr/_runtime_swig.so"
> > > > > >
> > > > > > On the Yocto build the line is:
> > > > > >
> > > > > > IMPORTED_LOCATION_RELEASE "/usr/lib/python3.5/site-
> > > > > > packages/gnuradio/gr/_runtime_swig.so"
> > > > > >
> > > > > > The missing ${_IMPORT_PREFIX} leads to cmake issues since
> > > > > > _runtime_swig.so cannot be found.
> > > > > >
> > > > > > Does anyone have a suggestion for something I can try to
> > > fix the
> > > > > > issue.
> > > > > >
> > > > > > Thanks
> > > > > > Toby
> > > > > >
> > > > > >
> > > > > > _______________________________________________
> > > > > > Discuss-gnuradio mailing list
> > > > > > address@hidden
> > > > > > https://lists.gnu.org/mailman/listinfo/discuss-gnuradio

reply via email to

[Prev in Thread] Current Thread [Next in Thread]