Using boost on the iPhone - iphone

After alot of hacking i have managed to compile the boost-libraries for iphone, both device and simulator, but when i try to use them i get an error in the xcode debugger saying:
dyld: Library not loaded: libboost_graph.so.1.40.0
which im guessing is a dynamic library loader which isn't allowed on the iphone. i'm linking the app with -Lboost_graph as a compiler flag.
this is the script i used for building boost:
./bjam $1 $2 $3 \
toolset=darwin \
architecture=arm \
target-os=iphone \
macosx-version=iphone-3.0 \
define=_LITTLE_ENDIAN \
--layout=system \
--libdir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/lib \
--includedir=/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/usr/include \
link=static \
runtime-link=static
./bjam $1 $2 $3 \
toolset=darwin \
architecture=x86 \
target-os=iphone \
macosx-version=iphonesim-3.0 \
--layout=system \
--libdir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/lib \
--includedir=/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/usr/include \
link=static \
runtime-link=static
I'm guessing i am missing something very basic here, but what?
is the library compiled for dynamic loading (there is both an .a-file and a .so-file in the platform /usr/lib)

I might be wrong, but I think you will need to link your application statically with boost - the error message from dyld suggests that you are currently linking to the dynamic boost library (note the .so suffix in the error message - you want to be linking against the static one - libboost.a
you probably want to link your app with something like:
-iboost_graph -static
(assuming the .a file is called libboost_graph.a)

Related

Training a new font in arabic causing issues: " Compute CTC targets failed "

I've been trying to train a new arabic font using tesseract. I was able to train it at first with the default training_text file available once you install Tesseract. But I wanted to train it using my own generated data.
So I proceeded as follow:
First I changed the ara.training_text file and I inserted some of the data that I want to train my model on.
Then I generated the .tif files using this command:
!/content/tesstutorial/tesseract/src/training/tesstrain.sh --fonts_dir /content/fonts \
--fontlist 'Traditional Arabic' \
--lang ara \
--linedata_only \
--langdata_dir /content/tesstutorial/langdata \
--tessdata_dir /content/tesstutorial/tesseract/tessdata \
--save_box_tiff \
--maxpages 100 \
--output_dir /content/train
then I combined the train_best trained data for arabic with the generated ara.lstm
!combine_tessdata -e /content/tesstutorial/tesseract/tessdata/best/ara.traineddata ara.lstm!combine_tessdata -e /content/tesstutorial/tesseract/tessdata/best/ara.traineddata ara.lstm
All good for now, then when I proceed to call lstmtraining, I am getting a "Compute CTC tagets failed" error whenever I am calling training
!OMP_THREAD_LIMIT=8 lstmtraining \
--continue_from /content/ara.lstm \
--model_output /content/output/araNewModel \
--old_traineddata /content/tesstutorial/tesseract/tessdata/best/ara.traineddata \
--traineddata /content/train/ara/ara.traineddata \
--train_listfile /content/train/ara.training_files.txt \
--max_iterations 200 \
--debug_level -1
I realized that his was only happening whenever I was adding arabic numerals to my code. When I pass in a training_text file with no arabic numerals it works fine.
Can someone tell me what this error is about how to solve it.

Build all packages for an image

Is it possible to build all of the packages for a specific image? I know I can build packages individually, but ideally would like to build all of them at once, through a single command.
Alternatively, is there a way to prevent the do_rootfs task from being executed for a particular image.
Cheers, Donal
First make an image that contains a packagegroup (or just list your dependencies there).
$ cat sources/meta-custom/recipes-custom/images/only-packages-image.bb
SUMMARY = "All dependencies no image"
LICENSE = "CLOSED"
version = "##DISTRO_VERSION##"
BB_SCHEDULER = "speed"
# option 1 - packagegroup, package list can be reused in real image
CORE_IMAGE_BASE_INSTALL += "\
packagegroup_all-depends \
"
# option 2 - list deps here, package list can not be reused in real image
CORE_IMAGE_BASE_INSTALL += "\
lshw \
systemd \
cronie \
glibc \
sqlite \
bash \
python3-dev \
python3-2to3 \
python3-misc \
python3-pyvenv \
python3-modules \
python3-pip \
wget \
apt \
pciutils \
file \
tree \
\
wpa-supplicant \
dhcpcd \
networkmanager \
curl-dev \
curl \
hostapd \
iw \
"
# remove the rootfs step
do_rootfs() {
}
Second make your packagegroup if you opted to reuse the list of packages
$ cat sources/meta-custom/recipes-custom/packagegroups/packagegroup-alldeps.bb
PACKAGE_ARCH = "${MACHINE_ARCH}"
inherit packagegroup
RDEPENDS_${PN} = " \
lshw \
systemd \
cronie \
glibc \
sqlite \
bash \
python3-dev \
python3-2to3 \
python3-misc \
python3-pyvenv \
python3-modules \
python3-pip \
wget \
apt \
pciutils \
file \
tree \
\
wpa-supplicant \
dhcpcd \
networkmanager \
curl-dev \
curl \
hostapd \
iw \
"
Finally build your new image placeholder
$ bitbake only-packages-image
In Yocto >=4.0 this is actually pretty easy to achieve. The packagegroup method did not work for me at all.
I don't know if this works in older versions though.
Create a new file in your custom layer, e.g. meta-custom/classes/norootfs.bbclass and put the following lines in there (as far as I noticed the order does not matter):
deltask do_deploy
deltask do_image
deltask do_rootfs
deltask do_image_complete
deltask do_image_setscene
then in your meta-custom/recipes-core/images/myimage.bb add norootfs to your other inherit commands
e.g. the most basic one
inherit core-image norootfs
You will notice your number of tasks decreasing by a fair amount (mine from ~4700 to ~3000) and there is no complete rootfs image anymore in build/tmp/deploy/images, except for bzImage and modules, just the plain ipk files in build/tmp/deploy/ipk.
I got this information by looking at https://docs.yoctoproject.org/ref-manual/tasks.html?highlight=do_image and .bbclass files in meta/classes where deltask is frequently used.

|Ubuntu 18.04, opencv-3.4.0, MATLAB/R2018a| make fails on undefined reference to cv::dnn::eperimental

I have followed the wiki steps to install mexopencv, but I get the following error:
$ make MATLABDIR=/usr/local/MATLAB/R2018a WITH_CONTRIB=true all contrib
/tmp/mex_17713079591682_20541/Net_.o: In function `mexFunction':
Net_.cpp:(.text+0x10dd): undefined reference to `cv::dnn::experimental_dnn_v3::Net::Net()'
Net_.cpp:(.text+0x11ac): undefined reference to `cv::dnn::experimental_dnn_v3::readNetFromCaffe(cv::String const&, cv::String const&)'
Net_.cpp:(.text+0x122a): undefined reference to `cv::dnn::experimental_dnn_v3::Net::~Net()'
.. and so on
If I see what is to be built in opencv, the module dnn is present, which makes me wonder.
-- General configuration for OpenCV 3.4.0 =====================================
-- OpenCV modules:
-- To be built: aruco bgsegm bioinspired calib3d ccalib core datasets dnn dpm face features2d flann freetype fuzzy hdf highgui img_hash imgcodecs imgproc line_descriptor ml objdetect optflow phase_unwrapping photo plot python_bindings_generator reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
-- Disabled: js python2 python3 world
-- Disabled by dependency: -
-- Unavailable: cnn_3dobj cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv dnn_modern java matlab ovis sfm ts viz
Built modules:
$ pkg-config --cflags --libs opencv
-I/usr/local/include/opencv ..etc.. -lopencv_dnn .. etc
Current opencv version is:
$ pkg-config --modversion opencv
3.4.0
Question is; Is there a way to workaround/fix this, by i.e. disabling/unlinking dnn?
Or how do I actually compile the dnn file needed to get this reference to work?
{edit 1} file is actually compiled in:
$ ls /usr/local/include/opencv2/
...
bioinspired dnn fuzzy imgproc optflow saliency superres videoio xphoto.hpp
bioinspired.hpp dnn.hpp fuzzy.hpp imgproc.hpp
...
{edit 2} Unlinking -lopencv_dnn in the mexopencv Makefile by adding:
CV_LDFLAGS := $(filter-out -lopencv_dnn,$(CV_LDFLAGS))
is not an option, as still compilation fails on undefined reference to cv::dnn::experimental_dnn_v3. So I guess i'll need a fix for that.
Found the solution to my problem. Cause was blindly following mexopencv for the Opencv installation part. I had to use the following in the cmake step:
# build and compile opencv-3.4.0:
$ cmake -G "Unix Makefiles" \
-DBUILD_DOCS=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_PERF_TESTS=OFF \
-DBUILD_TESTS=OFF \
-DBUILD_JAVA=OFF \
-DWITH_CUDA=OFF \
-DWITH_CUBLAS:BOOL=OFF \
-DWITH_CUFFT:BOOL=OFF \
-DWITH_NVCUVID:BOOL=OFF \
-DBUILD_opencv_cudaarithm:BOOL=OFF \
-DBUILD_opencv_cudabgsegm:BOOL=OFF \
-DBUILD_opencv_cudacodec:BOOL=OFF \
-DBUILD_opencv_cudafeatures2d:BOOL=OFF \
-DBUILD_opencv_cudafilters:BOOL=OFF \
-DBUILD_opencv_cudaimgproc:BOOL=OFF \
-DBUILD_opencv_cudalegacy:BOOL=OFF \
-DBUILD_opencv_cudaobjdetect:BOOL=OFF \
-DBUILD_opencv_cudaoptflow:BOOL=OFF \
-DBUILD_opencv_cudastereo:BOOL=OFF \
-DBUILD_opencv_cudawarping:BOOL=OFF \
-DBUILD_opencv_cudev:BOOL=OFF \
-DBUILD_opencv_java=OFF \
-DBUILD_opencv_js=OFF \
-DBUILD_opencv_python2=OFF \
-DBUILD_opencv_python3=OFF \
-DBUILD_opencv_ts=OFF \
-DBUILD_opencv_world=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DOPENCV_ENABLE_NONFREE=ON \
-DOPENCV_EXTRA_MODULES_PATH=~/cv/opencv_contrib-3.4.0/modules ~/cv/opencv-3.4.0
$ make -j8 # -j$(nproc)
$ sudo make install
# compile mexopencv = OK
$ make MATLABDIR=/usr/local/MATLAB/R2018a WITH_CONTRIB=true all contrib
main difference to wiki is to remove the following two lines from the cmake step:
-DWITH_MATLAB=OFF \
-DBUILD_opencv_matlab=OFF \

Creation of Paypal encrypted button returns the error 11945 invalid country and locale combination

I am implementing the creation of encrypted Paypal buttons using their Button Manager API. Despite all my efforts I am facing the error 11945 The button country and language code combination specified is invalid..
First I tried to implement the creation of my own button but while tracing this error, I ended up with their tutorial using curl, which fails for me too with the same error. (Note: I had to change the credentials to mine).
To be specific, this code from their tutorial fails with the error 11945:
curl https://api-3t.sandbox.paypal.com/nvp \
-s \
--insecure \
-d USER=<my-user-name> \
-d PWD=<my-password> \
-d SIGNATURE=<my-signature> \
-d VERSION=51.0 \
-d METHOD=BMCreateButton \
-d BUTTONCODE=ENCRYPTED \
-d BUTTONTYPE=CART \
-d BUTTONSUBTYPE=PRODUCTS \
-d BUTTONCOUNTRY=US \
-d L_BUTTONVAR1=item_name%3Dshoehorn \
-d L_BUTTONVAR2=amount%3D1464.46 \
-d L_BUTTONVAR3=tax=%3D21 \
-d L_BUTTONVAR4=item_number%3D123456
I tried to figure out why is that but I haven't found any relevant sources.
Can anyone explain this issue? The country code is set to US, which should be fine.
All help will be appreciated.
Note: I am using the sandbox right now.
Note: Defining locale through lc attribute does not help. I tried en as well as en_US values.
After a discussion with the Paypal support, there is the conclusion.
Short version: It's a bug.
Long version (by moderator MTS_Ciaran):
Thanks, so this looks like a bug on the sandbox from what I can see.
The issue is that the account is CZ and for some reason we're not
allowing the button creation because of that. It doesnt look to be the
same on the live environment so I would suggest using a US account for
testing and once live the CZ account shouldn't be an issue.
I'll
work internally to get the sandbox corrected for this.

Error "Can not resolve reference to multiname unambiguously"

Personal is giving this error and I can not solve it.
Can not resolve reference to multiname unambiguously. FacebookMobile (from C: \ Users \
Robinho \ Adobe Flex Builder 4.6 \ FacebookMobile \ src \ FacebookMobile.mxml) and
com.facebook.graph: FacebookMobile (from C: \ Users \ Robinho \ Adobe Flex Builder 4.6 \
FacebookMobile \ libs \ GraphAPI_Mobile_1_8_1 . swc (com.facebook.graph: FacebookMobile))
are available.
You have two classes with same name FacebookMobile one is defined by FacebookMobile.mxml and other exists in GraphAPI_Mobile_1_8_1.swc (library).
You should avoid naming new classes as ones that already defined by libraries you use. (If they properly namespaced this should not be an issue, but this probably isn't a case)