How to use android ndk to compile glib 2.66 with meson? - android-ndk

Enviroment:
Compiler: android-ndk-r21b, api 24
Ubuntu 20.04
Glib 2.66
I have built iconv, and have built glib 2.56 with make successfully, now i try to build glib 2.66 with meson, i build i run this script:
OUTDIR=$HOME/work/ndk/builddir/out
CC=arm-linux-androideabi-gcc CFLAGS="-L$OUTDIR/lib -I$OUTDIR/include" LDFLAGS="-L$OUTDIR/lib" LIBS="-liconv" CXXFLAGS="-L$OUTDIR/lib" meson release/ \
--cross-file cross_file.txt \
--prefix=$OUTDIR \
but compile error:
Header <iconv.h> has symbol "iconv_open" : YES
meson.build:1930:4: ERROR: C shared or static library 'iconv' not found
A full log can be found at /home/git/work/ndk/builddir/glib-2.66.4/reconfigure/meson-logs/meson-log.txt
cross_file.txt:
[host_machine]
system = 'android'
cpu_family = 'arm'
cpu = 'arm'
endian = 'little'
[constants]
android_ndk = '/home/git/work/ndk/toolchain/bin/'
toolchain = '/home/git/work/ndk/toolchain/bin/arm-linux-androideabi-'
outdir = '/home/git/work/ndk/builddir/out/'
[binaries]
c = android_ndk + 'arm-linux-androideabi-gcc'
cpp = android_ndk + 'arm-linux-androideabi-g++'
ar = android_ndk + 'arm-linux-androideabi-ar'
ld = android_ndk + 'arm-linux-androideabi-ld'
c_ld = android_ndk + 'arm-linux-androideabi-ld'
objcopy = android_ndk + 'arm-linux-androideabi-objcopy'
strip = android_ndk + 'arm-linux-androideabi-strip'
pkgconfig = '/usr/bin/pkg-config'
[built-in options]
c_std = 'c11'
libdir = '/home/git/work/ndk/builddir/out/lib'
prefix = '/home/git/work/ndk/builddir/out/'
c_args = ['-L/home/git/work/ndk/builddir/out/lib', '-I/home/git/work/ndk/builddir/out/include']
cpp_args = ['-L/home/git/work/ndk/builddir/out/lib', '-I/home/git/work/ndk/builddir/out/include']
c_link_args = ['-I/home/git/work/ndk/builddir/out/include', '-L/home/git/work/ndk/builddir/out/lib']
pkg_config_path = '/home/git/work/ndk/builddir/out/lib/pkgconfig'

I've got it. I shouldn't set the c_ld variable. And there is a bug in meson scripts of gio, so i must apt remove libelf-dev on ubuntu(or modify gio/meson.build).
Visit my github to get config file:
https://github.com/edaplayer/android-ndk-harfbuzz/blob/main/glib-2.66.4/build_glib_meson.sh
https://github.com/edaplayer/android-ndk-harfbuzz/blob/main/glib-2.66.4/cross_file.txt

Related

Internal Error: no cycle found in Scons Build

When I build my Sconstruct file, I am getting the below error.
scons: *** Found dependency cycle(s):
build/sselser/sselConfigArgs.h -> build/sselser/sselConfigArgs.h
Internal Error: no cycle found for node build/sselser/sselMain (<SCons.Node.FS.File instance at 0x9f61e8>) in state pending
Internal Error: no cycle found for node build/sselser/sselMain.o (<SCons.Node.FS.File instance at 0x9f2e68>) in state pending
File "/nfs/scons/scons-1.3.0/lib/scons-1.3.0/SCons/Taskmaster.py", line 1026, in cleanup
I guess this is due to dependency of sselMain in sselTransorm as the error occurs during the build of sselTransform directory.
Makefile in sselTransform:
UNIT_SUPPORT_FILES += ../sselser/sselMain intest ../../../make/Makenv
MDE_SUPPORT_FILES += ../sselser/sselMain intest ../../../make/Makenv
I need to add the same in Sconscript of sselTransform directory to resolve this issue.
How to resolve this issue?
Sconscript:
#Set CPPPATH, RPATH, DEFINES and CCFLAGS
env = Environment(CPPPATH =['.','../sselTransform','../sselSm','../sselSRC'],
RPATH = ['/l-n/app/colr/lib/infra/SunOS5.10/WS12.0'],CPPDEFINES = ['THREADSAFE','_RWSTD_SOLARIS_THREADS','_SVID_GETTO
D','DEBUG','sun5'],CCFLAGS = ['library=rwtools7_std','features=no%tmplife','-pta','-mt','-xdebugformat=stabs','-g0','-xildoff'])
env['CXX']=CXX
Src = Split('sselManager.C PromoNotifyMgr.C ')
env.StaticLibrary('libSselser-g0.a',Src)
Src1 = Split('sselMain.C sselManager.o PromoNotifyMgr.o ')
env.Program('sselMain',Src1)
configfile = 'sselConfigArgs.h'
CONFIG_PATH = '../../build/include/'
CONFIG=CONFIG_PATH+configfile
env.Command(CONFIG,configfile,
[Copy('$TARGET', '$SOURCE'),
Chmod('$TARGET', 0444)])
Sconstruct:
SConscript('src/ssel/sselser/SConscript',variant_dir='build/sselser',duplicate=0,exports='env')
Try this?
Notes:
I'm saving the build objects for your two source files and using those in both the program and static library.
I've added the target dir you're copying the header file to earlier in the CPPPATH.
You could have skipped the variables configfile, CONFIG_PATH, CONFIG and just used the strings in your Command.
You are using a VERY old version of SCons. If you're limited to python 2.7 please try using SCons 3.0.1? If you're not and can use Python 3.6, then try using SCons 4.3.0.
#Set CPPPATH, RPATH, DEFINES and CCFLAGS
env = Environment(
CPPPATH =['.','../include','../sselTransform','../sselSm','../sselSRC'],
RPATH = ['/l-n/app/colr/lib/infra/SunOS5.10/WS12.0'],
CPPDEFINES = ['THREADSAFE','_RWSTD_SOLARIS_THREADS','_SVID_GETTOD','DEBUG','sun5'],
CCFLAGS = ['library=rwtools7_std','features=no%tmplife','-pta','-mt','-xdebugformat=stabs','-g0','-xildoff'])
env['CXX']=CXX
Src = ['sselManager.C','PromoNotifyMgr.C']
objects = []
for s in Src:
objects.extend(env.StaticObject(s))
env.StaticLibrary('Sselser-g0',objects)
Src1 = ['sselMain.C'] + objects
env.Program('sselMain', Src1)
configfile = 'sselConfigArgs.h'
CONFIG_PATH = '../include/'
CONFIG=CONFIG_PATH+configfile
env.Command(CONFIG, configfile,
[Copy('$TARGET', '$SOURCE'),
Chmod('$TARGET', 0444)])

Scons compiler path contains spaces

I have a toolchain, not on the path, installed at a location containing spaces (C:\Program Files\Some Compiler\). I've tried:
env = Environment(
MY_TOOLCHAIN_ROOT = R'C:\Program Files\Some Compiler\',
MY_TOOLCHAIN_BIN = R'$MY_TOOLCHAIN_ROOT\bin',
)
env.Replace(
CC = "$MY_TOOLCHAIN_BIN/gcc",
CXX = "$MY_TOOLCHAIN_BIN/g++",
OBJCOPY = "$MY_TOOLCHAIN_BIN/objcopy"
)
env.Program('main.cpp')
But I get the error
'C:\Program' is not recognized as an internal or external command, operable program or batch file.
How can I get scons to quote the spaces?
Seems I need to mark them as Files:
env.Replace(
CC = env.File("$MY_TOOLCHAIN_BIN/gcc"),
CXX = env.File("$MY_TOOLCHAIN_BIN/g++"),
OBJCOPY = env.File("$MY_TOOLCHAIN_BIN/objcopy")
)
I think the problem is with the os style variables you are using with the $. Instead of specifying them with the env.File() (Im surprised it handled the variables), you could consider some simple python code as follows:
import os
env = Environment(
MY_TOOLCHAIN_ROOT = R'C:\Program Files\Some Compiler\',
MY_TOOLCHAIN_BIN = R'$MY_TOOLCHAIN_ROOT\bin',
)
env.Replace(
CC = os.path.join(os.environ["MY_TOOLCHAIN_BIN"], "gcc"),
CXX = os.path.join(os.environ["MY_TOOLCHAIN_BIN"], "g++"),
OBJCOPY = os.path.join(os.environ["MY_TOOLCHAIN_BIN"], "objcopy")
)

How to change build directory in scons by using renesas compiler

I am using scons script to compile my code by using VC10 and renesas compiler.
i am successfully building my source code in variant directory by using VC10, But if i used the same script for the renesas compiler it is not building the obj files in variant directory.
can anyone tell me how to do that.
I am using renesas rx600 family controller.
My example tree look like
src1
-main.c
sconscript
sconstruct
subdirA
fileA.c
sconscript
subdirB
fileB.c
sconscript
src1/sconstruct contains
import os
env = Environment()
tmp_obj_list = []
env = Environment(ENV = {'PATH' : os.environ['PATH']})
env['LINKFLAGS'] = "/nologo /subsystem:console /pdb:project.pdb"
env['CCFLAGS'] = "/nologo /wd4355 /GR- /EHs-c- /MT /c /W3 /WX /Zi /FD"
env['ENV']['TMP'] = os.environ['TMP']
env['ENV']['TEMP'] = os.environ['TEMP']
Export('env')
env.SConscript('d://src1//subdirA//SConscript',
variant_dir = 'd://build1//subdirA',
duplicate = 0, exports = 'env')
tmp_obj_list.append(Glob('d://build1//subdirA' + '/*.lib'))
env.SConscript('d://src1//subdirB//SConscript',
variant_dir = 'd://build1//subdirB',
duplicate = 0, exports = 'env')
tmp_obj_list.append(Glob('d://build1//subdirB' + '/*.lib'))
env.SConscript('d://src1//SConscript')
env.Append(LIBS = tmp_obj_list)
src1/sconscript contains
Import('env')
env.Program('program',Glob('*.c'))
env.Clean('program','d://build1')
src1/subdirA & src1/subdirB sconscript contains
Import('env')
l = env.Library(target='subdirB', source='fileB.c')
Return('l')

Using scons with Keil compiler/linker

I'm trying to use the Keil C51 compiler with scons as a build system.
The final problem I have is how to get $SOURCES to be output comma-separated to the linker. The default uses space as separator.
The relevant parts of the SConstruct is
path = ['C:\Keil\C51\BIN']
env = Environment(ENV = {'PATH' : path})
#Compiler settings
env['CC'] = 'c51.exe'
env['CCCOM'] = '$CC $SOURCES $_CPPINCFLAGS $CFLAGS $_CCCOMCOM ' #-o $TARGET
env['INCPREFIX'] = 'INCDIR('
env['INCSUFFIX'] = ')'
# Linker settings
env.Replace(LINK='BL51.exe')
env['LINKCOM'] = '$LINK $SOURCES TO $TARGET $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'
With this I get:
BL51.exe driver.obj flash.obj initialization.obj power.obj TO Outfile.omf
What I want is:
BL51.exe driver.obj,flash.obj,initialization.obj,power.obj TO Outfile.omf
$SOURCES is a construction variable and I cant find how to change how it is printed to the command-line.
Anyone?
I solved this by using:
env['LINKCOM'] = '$LINK ",".join( $SOURCES ) TO $TARGET $LINKFLAGS $__RPATH $_LIBDIRFLAGS $_LIBFLAGS'

How to use buildout to build Qt, PyQt, and SIP?

EDIT:
The following buildout.cfg worked to build Qt, PyQt, and SIP
[buildout]
parts =
pyqt
[pyqt]
recipe = zc.recipe.cmmi
url = http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-x11-gpl-4.8.4.tar.gz
#shared = True
source-directory-contains = configure.py
configure-command = ${buildout:executable} ./configure.py
configure-options = --confirm-license
-q ${qt:location}/bin/qmake
-b ${buildout:parts-directory}/pyqt/bin
-p ${buildout:parts-directory}/pyqt/plugins
-d ${buildout:parts-directory}/pyqt/lib/
-v ${sip:location}/share
--verbose
environment =
PYTHONPATH=${sip:location}/lib
[sip]
recipe = zc.recipe.cmmi
url = http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.12.3.tar.gz
# shared = True
source-directory-contains = configure.py
configure-command = ${buildout:executable} ./configure.py
configure-options =
-b ${buildout:parts-directory}/sip/bin
-e ${buildout:parts-directory}/sip/include
-d ${buildout:parts-directory}/sip/lib
-v ${buildout:parts-directory}/sip/share
[qt]
recipe = zc.recipe.cmmi
url = http://get.qt.nokia.com/qt/source/qt-everywhere-opensource-src-4.7.3.tar.gz
shared = True
I suspect you need to tell the PyQT configure where to find the sip libraries and include headers:
[pyqt]
recipe = zc.recipe.cmmi
url = http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-x11-gpl-4.8.4.tar.gz
# shared = True
source-directory-contains = configure.py
configure-command = ${buildout:executable} ./configure.py
configure-options = --confirm-license
-b ${buildout:parts-directory}/pyqt/bin
-p ${buildout:parts-directory}/pyqt/plugins
-d ${buildout:parts-directory}/pyqt/lib/
-q ${qt:location}/bin/qmake
-v ${sip:location}/share
--verbose
environment =
PYTHONPATH=${sip:location}/lib
Updated: Update my answer to include the PYTHONPATH environment var so configure.py will load the correct sipconfig module.

Resources