I was following https://computationalmechanics.in/lammps-installation-for-parallel-run-in-linux/ steps to build lammps but was unable to install mpich properly and am unable to spot the mistake I am doing. Error generated at terminal mentioned below
(base) manoj#labpc:~/packages/openmpi/openmpi-4.0.7$ mpiexec --version
HYDRA build details:
Version: 3.3.2
Release Date: Tue Nov 12 21:23:16 CST 2019
CC: x86_64-conda_cos6-linux-gnu-cc -I/home/manoj/anaconda3/include -I/home/manoj/anaconda3/include -L/home/manoj/anaconda3/lib -Wl,-rpath,/home/manoj/anaconda3/lib
CXX: x86_64-conda_cos6-linux-gnu-c++ -I/home/manoj/anaconda3/include -I/home/manoj/anaconda3/include -L/home/manoj/anaconda3/lib -Wl,-rpath,/home/manoj/anaconda3/lib
F77: x86_64-conda_cos6-linux-gnu-gfortran -I/home/manoj/anaconda3/include -L/home/manoj/anaconda3/lib -Wl,-rpath,/home/manoj/anaconda3/lib
F90: x86_64-conda_cos6-linux-gnu-gfortran -I/home/manoj/anaconda3/include -L/home/manoj/anaconda3/lib -Wl,-rpath,/home/manoj/anaconda3/lib
Configure options: '--disable-option-checking' '--prefix=/home/manoj/anaconda3' '--disable-dependency-tracking' '--enable-cxx' '--enable-fortran' '--disable-wrapper-rpath' 'MPICHLIB_CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix' 'MPICHLIB_CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -I/home/manoj/anaconda3/include' 'MPICHLIB_CXXFLAGS=-fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix' 'MPICHLIB_FFLAGS=-fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix' 'MPICHLIB_FCFLAGS=-fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix' 'CC=x86_64-conda_cos6-linux-gnu-cc' 'CFLAGS=-I/home/manoj/anaconda3/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix -O2' 'LDFLAGS=-L/home/manoj/anaconda3/lib -Wl,-rpath,/home/manoj/anaconda3/lib' 'CPPFLAGS=-I/home/manoj/anaconda3/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -I/home/manoj/anaconda3/include -I/tmp/build/80754af9/mpich-mpi_1575396103289/work/src/mpl/include -I/tmp/build/80754af9/mpich-mpi_1575396103289/work/src/mpl/include -I/tmp/build/80754af9/mpich-mpi_1575396103289/work/src/openpa/src -I/tmp/build/80754af9/mpich-mpi_1575396103289/work/src/openpa/src -D_REENTRANT -I/tmp/build/80754af9/mpich-mpi_1575396103289/work/src/mpi/romio/include' 'CPP=/home/manoj/anaconda3/bin/x86_64-conda_cos6-linux-gnu-cpp' 'CXX=x86_64-conda_cos6-linux-gnu-c++' 'CXXFLAGS=-I/home/manoj/anaconda3/include -fvisibility-inlines-hidden -std=c++17 -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix -O2' 'FC=x86_64-conda_cos6-linux-gnu-gfortran' 'FCFLAGS=-I/home/manoj/anaconda3/include -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix -O2' 'FFLAGS=-I/home/manoj/anaconda3/include -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -I/home/manoj/anaconda3/include -fdebug-prefix-map=/tmp/build/80754af9/mpich-mpi_1575396103289/work=/usr/local/src/conda/mpich-3.3.2 -fdebug-prefix-map=/home/manoj/anaconda3=/usr/local/src/conda-prefix -O2' '--cache-file=/dev/null' '--srcdir=.' 'LIBS=' 'MPLLIBNAME=mpl'
Process Manager: pmi
Launchers available: ssh rsh fork slurm ll lsf sge manual persist
Topology libraries available: hwloc
Resource management kernels available: user slurm ll lsf sge pbs cobalt
Checkpointing libraries available:
Demux engines available: poll select
(base) manoj#labpc:~/packages/openmpi/openmpi-4.0.7$ mpiexec --version
[mpiexec#labpc] set_default_values (ui/mpich/utils.c:1570): no executable provided
[mpiexec#labpc] HYD_uii_mpx_get_parameters (ui/mpich/utils.c:1783): setting default values failed
[mpiexec#labpc] main (ui/mpich/mpiexec.c:148): error parsing parameters
Related
I am unable to build rgdal (see output in code chunk below) on my AWS server. I understand from the discussion here, and here that this has something to do with missing libraries for geos and gdal, but none of the solutions suggested appears to work. If I run sudo yum install libgdal1 libgdal1-dev libgeos libgeos-dev I get the following output:
Loaded plugins: priorities, update-motd, upgrade-helper amzn-main
| 2.1 kB 00:00:00 amzn-updates
| 2.5 kB 00:00:00 1045 packages excluded due to repository
priority protections No package libgdal1 available. No package
libgdal1-dev available. Package geos-3.4.2-1.4.amzn1.x86_64 already
installed and latest version No package libgeos-dev available. Nothing
to do
I have already enabled EPEL, but it does not solve the problem.
Unfortunately I'm not very experienced with Linux, and have no idea how to move forward...
R output after attempting to install rgdal:
> install.packages("rgdal", type="source")
Installing package into ‘/home/andrea/R/x86_64-redhat-linux-gnu-library’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/src/contrib/rgdal_1.3-2.tar.gz'
Content type 'application/x-gzip' length 1667049 bytes (1.6 MB)
==================================================
downloaded 1.6 MB
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: CC: gcc -m64 -std=gnu99
configure: CXX: g++ -m64
configure: rgdal: 1.3-2
checking for /usr/bin/svnversion... no
configure: svn revision: 755
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ -m64 accepts -g... yes
checking whether g++ -m64 supports C++11 features by default... no
checking whether g++ -m64 supports C++11 features with -std=gnu++11... yes
configure: C++11 support available
checking for gdal-config... /usr/local/bin/gdal-config
checking gdal-config usability... yes
configure: GDAL: 2.0.0
checking GDAL version >= 1.11.4... yes
checking gdal: linking with --libs only... yes
checking GDAL: /usr/local/share/gdal/pcs.csv readable... yes
checking proj_api.h presence and usability... yes
./configure: line 3395: test: =: unary operator expected
checking PROJ version >= 4.8.0... yes
checking projects.h presence and usability... yes
/tmp/ccV0TCuc.o: In function `main':
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test2.c:14: undefined reference to `pj_get_default_ctx'
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test2.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3511: ./proj_conf_test2: No such file or directory
checking PROJ.4: epsg found and readable... yes
/tmp/cczdLgSd.o: In function `main':
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test3.c:14: undefined reference to `pj_get_default_ctx'
/tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/proj_conf_test3.c:20: undefined reference to `pj_ctx_fclose'
collect2: error: ld returned 1 exit status
./configure: line 3570: ./proj_conf_test3: No such file or directory
checking PROJ.4: conus found and readable... yes
configure: Package CPP flags: -I/usr/local/include
configure: Package LIBS: -L/usr/local/lib -lgdal -lproj
configure: creating ./config.status
config.status: creating src/Makevars
** libs
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c OGR_write.cpp -o OGR_write.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c gdal-bindings.cpp -o gdal-bindings.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c init.c -o init.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c inverser.c -o inverser.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c local_stubs.c -o local_stubs.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_geom.cpp -o ogr_geom.o
gcc -m64 -std=gnu99 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_polygons.c -o ogr_polygons.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogr_proj.cpp -o ogr_proj.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogrdrivers.cpp -o ogrdrivers.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c ogrsource.cpp -o ogrsource.o
g++ -m64 -std=gnu++11 -I/usr/include/R -DNDEBUG -I/usr/local/include -I"/home/andrea/R/x86_64-redhat-linux-gnu-library/sp/include" -I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -c projectit.cpp -o projectit.o
g++ -m64 -std=gnu++11 -shared -L/usr/lib64/R/lib -L/usr/local/lib64 -o rgdal.so OGR_write.o gdal-bindings.o init.o inverser.o local_stubs.o ogr_geom.o ogr_polygons.o ogr_proj.o ogrdrivers.o ogrsource.o projectit.o -L/usr/local/lib -lgdal -lproj -L/usr/lib64/R/lib -lR
installing to /home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal/libs
** R
** data
** inst
** preparing package for lazy loading
** help
*** installing help indices
converting help for package ‘rgdal’
finding HTML links ... done
CRS-class html
GDALDataset-class html
GDALDriver-class html
GDALMajorObject-class html
GDALRasterBand-class html
GDALReadOnlyDataset-class html
GDALReadOnlyDataset-methods html
GDALTransientDataset-class html
GridsDatums html
RGB2PCT html
SGDF2PCT html
SpatialGDAL-class html
closeDataset-methods html
displayDataset html
llgrid html
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:11: missing file link ‘Spatial’
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:16: missing file link ‘gridat’
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/llgrid.Rd:17: missing file link ‘gridat’
make_EPSG html
nor2k html
projInfo html
project html
readGDAL html
Rd warning: /tmp/Rtmp52ge38/R.INSTALL4e4e42b08a4a/rgdal/man/readGDAL.Rd:136: missing file link ‘flipVertical’
readOGR html
showWKT html
spTransform-methods html
wrappers html
writeOGR html
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error: package or namespace load failed for ‘rgdal’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal/libs/rgdal.so':
libgdal.so.20: cannot open shared object file: No such file or directory
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/home/andrea/R/x86_64-redhat-linux-gnu-library/rgdal’
Warning in install.packages :
installation of package ‘rgdal’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpnAqQL2/downloaded_packages’
The issue is that, while GDAL is correctly built, rgdal cannot find its libraries. This is because the AWS ec2 AMI does not include /usr/local/lib in the default search path for libraries. The solution is provided in an answer to this question.
In brief:
edit /etc/ld.so.conf using sudo vi /etc/ld.so.conf to make it contain: include /etc/ld.so.conf.d/*.conf.
Edit / create a file /etc/ld.so.conf.d/libc.conf so that it contains: /usr/local/lib
Run sudo ldconfig to save changes
This makes the libraries searchable when building rgdal.
Upgrade gcc version to 5.x.x, and then run the followings (depending on the gcc version, you may have a different file of libstdc++.so.6.0.25):
cp /usr/local/lib64/libstdc++.so.6.0.25 /lib64
cd /lib64
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.25 libstdc++.so.6
So, I developed a python performance test to run some tests on an HSM. I am following directions to download PyKCS11, an important module I need on the remote machine. I have latest version of swig installed, and I'm trying to run a make build on the PyKCS11 folder I have downloaded in my directory on the machine. I'm getting an ungodly amount of errors when running the make build. An suggestions on what is happening with these errors?
make build
python setup.py build
running build
running build_py
running build_ext
building 'PyKCS11._LowLevel' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/ck_attribute_smart.cpp -o build/temp.linux-x86_64-2.6/src/ck_attribute_smart .o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/pkcs11lib.cpp -o build/temp.linux-x86_64-2.6/src/pkcs11lib.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/pykcs11string.cpp -o build/temp.linux-x86_64-2.6/src/pykcs11string.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/utility.cpp -o build/temp.linux-x86_64-2.6/src/utility.o
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fe xceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU _SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexce ptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SO URCE -fPIC -fwrapv -fPIC -Isrc -I/usr/local/include -I/usr/include/python2.6 -c src/pykcs11_wrap.cpp -o build/temp.linux-x86_64-2.6/src/pykcs11_wrap.o
src/pykcs11_wrap.cpp:173:21: error: Python.h: No such file or directory
src/pykcs11_wrap.cpp:3050:4: error: #error "This python version requires swig to be run with the '-classic' option"
src/pykcs11_wrap.cpp:803: error: ‘PyObject’ was not declared in this scope
src/pykcs11_wrap.cpp:803: error: ‘str’ was not declared in this scope
src/pykcs11_wrap.cpp:804: error: expected ‘,’ or ‘;’ before ‘{’ token
src/pykcs11_wrap.cpp:827: error: expected initializer before ‘*’ token
src/pykcs11_wrap.cpp:853: error: expected initializer before ‘*’ token
src/pykcs11_wrap.cpp:903: error: expected initializer before ‘*’ token
src/pykcs11_wrap.cpp:918: error: ‘inquiry’ does not name a type
src/pykcs11_wrap.cpp:919: error: ‘intargfunc’ does not name a type
src/pykcs11_wrap.cpp:920: error: ‘intintargfunc’ does not name a type
src/pykcs11_wrap.cpp:921: error: ‘intobjargproc’ does not name a type
src/pykcs11_wrap.cpp:922: error: ‘intintobjargproc’ does not name a type
src/pykcs11_wrap.cpp:923: error: ‘getreadbufferproc’ does not name a type
src/pykcs11_wrap.cpp:924: error: ‘getwritebufferproc’ does not name a type
src/pykcs11_wrap.cpp:925: error: ‘getsegcountproc’ does not name a type
src/pykcs11_wrap.cpp:926: error: ‘getcharbufferproc’ does not name a type
src/pykcs11_wrap.cpp:927: error: ‘PyObject’ was not declared in this scope
src/pykcs11_wrap.cpp:927: error: ‘x’ was not declared in this scope
src/pykcs11_wrap.cpp:927: error: expected primary-expression before ‘void’
src/pykcs11_wrap.cpp:927: error: initializer expression list treated as compound expression
src/pykcs11_wrap.cpp:928: error: expected ‘,’ or ‘;’ before ‘{’ token
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include /c++/4.4.7/stdexcept:38,
from src/pykcs11_wrap.cpp:3074:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/exception:3 5: error: expected declaration before end of line
error: command 'gcc' failed with exit status 1
make: *** [build-stamp] Error 1
Sorry for the insanely long stack trace. Wasn't sure how to condense it so it was showing the right error messages for a possbile solution. Anyway, here's what i get when I run my python script in the remote machine.
I believe the problem to be with finding the correct compiler, but I'm not entirely sure.
Furthermore I tried to import PyKCS11 when invoking the interpreter to see a more simplified version of the error.
>>> import PyKCS11
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "PyKCS11/__init__.py", line 20, in <module>
import PyKCS11.LowLevel
File "PyKCS11/LowLevel.py", line 39, in <module>
LowLevel = swig_import_helper()
File "PyKCS11/LowLevel.py", line 31, in swig_import_helper
import _LowLevel
ImportError: No module named _LowLevel
I was able to successfully build cython on Ubuntu 14.04 from source as explained in this SE question/answer Compiling cython From source with icc and I downloaded the source code from here - Cython source code download.
The command to compile cython is
CC=icc LINKCC=icc python3.4 setup.py build
I am enclosing the build log. It is STILL using gcc for linking. Here is a sample of build log.
It appears CC=icc LINKCC=icc does NOT seem to change the linker to icc. It is still using x86_64-linux-gnu-gcc. When I set the environmental variable LDFLAGS = -lirc the environmental variable is being passed to gcc and not to icc.
Also when I put print statements in BuildExecutable.py they are not getting called.
icc -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c /home/aswin/libPython/Cython-0.24/Cython/Plex/Scanners.c -o build/temp.linux-x86_64-3.4/home/aswin/libPython/Cython-0.24/Cython/Plex/Scanners.o
icc: command line warning #10006: ignoring unknown option '-fwrapv'
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/Cython
creating build/lib.linux-x86_64-3.4/Cython/Plex
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -lirc -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/home/aswin/libPython/Cython-0.24/Cython/Plex/Scanners.o -o build/lib.linux-x86_64-3.4/Cython/Plex/Scanners.cpython-34m.so
How do I fix it ?
You need to override the linker
by setting export LDSHARED="icc -shared". That generates the icc linker. Here is an example of the build log by typing
CC=icc python3.4 setup.py build_ext
Alternatively you can also do the same by typing
LDSHARED="icc -shared" CC=icc python3.4 setup.py build_ex
icc -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c /home/a/libPython/Cython-0.24/Cython/Plex/Scanners.c -o build/temp.linux-x86_64-3.4/home/a/libPython/Cython-0.24/Cython/Plex/Scanners.o
icc: command line warning #10006: ignoring unknown option '-fwrapv'
creating build/lib.linux-x86_64-3.4
creating build/lib.linux-x86_64-3.4/Cython
creating build/lib.linux-x86_64-3.4/Cython/Plex
icc -shared -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/home/a/libPython/Cython-0.24/Cython/Plex/Scanners.o -o build/lib.linux-x86_64-3.4/Cython/Plex/Scanners.cpython-34m.so
cythoning /home/a/libPython/Cython-0.24/Cython/Plex/Actions.py to /home/a/libPython/Cython-0.24/Cython/Plex/Actions.c
You could try to add -static-intel to link options so that all Intel specific functions will be static-linked.
I have a simple Android.mk file for building libpng that I took from AOSP and modified slightly to build a shared lib instead of a static one.
LOCAL_PATH:= $(call my-dir)
LOCAL_CFLAGS :=
LOCAL_COPY_HEADERS_TO := libs/include
LOCAL_COPY_HEADERS := \
png.h \
pngconf.h \
pngusr.h
LOCAL_SRC_FILES := \
png.c \
pngerror.c \
pnggccrd.c \
pngget.c \
pngmem.c \
pngpread.c \
pngread.c \
pngrio.c \
pngrtran.c \
pngrutil.c \
pngset.c \
pngtrans.c \
pngvcrd.c \
pngwio.c \
pngwrite.c \
pngwtran.c \
pngwutil.c
LOCAL_LDLIBS := -lz
LOCAL_MODULE := png
LOCAL_MODULE_FILENAME := libpng
include $(BUILD_SHARED_LIBRARY)
The LOCAL_COPY_HEADERS_TO and LOCAL_COPY_HEADERS options seem like they should copy the specified headers to the libs/include directory... but they don't do anything. The library itself seems to build correctly. I'm using verbose output for ndk-build and there are no errors. Here's the command I use (I just added escapes so the command would be easier to read):
ndk-build \
NDK_PROJECT_PATH=. \
APP_BUILD_SCRIPT=Android.mk \
TARGET_ARCH_ABI=armeabi-v7a \
TARGET_PLATFORM=android-9 \
V=1 NDK_LOG=1 -B
And here's the build output. Note that at the end install is only called on the lib binaries.
HOST_OS=linux
HOST_ARCH=x86_64
HOST_TAG=linux-x86_64
GNUMAKE=/home/preet/Dev/env/sys/android-ndk-r8e/prebuilt/linux-x86_64/bin/make (NDK prebuilt)
Android NDK: NDK installation path auto-detected: '/home/preet/Dev/env/sys/android-ndk-r8e'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: linux
Android NDK: Host operating system detected: linux
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to linux-x86
Android NDK: Host tools prebuilt directory: /home/preet/Dev/env/sys/android-ndk-r8e/prebuilt/linux-x86_64/bin
Android NDK: Host 'echo' tool: echo
Android NDK: Host 'echo -n' tool: printf %s
Android NDK: Host 'cmp' tool: cmp
Android NDK: Host 'awk' tool: /home/preet/Dev/env/sys/android-ndk-r8e/prebuilt/linux-x86_64/bin/awk
Android NDK: Host 'awk' test returned: Pass
Android NDK: Found platform root directory: /home/preet/Dev/env/sys/android-ndk-r8e/platforms
Android NDK: Found supported platforms: android-14 android-3 android-4 android-5 android-8 android-9
Android NDK: PLATFORM android-14 supports: arm mips x86
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-14/arch-arm
Android NDK: ABI mips sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-14/arch-mips
Android NDK: ABI x86 sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-14/arch-x86
Android NDK: PLATFORM android-3 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-3/arch-arm
Android NDK: PLATFORM android-4 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-4/arch-arm
Android NDK: PLATFORM android-5 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-5/arch-arm
Android NDK: PLATFORM android-8 supports: arm
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-8/arch-arm
Android NDK: PLATFORM android-9 supports: arm mips x86
Android NDK: ABI arm sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm
Android NDK: ABI mips sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-mips
Android NDK: ABI x86 sysroot is: /home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-x86
Android NDK: Found stable platform levels: 14 3 4 5 8 9
Android NDK: Found max platform level: 14
Android NDK: This NDK supports the following target architectures and ABIS:
Android NDK: arm: armeabi armeabi-v7a
Android NDK: mips: mips
Android NDK: x86: x86
Android NDK: This NDK supports the following toolchains and target ABIs:
Android NDK: arm-linux-androideabi-4.4.3: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-4.6: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-4.7: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-clang3.1: armeabi armeabi-v7a
Android NDK: arm-linux-androideabi-clang3.2: armeabi armeabi-v7a
Android NDK: mipsel-linux-android-4.4.3: mips
Android NDK: mipsel-linux-android-4.6: mips
Android NDK: mipsel-linux-android-4.7: mips
Android NDK: mipsel-linux-android-clang3.1: mips
Android NDK: mipsel-linux-android-clang3.2: mips
Android NDK: x86-4.4.3: x86
Android NDK: x86-4.6: x86
Android NDK: x86-4.7: x86
Android NDK: x86-clang3.1: x86
Android NDK: x86-clang3.2: x86
Android NDK: Found project path: .
Android NDK: Ouput path: ./obj
Android NDK: Parsing /home/preet/Dev/env/sys/android-ndk-r8e/build/core/default-application.mk
Android NDK: Defaulted to APP_PLATFORM=android-3
Android NDK: APP_PIE is
Android NDK: Using build script Android.mk
Android NDK: Application 'local' is not debuggable
Android NDK: Selecting release optimization mode (app is not debuggable)
Android NDK: Adding import directory: /home/preet/Dev/env/sys/android-ndk-r8e/sources
Android NDK: Building application 'local' for ABI 'armeabi-v7a'
Android NDK: Using target toolchain 'arm-linux-androideabi-4.6' for 'armeabi-v7a' ABI
Android NDK: Looking for imported module with tag 'cxx-stl/system'
Android NDK: Probing /home/preet/Dev/env/sys/android-ndk-r8e/sources/cxx-stl/system/Android.mk
Android NDK: Found in /home/preet/Dev/env/sys/android-ndk-r8e/sources/cxx-stl/system
rm -f ./libs/armeabi/lib*.so ./libs/armeabi-v7a/lib*.so ./libs/mips/lib*.so ./libs/x86/lib*.so
rm -f ./libs/armeabi/gdbserver ./libs/armeabi-v7a/gdbserver ./libs/mips/gdbserver ./libs/x86/gdbserver
rm -f ./libs/armeabi/gdb.setup ./libs/armeabi-v7a/gdb.setup ./libs/mips/gdb.setup ./libs/x86/gdb.setup
Compile thumb : png <= png.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/png.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./png.c -o ./obj/local/armeabi-v7a/objs/png/png.o
Compile thumb : png <= pngerror.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngerror.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngerror.c -o ./obj/local/armeabi-v7a/objs/png/pngerror.o
Compile thumb : png <= pnggccrd.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pnggccrd.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pnggccrd.c -o ./obj/local/armeabi-v7a/objs/png/pnggccrd.o
Compile thumb : png <= pngget.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngget.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngget.c -o ./obj/local/armeabi-v7a/objs/png/pngget.o
Compile thumb : png <= pngmem.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngmem.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngmem.c -o ./obj/local/armeabi-v7a/objs/png/pngmem.o
Compile thumb : png <= pngpread.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngpread.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngpread.c -o ./obj/local/armeabi-v7a/objs/png/pngpread.o
Compile thumb : png <= pngread.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngread.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngread.c -o ./obj/local/armeabi-v7a/objs/png/pngread.o
Compile thumb : png <= pngrio.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngrio.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngrio.c -o ./obj/local/armeabi-v7a/objs/png/pngrio.o
Compile thumb : png <= pngrtran.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngrtran.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngrtran.c -o ./obj/local/armeabi-v7a/objs/png/pngrtran.o
Compile thumb : png <= pngrutil.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngrutil.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngrutil.c -o ./obj/local/armeabi-v7a/objs/png/pngrutil.o
Compile thumb : png <= pngset.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngset.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngset.c -o ./obj/local/armeabi-v7a/objs/png/pngset.o
Compile thumb : png <= pngtrans.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngtrans.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngtrans.c -o ./obj/local/armeabi-v7a/objs/png/pngtrans.o
Compile thumb : png <= pngvcrd.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngvcrd.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngvcrd.c -o ./obj/local/armeabi-v7a/objs/png/pngvcrd.o
Compile thumb : png <= pngwio.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwio.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwio.c -o ./obj/local/armeabi-v7a/objs/png/pngwio.o
Compile thumb : png <= pngwrite.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwrite.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwrite.c -o ./obj/local/armeabi-v7a/objs/png/pngwrite.o
Compile thumb : png <= pngwtran.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwtran.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwtran.c -o ./obj/local/armeabi-v7a/objs/png/pngwtran.o
Compile thumb : png <= pngwutil.c
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -MMD -MP -MF ./obj/local/armeabi-v7a/objs/png/pngwutil.o.d -fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -Os -g -DNDEBUG -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -I. -DANDROID -Wa,--noexecstack -I/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/include -c ./pngwutil.c -o ./obj/local/armeabi-v7a/objs/png/pngwutil.o
SharedLibrary : libpng.so
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -Wl,-soname,libpng.so -shared --sysroot=/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm ./obj/local/armeabi-v7a/objs/png/png.o ./obj/local/armeabi-v7a/objs/png/pngerror.o ./obj/local/armeabi-v7a/objs/png/pnggccrd.o ./obj/local/armeabi-v7a/objs/png/pngget.o ./obj/local/armeabi-v7a/objs/png/pngmem.o ./obj/local/armeabi-v7a/objs/png/pngpread.o ./obj/local/armeabi-v7a/objs/png/pngread.o ./obj/local/armeabi-v7a/objs/png/pngrio.o ./obj/local/armeabi-v7a/objs/png/pngrtran.o ./obj/local/armeabi-v7a/objs/png/pngrutil.o ./obj/local/armeabi-v7a/objs/png/pngset.o ./obj/local/armeabi-v7a/objs/png/pngtrans.o ./obj/local/armeabi-v7a/objs/png/pngvcrd.o ./obj/local/armeabi-v7a/objs/png/pngwio.o ./obj/local/armeabi-v7a/objs/png/pngwrite.o ./obj/local/armeabi-v7a/objs/png/pngwtran.o ./obj/local/armeabi-v7a/objs/png/pngwutil.o -lgcc -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -L/home/preet/Dev/env/sys/android-ndk-r8e/platforms/android-9/arch-arm/usr/lib -lz -lc -lm -o ./obj/local/armeabi-v7a/libpng.so
Install : libpng.so => libs/armeabi-v7a/libpng.so
install -p ./obj/local/armeabi-v7a/libpng.so ./libs/armeabi-v7a/libpng.so
/home/preet/Dev/env/sys/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/bin/arm-linux-androideabi-strip --strip-unneeded ./libs/armeabi-v7a/libpng.so
You messed up your order. You should have:
LOCAL_COPY_HEADERS := \
png.h \
pngconf.h \
pngusr.h
followed by:
LOCAL_COPY_HEADERS_TO := libs/include
(You must dictate your headers, then tell the system where to copy them to.) It could also have been deprecated on your current sdk too.
i am trying to use free type in android native and i am trying to follow this tutorial: http://en.wikibooks.org/wiki/OpenGL_Programming/Installation/Android#FreeType which seems to be the standard tutorial that everyone links to.
my problem now is that i have never cross compiled anything before and when i try to prepare the cross-compiler with: make-standalone-toolchain.sh ... in cygwin (im on windows 7) i get:
-bash: make-standalone-toolchain.sh: command not found
even though it definitely is there. what am i missing? or is that not to be done in cygwin at all but somewhere else? this standard tutorial is not detailed enough for me, can anyone give me a more detailed explanation on where i have to give those commands?
I have managed to compile and use freetype 2.7.1 library in ndk with CMake:
cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
# freetype 2.7.1
add_definitions(-DFT2_BUILD_LIBRARY)
set(FTDIR "src/main/cpp/freetype")
include_directories(${FTDIR}/include)
set(FTSRC
${FTDIR}/src/autofit/autofit.c
${FTDIR}/src/base/ftbase.c
${FTDIR}/src/base/ftbbox.c
${FTDIR}/src/base/ftbdf.c
${FTDIR}/src/base/ftbitmap.c
${FTDIR}/src/base/ftcid.c
${FTDIR}/src/base/ftfntfmt.c
${FTDIR}/src/base/ftfstype.c
${FTDIR}/src/base/ftgasp.c
${FTDIR}/src/base/ftglyph.c
${FTDIR}/src/base/ftgxval.c
${FTDIR}/src/base/ftinit.c
${FTDIR}/src/base/ftlcdfil.c
${FTDIR}/src/base/ftmm.c
${FTDIR}/src/base/ftotval.c
${FTDIR}/src/base/ftpatent.c
${FTDIR}/src/base/ftpfr.c
${FTDIR}/src/base/ftstroke.c
${FTDIR}/src/base/ftsynth.c
${FTDIR}/src/base/ftsystem.c
${FTDIR}/src/base/fttype1.c
${FTDIR}/src/base/ftwinfnt.c
${FTDIR}/src/bdf/bdf.c
${FTDIR}/src/bzip2/ftbzip2.c
${FTDIR}/src/cache/ftcache.c
${FTDIR}/src/cff/cff.c
${FTDIR}/src/cid/type1cid.c
${FTDIR}/src/gzip/ftgzip.c
${FTDIR}/src/lzw/ftlzw.c
${FTDIR}/src/pcf/pcf.c
${FTDIR}/src/pfr/pfr.c
${FTDIR}/src/psaux/psaux.c
${FTDIR}/src/pshinter/pshinter.c
${FTDIR}/src/psnames/psnames.c
${FTDIR}/src/raster/raster.c
${FTDIR}/src/sfnt/sfnt.c
${FTDIR}/src/smooth/smooth.c
${FTDIR}/src/truetype/truetype.c
${FTDIR}/src/type1/type1.c
${FTDIR}/src/type42/type42.c
${FTDIR}/src/winfonts/winfnt.c
${FTDIR}/src/base/ftdebug.c
${FTDIR}/include/ft2build.h
${FTDIR}/include/freetype/config/ftconfig.h
${FTDIR}/include/freetype/config/ftheader.h
${FTDIR}/include/freetype/config/ftmodule.h
${FTDIR}/include/freetype/config/ftoption.h
${FTDIR}/include/freetype/config/ftstdlib.h
)
add_library( freetype SHARED ${FTSRC} )
and then you link it to your ndk library : e.g.
add_library(native-lib SHARED src/main/cpp/native-lib.cpp)
target_link_libraries(native-lib freetype)
you can't just run .sh script in windows environment... You have to use sh.exe utility to strat your script... somethiong like:
path_to_cygwin\bin\sh make-standalone-toolchain.sh [options]
on macos platform:
build64
#!/bin/bash
export NDK= /Users/xxxxx/Library/Android/sdk/ndk/21.3.6528147 # set your path
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
SYSROOT=$TOOLCHAIN/sysroot
export API=21
export TARGET=aarch64-linux-android
CPU=arm64-v8a
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
# old
#export CFLAGS="-g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O3 -DNDEBUG -fPIC --target=aarch64-none-linux-android21 --gcc-toolchain=$TOOLCHAIN "
# with -g
export CFLAGS="-g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O3 -DNDEBUG -fPIC --target=$TARGET$API --gcc-toolchain=$TOOLCHAIN "
# without -g
#export CFLAGS="-DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O3 -DNDEBUG -fPIC --target=$TARGET$API --gcc-toolchain=$TOOLCHAIN "
export AR=$TOOLCHAIN/bin/llvm-ar
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
PREFIX=$(pwd)/android/$CPU
function build
{
./configure \
--host=$TARGET \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--without-brotli \
--with-zlib=no \
--with-bzip2=no \
--with-png=no \
--with-harfbuzz=no \
--with-sysroot=$SYSROOT \
make -j12 VERBOSE=1
make install
}
build
build32
#!/bin/bash
export NDK=/Users/xxxxx/Library/Android/sdk/ndk/21.3.6528147 # set your path
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/darwin-x86_64
SYSROOT=$TOOLCHAIN/sysroot
export API=21
export TARGET=armv7a-linux-androideabi
CPU=armeabi-v7a
export CC=$TOOLCHAIN/bin/$TARGET$API-clang
# old
#export CFLAGS="-g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O3 -DNDEBUG -fPIC --target=aarch64-none-linux-android21 --gcc-toolchain=$TOOLCHAIN "
# with -g
export CFLAGS="-g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O3 -DNDEBUG -fPIC --target=$TARGET$API --gcc-toolchain=$TOOLCHAIN "
# without -g
#export CFLAGS="-DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -O3 -DNDEBUG -fPIC --target=$TARGET$API --gcc-toolchain=$TOOLCHAIN "
export AR=$TOOLCHAIN/bin/llvm-ar
export RANLIB=$TOOLCHAIN/bin/llvm-ranlib
PREFIX=$(pwd)/android/$CPU
function build
{
./configure \
--host=$TARGET \
--prefix=$PREFIX \
--disable-shared \
--enable-static \
--without-brotli \
--with-zlib=no \
--with-bzip2=no \
--with-png=no \
--with-harfbuzz=no \
--with-sysroot=$SYSROOT \
make -j12 VERBOSE=1
make install
}
build