How to cross compile pyinstaller bootloader to arm 32bit - python-2.7

How to cross compile pyinstaller-3.5 boot loader for arm soft float 32bit.
I tried to cross compile it:
getting error dl not found.
python2.7 ./waf CC=arm-linux-gnueabi-gcc all
'all' finished successfully (0.000s)
'distclean' finished successfully (0.000s)
Setting top to : /home/arjuncr/Downloads/PyInstaller-3.5/bootloader
Setting out to : /home/arjuncr/Downloads/PyInstaller-3.5/bootloader/build
Python Version : 2.7.17 (default, Nov 7 2019, 10:07:09) [GCC 7.4.0]
Checking for 'gcc' (C compiler) : arm-linux-gnueabi-gcc
Checking size of pointer : 4
Platform : Linux-32bit detected based on compiler
Checking for flags -m32 : yes
Checking for program 'arm-linux-gnueabi-strip' : /usr/bin/arm-linux-gnueabi-strip
Checking for program 'strip' : /usr/bin/arm-linux-gnueabi-strip
Checking for library dl : not found
The configuration failed
(complete log in /home/arjuncr/Downloads/PyInstaller-3.5/bootloader/build/config.log)
log:
[1/2] Compiling build/.conf_check_c80cac29ed913c100609f182ebb9efef/test.c
['arm-linux-gnueabi-gcc', '-m32', '-O2', '-Wdeclaration-after-statement', '-Wimplicit-function-declaration', '-Werror', '-U_FORTIFY_SOURCE', '-D_REENTRANT', '-D_BSD_SOURCE', '-D_DEFAULT_SOURCE', '-D_FORTIFY_SOURCE=2', '../test.c', '-c', '-o/home/arjuncr/Downloads/PyInstaller-3.5/bootloader/build/.conf_check_c80cac29ed913c100609f182ebb9efef/testbuild/test.c.1.o']
err: arm-linux-gnueabi-gcc: error: unrecognized command line option ‘-m32’
from /home/arjuncr/Downloads/PyInstaller-3.5/bootloader: Test does not build: Traceback (most recent call last):
File "/home/arjuncr/Downloads/PyInstaller-3.5/bootloader/.waf-2.0.9-6b5f17f340ec613b295ffa3dedcecc80/waflib/Configure.py", line 324, in run_build
bld.compile()
File "/home/arjuncr/Downloads/PyInstaller-3.5/bootloader/.waf-2.0.9-6b5f17f340ec613b295ffa3dedcecc80/waflib/Build.py", line 176, in compile
raise Errors.BuildError(self.producer.error)
BuildError: Build failed
-> task in 'testprog' failed with exit status 1 (run with -v to display more information)
not found
from /home/arjuncr/Downloads/PyInstaller-3.5/bootloader: The configuration failed
Also I used crosss compiled version of python 2.7.17
./configure --enable-shared \
--with-system-expat \
--with-ensurepip=yes \
--enable-unicode=ucs4 \
--build=x86_64-pc-linux-gnu\
--host=i686-pc-linux-gnu \
--enable-ipv6 \
ac_cv_file__dev_ptmx=no \
ac_cv_file__dev_ptc=no &&
make
Used cross compiled version of zlib
CC=arm-linux-gnueabi-gcc ./configure && make
and copied the lib to /usr/lib/gcc-cross/arm-linux-gnueabi/7/../../../../arm-linux-gnueabi/lib/
Editing the wsscript
<pre>
--- wscript 2019-07-10 00:44:04.000000000 +0530
+++ ../../../PyInstaller-3.5/bootloader/wscript 2020-01-04 23:05:17.877519450 +0530
## -366,9 +366,9 ##
# on 32-bit arm Linux. So skip the -m32 flag.
pass
else:
- ctx.check_cc(ccflags='-m32', msg='Checking for flags -m32')
- ctx.env.append_value('CFLAGS', '-m32')
- ctx.env.append_value('LINKFLAGS', '-m32')
+ ctx.check_cc(ccflags='', msg='Checking for flags -m32')
+ ctx.env.append_value('CFLAGS', '')
+ ctx.env.append_value('LINKFLAGS', '')
# Set LARGE_ADDRESS_AWARE_FLAG to True.
# On Windows this allows 32bit apps to use 4GB of memory and
# not only 2GB.
</pre>

Related

Graphics Installation in Opam

I am trying to install graphics using opam install graphics, but I get the following error
message:
$ opam install graphics
The following actions will be performed:
∗ install graphics 5.1.1
↻ recompile ocamlfind 1.9.1 [uses graphics]
↻ recompile base-bytes base [uses ocamlfind]
↻ recompile ounit2 2.2.4 [uses base-bytes]
↻ recompile ANSITerminal 0.8.2 [uses base-bytes]
===== ∗ 1 ↻ 4 =====
Do you want to continue? [Y/n] y
<><> Gathering sources ><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
[ANSITerminal.0.8.2] found in cache
[graphics.5.1.1] found in cache
[ocamlfind.1.9.1] found in cache
[ounit2.2.2.4] found in cache
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
[ERROR] The compilation of graphics failed at "/Users/traviszhang/.opam/opam-init/hooks/sandbox.sh build dune
build -p graphics -j 3 #install".
#=== ERROR while compiling graphics.5.1.1 =====================================#
# context 2.0.8 | macos/x86_64 | ocaml-base-compiler.4.11.1 | https://opam.ocaml.org#7e6a6dcc
# path ~/.opam/cs3110-2021sp/.opam-switch/build/graphics.5.1.1
# command ~/.opam/opam-init/hooks/sandbox.sh build dune build -p graphics -j 3 #install
# exit-code 1
# env-file ~/.opam/log/graphics-9364-8b8a2d.env
# output-file ~/.opam/log/graphics-9364-8b8a2d.out
### output ###
# [...]
# In file included from src/unix/subwindow.c:16:
# src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
# #include <X11/Xlib.h>
# ^~~~~~~~~~~~
# 1 error generated.
# cc src/text.o (exit 1)
# (cd _build/default/src && /usr/bin/cc -O2 -fno-strict-aliasing -fwrapv -D_FILE_OFFSET_BITS=64 -D_REENTRANT -g -I /Users/traviszhang/.opam/cs3110-2021sp/lib/ocaml -o text.o -c text.c)
# In file included from src/unix/text.c:16:
# src/unix/libgraph.h:17:10: fatal error: 'X11/Xlib.h' file not found
# #include <X11/Xlib.h>
# ^~~~~~~~~~~~
# 1 error generated.
<><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 🐫
┌─ The following actions failed
│ λ build graphics 5.1.1
└─
╶─ No changes have been performed
I have tried the following solutions, but none of them seem to work:
https://github.com/ocaml/graphics/issues/16 (running export LIBRARY_PATH=/opt/X11/lib)
Also adding export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig" to my .zshrc file (this is mentioned in the same thread as 1.
When I run pkg-config --list-all | grep x11 the x11 libraries pop up, but for some reason spam can't seem to find it when trying to install graphics. Any suggestions would be helpful!
Here is my current computer configuration:
macOS BigSur Version 11.2.1
Ocaml Compiler 4.11.1
Update:
This issue has been brought up in the following thread (https://github.com/ocaml/graphics/pull/36#issuecomment-846827032), and will be updated in the new graphics release.
The easiest path to get the graphics package working on macOS is to install and properly setup homebrew, after that you can just do
opam depext --install graphics
and it should install the system dependencies via homebrew (xquartz and xorgproto) and install the OCaml library.

Bazel building C++ sample with ccache fails

I've been following the instructions for OSX here. I've installed bazel, cloned the sample and tried to build it with bazel build //main:hello-world. But here where it got wrong.
INFO: Analysed target //main:hello-world (0 packages loaded). INFO:
Found 1 target... ERROR:
/Users/myuser/work/temp/bazel-sample/examples/cpp-tutorial/stage1/main/BUILD:1:1:
Linking of rule '//main:hello-world' failed (Exit 1) ccache: error:
Failed to create temporary file for
/Users/myuser/.ccache/6/stats.tmp: Operation not
permitted Target //main:hello-world failed to build Use
--verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 0.295s, Critical Path: 0.07s INFO: 0 processes.
FAILED: Build did NOT complete successfully
Seems like there's an issue with ccache which I have installed. After running same command with --verbose_failures
INFO: Analysed target //main:hello-world (0 packages loaded). INFO:
Found 1 target... ERROR:
/Users/myuser/work/temp/bazel-sample/examples/cpp-tutorial/stage1/main/BUILD:1:1:
Linking of rule '//main:hello-world' failed (Exit 1): cc_wrapper.sh
failed: error executing command (cd
/private/var/tmp/_bazel_myuser/550c05da61518b4bbbb0ffdfd033154f/execroot/__main__
&& \ exec env - \
APPLE_SDK_PLATFORM='' \
APPLE_SDK_VERSION_OVERRIDE='' \
PATH=/Users/myuser/Library/Android/sdk/platform-tools:/Users/myuser/Library/Android/sdk/tools:/Users/myuser/Library/Android/sdk/build-tools/25.0.0:/Users/myuser/Library/Android/ndk/android-ndk-r10c:/Applications/CMake.app/Contents/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Users/myuser/bin
\
XCODE_VERSION_OVERRIDE=9.3.0 \ external/local_config_cc/cc_wrapper.sh -fobjc-link-runtime -Wl,-S -o
bazel-out/darwin-fastbuild/bin/main/hello-world
bazel-out/darwin-fastbuild/bin/main/_objs/hello-world/main/hello-world.o
-headerpad_max_install_names -lc++ -no-canonical-prefixes)
Use --sandbox_debug to see verbose messages from the sandbox ccache:
error: Failed to create temporary file for
/Users/myuser/.ccache/0/stats.tmp: Operation not permitted Target
//main:hello-world failed to build INFO: Elapsed time: 0.294s,
Critical Path: 0.07s INFO: 0 processes. FAILED: Build did NOT complete
successfully
I figured out that there's an issue with sandbox. Adding --sandbox_debug prints:
INFO: Analysed target //main:hello-world (0 packages loaded).
INFO: Found 1 target...
ERROR: /Users/myuser/work/temp/bazel-sample/examples/cpp-tutorial/stage1/main/BUILD:1:1: Linking of rule '//main:hello-world' failed (Exit 1): sandbox-exec failed: error executing command
(cd /private/var/tmp/_bazel_myuser/550c05da61518b4bbbb0ffdfd033154f/execroot/__main__ && \
exec env - \
APPLE_SDK_PLATFORM='' \
APPLE_SDK_VERSION_OVERRIDE='' \
DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer \
PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/myuser/bin \
SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk \
TMPDIR=/var/folders/x3/r5tf7wfx3_q0xnyx95s3r5400000gq/T/ \
XCODE_VERSION_OVERRIDE=9.3.0 \
/usr/bin/sandbox-exec -f /private/var/tmp/_bazel_myuser/550c05da61518b4bbbb0ffdfd033154f/sandbox/darwin-sandbox/1/sandbox.sb /private/var/tmp/_bazel_myuser/550c05da61518b4bbbb0ffdfd033154f/execroot/__main__/_bin/process-wrapper '--timeout=0' '--kill_delay=15' external/local_config_cc/cc_wrapper.sh -fobjc-link-runtime -Wl,-S -o bazel-out/darwin-fastbuild/bin/main/hello-world bazel-out/darwin-fastbuild/bin/main/_objs/hello-world/main/hello-world.o -headerpad_max_install_names -lc++ -no-canonical-prefixes)
ccache: error: Failed to create temporary file for /Users/myuser/.ccache/b/stats.tmp: Operation not permitted
Target //main:hello-world failed to build
INFO: Elapsed time: 0.268s, Critical Path: 0.06s
INFO: 0 processes.
FAILED: Build did NOT complete successfully
the content of the sandbox file sandbox.sb is:
(version 1)
(debug deny)
(allow default)
(deny file-write*)
(allow file-write*
(subpath "/dev")
(subpath "/Users/myuser/Library/Logs")
(subpath "/Users/myuser/Library/Developer")
(subpath "/private/var/folders/x3/r5tf7wfx3_q0xnyx95s3r5400000gq/T")
(subpath "/private/var/tmp/_bazel_myuser/550c05da61518b4bbbb0ffdfd033154f/sandbox/darwin-sandbox/1/execroot/__main__")
(subpath "/private/var/tmp")
(subpath "/private/var/folders/x3/r5tf7wfx3_q0xnyx95s3r5400000gq/C")
(subpath "/private/tmp")
)
It is apparently missing the permissions to write to the /Users/myuser/.ccache directory. I have tried disabling ccache with export CCACHE_DISABLE=1 but nothing changes. How can I fix it without removing ccache?
Is setting an absolute path to the compiler and passing it to CC environment variable an option? You might need to use BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 if you have Xcode installed.
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
<your bazel command>
can replace clang with gcc

Error build fortran under Yocto

It seems there is some problem to get compiled fortran for Yocto,
I configured my local.conf:
FORTRAN_forcevariable = ",fortran"
RUNTIMETARGET_append_pn-gcc-runtime = " libquadmath libgfortran"
IMAGE_INSTALL_append = " gfortran gfortran-symlinks libgfortran libgfortran-dev"
And during compilation I got errors:
| make: *** [all] Error 2
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /tmp/work/cortexa9hf-neon-poky-linux-gnueabi/gcc-runtime/6.2.0-r0/temp/log.do_compile.24985)
ERROR: Task (/sources/poky/meta/recipes-devtools/gcc/gcc-runtime_6.2.bb:do_compile) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3636 tasks of which 3570 didn't need to be rerun and 1 failed.
Any idea how to fix it?
I got a similar error in rocko. In my case I needed fortran compiler on an imx6 target, so I found this patch for libgfortran.inc, though in my case I override the functions do_configure and do_compile through a libgfortran_7.3.bbappend recipe.
My configuration added in local.conf:
# Enable fortran
IMAGE_FEATURES += "tools-sdk"
FORTRAN_forcevariable = ",fortran"
Configuration added to my image recipe:
FORTRAN_TOOLS = " \
gfortran \
gfortran-symlinks \
libgfortran \
libgfortran-dev \
"
IMAGE_INSTALL += "${FORTRAN_TOOLS}"
After building the image and booting the target, I successfully compiled Fortran code in my target imx6 board.

Failed to build when run command "bazel build tensorflow/examples/image_retraining:retrain"

I'm trying to build tensorflow on Ubuntu 14.04 LTS with python 2.7, no GPU. when I run the following command on terminal followed from this tutorial:
bazel build tensorflow/examples/image_retraining:retrain
it says failed to build with log:
ERROR: /home/yuan/tensorflow_source/tensorflow/tensorflow/python/BUILD:1826:1: Linking of rule '//tensorflow/python:_pywrap_tensorflow.so' failed: gcc failed: error executing command
(cd /home/yuan/.cache/bazel/_bazel_yuan/e5b8b6538ba16bbae5b1e0f5c26b7a12/execroot/tensorflow && \
exec env - \
/usr/bin/gcc -shared -o bazel-out/local-fastbuild/bin/tensorflow/python/_pywrap_tensorflow.so -Wl,--version-script tensorflow/tf_version_script.lds -pthread -Wl,-no-as-needed -B/usr/bin -B/usr/bin -pass-exit-codes '-Wl,--build-id=md5' '-Wl,--hash-style=gnu' -Wl,-S -Wl,#bazel-out/local-fastbuild/bin/tensorflow/python/_pywrap_tensorflow.so-2.params): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
bazel-out/local-fastbuild/bin/tensorflow/core/libversion_lib.a(version_info.pic.o): In function `tf_git_version()':
version_info.cc:(.text+0x0): multiple definition of `tf_git_version()'
bazel-out/local-fastbuild/bin/tensorflow/core/libframework_internal.lo(version_info.pic.o):version_info.cc:(.text+0x0): first defined here
bazel-out/local-fastbuild/bin/tensorflow/core/libversion_lib.a(version_info.pic.o): In function `tf_compiler_version()':
version_info.cc:(.text+0xd): multiple definition of `tf_compiler_version()'
bazel-out/local-fastbuild/bin/tensorflow/core/libframework_internal.lo(version_info.pic.o):version_info.cc:(.text+0xd): first defined here
collect2: error: ld returned 1 exit status
Target //tensorflow/examples/image_retraining:retrain failed to build
INFO: Elapsed time: 52.885s, Critical Path: 34.63s
Here's my build environment:
OS: Ubuntu 14.04 LTS 64 bit with RAM 12Gib
gcc version: 4.8.4
python version: 2.7.6
bazel version: 0.3.2
git version of tensorflow souce: v0.11.0rc0-1541-g3737ac3
Does anyone have idea to fix this error? Thanks a lot!
#David thanks for your help, it seems my ./configure result is not as expected.
I finally build successful by the following steps
sync tensorflow source to HEAD
run ./configure again, if have any error, refer to this.
run the build command again
bazel build tensorflow/examples/image_retraining:retrain
And my build result will have no error.

wxWidget configure: cannot guess build type

I'm trying to build wxWidget on Windows following this tutorial
. But when typed ../configure --enable-unicode --enable-debug -- --enable-monolithic --disable-shared, the output is a lot of "Segmentation fault" messages:
$ ./configure --enable-unicode --enable-debug --enable-monolithic --disable-shared
./configure: line 427: 3224 Segmentation fault expr a : '\(a\)' > /dev/null 2>&1
./configure: line 1492: 2560 Segmentation fault expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" > /dev/null
./configure: line 1492: 2452 Segmentation fault expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" > /dev/null
./configure: line 1492: 3692 Segmentation fault expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" > /dev/null
./configure: line 1492: 3436 Segmentation fault expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" > /dev/null
checking build system type... ./config.guess: unable to guess system type
This script, last modified 2015-08-20, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain; f=config.guess;hb=HEAD
and
http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run (./config.guess) is already up to date, please
send the following data and any information you think might be
pertinent to <config-patches#gnu.org> in order to provide the needed
information to handle your system.
config.guess timestamp = 2015-08-20
uname -m = x86
uname -r = 1
uname -s = WindowsNT
uname -v = 5
/usr/bin/uname -p =
/bin/uname -X =
hostinfo =
/bin/universe =
/usr/bin/arch -k =
/bin/arch = i686
/usr/bin/oslevel =
/usr/convex/getsysinfo =
UNAME_MACHINE = x86
UNAME_RELEASE = 1
UNAME_SYSTEM = WindowsNT
UNAME_VERSION = 5
configure: error: cannot guess build type; you must specify one
The config.log is here.
I also downdloaded the config.sub and config.guess
My OS is Windows XP SP3. The wxWidgets version is 3.0.2.
Something is very wrong with either the environment you're running configure in (Cygwin? MSYS? MSYS2? We don't know as you don't say) as expr definitely shouldn't segfault. Try running it interactively to see if you just have a corrupted /usr/bin/expr executable. If not, run hardware tests on your machine.