Cross-compiled ARM executable can't open existing libpthread.so library file - pthreads

I'm cross-compiling programs that run on an ARM processor under a very stripped-down Linux, kernel version 2.4.26. One program uses libmysqlclient which has worked for years. However, the version I've used in the past (libmysqlclient.so.10) doesn't seem work with my new remote Mysql server (5.5.31).
I got a newer version of libmysqlclient (version 15). My program now generates a run-time error:
error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
I assume that means that the new libmysqlclient needs libpthreads. I've copied a recent ARM libpthread.so file into the /lib directory:
$ ls -l /lib/libpthread*
-rwxrwxrwx 1 root root 111324 Aug 6 08:46 /lib/libpthread-2.7.so
lrwxrwxrwx 1 root root 17 Aug 6 08:47 /lib/libpthread.so.0 -> libpthread-2.7.so
Still get the same error. The target system is stripped down to the extent that it doesn't have ldconfig or ldd or much else. ldd run on another more capable system against the executable shows no surprises:
ts7500:# ldd vecsSqlLogger
libmysqlclient.so.15 => /usr/lib/libmysqlclient.so.15 (0x40026000)
libc.so.6 => /lib/libc.so.6 (0x401f9000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40322000)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x40340000)
libnsl.so.1 => /lib/libnsl.so.1 (0x40379000)
libm.so.6 => /lib/libm.so.6 (0x40396000)
libz.so.1 => /usr/lib/libz.so.1 (0x4040e000)
/lib/ld-linux.so.2 (0x40000000)
ts7500:# file /lib/libpthread-2.7.so
/lib/libpthread-2.7.so: ELF 32-bit LSB shared object, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.6.12, not stripped
Why am I getting this error? The library file is clearly in the expected directory. Could it be that the problem is that libpthread.so is compiled for a kernel version later than mine?

Related

Rails 7, vips on M1 MacBook Air

I'm unable to use Rails 7.0.3.1 with vips on an M1 MacBook Air due to the error:
rails aborted!
LoadError: Could not open library 'glib-2.0.0': dlopen(glib-2.0.0, 0x0005): tried: 'glib-2.0.0' (no such file), '/usr/local/lib/glib-2.0.0' (no such file), '/usr/lib/glib-2.0.0' (no such file), '/Users/brody/Code/tms.next-tms.com.wip2/glib-2.0.0' (no such file).
Could not open library '/opt/local/lib/libglib-2.0.0.dylib': dlopen(/opt/local/lib/libglib-2.0.0.dylib, 0x0005): tried: '/opt/local/lib/libglib-2.0.0.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
I'm using ffi 1.15.1 and can see it searching correctly in /opt/local/lib, but the homebrew package builds binaries for x86_64 rather than arm64e even while using the --build-from-source option (brew install vips --build-from-source).
Has anyone got this working?
I ran into the same issue (with libglib-2.0.0) but then I figured that brew poured glib--2.74.5.arm64_monterey.bottle so why does it find 2.0.0? In my case it was (a dated version of) Navicat linking an old glib
~$ ls -l /usr/local/lib/libglib*
0 lrwxr-xr-x 1 chaos staff 73B Dec 11 11:23 /usr/local/lib/libglib-2.0.0.dylib -> /Applications/Navicat Premium.app/Contents/Frameworks/libglib-2.0.0.dylib
This wasn't the only file however, Navicat linked a total of 71 dylib files. I removed all those symlinks and then the error disappeared

Error 13 error C1083: Cannot open include file: 'cudnn.h': No such file or directory ...\caffe\util\cudnn.hpp 5 1 convert_imageset

When I compile caffe for windows (64bit, release, vs 2013, nvidia 750, opencv 3.1,cuDNN version 5.1), I got the following error
"Error 13 error C1083: Cannot open include file: 'cudnn.h': No such
file or directory ...\caffe\util\cudnn.hpp 5 1 convert_imageset".
I set everything like what mentioned in this video.
I search for this error in github issues link this and this
if I use version 4 of cuDNN and OpenCV 2.4I got:
========== Rebuild All: 15 succeeded, 1 failed, 0 skipped ==========
However, I got error:
Error 1 error MSB3073: The command
""...\caffe-master\windows\scripts\BinplaceCudaDependencies‌​.cmd"
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v7.5\bin"
"...\cuda" false true "...\caffe-master\windows..\Build\x64\Release\"
:VCEnd" exited with code 1. C:\Program Files
(x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.ta‌​rgets
132 5 libcaffe
Extract the cuDNN archive to a directory of your choice, referred to below as installpath. Then follow the platform-specific instructions as follows:
Add installpath to the PATH environment variable.
In your Visual Studio project properties, add installpath to the Include Directories and Library Directories lists and add cudnn.lib to Linker->Input->Additional Dependencies.

ant debug failed to include gdb.setup in the apk file

I've been building (from a mac terminal) this native application successfully for a long time but today I've run across an error I can't seem to pin down. After tiring from all the javac warnings I upgraded to a newer version of ant. I'm not sure it is related but the timing is suspect. I can still build, deploy, and run my application but now I can no longer use ndk-gdb to debug the native part of the application. It appears on inspection that the gdb.setup file is not getting added to the debug apk.
here is the build sequence, abbreviated output, and information. I'm looking for suggestions on how to resolve the issue.
I've done a full clean on both NDK and ant builds
The android NDK version and android SDK versions are all up to date.
I use the built in ndk-bundle that gets loaded with the android studio sdk tools.
The devices we develop on are not rooted and is not an option.
hsmith$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
hsmith$ $ANT_HOME
-bash: /Users/hsmith/dk/ant/apache-ant-1.9.6: is a directory
hsmith$ ndk-build -j4 NDK_DEBUG=1
[armebi-v7a] Gdbserver : [arm-linux-androideabi-4.8] libs//gdbserver
[armebi-v7a] Gdbsetup : libs//gdb.setup
[armebi-v7a] Install : lib1.so => libs/armebi-v7a/lib1.so
[armebi-v7a] Install : lib2.so => libs/armebi-v7a/lib2.so
[armebi-v7a] Install : lib3.so => libs/armebi-v7a/lib3.so
hsmith$ ant debug
…
-package:
[apkbuilder] Found modified input file
[apkbuilder] Creating -debug-unaligned.apk and signing it with a debug key...
-post-package:
-do-debug:
[zipalign] Running zip align on final apk...
[echo] Debug Package: /Users/hsmith/packageFolder/bin/<package>-debug.apk
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
[propertyfile] Updating property file: /Users/hsmith/packageFolder/bin/build.prop
-post-build:
debug:
BUILD SUCCESSFUL
hsmith$ adb install -r ~/packageFolder/bin/-debug.apk
hsmith$ ndk-gdb adb --start
ERROR: Package is not debuggable ! You can fix that in two ways:
Rebuilt with the NDK_DEBUG=1 option when calling 'ndk-build'.
Modify your manifest to set android:debuggable attribute to "true",
then rebuild normally.
After one of these, re-install to the device!
I unzipped the apk file to find
unziped apk file/lib/target/
hsmith$ ls -la
total 48264
drwxr-xr-x 12 hsmith staff 408 Aug 25 14:50 .
drwxr-xr-x 5 hsmith staff 170 Aug 25 14:50 ..
-rwxr-xr-x 1 hsmith staff 409940 Jun 3 11:47 gdbserver
-rwxr-xr-x 1 hsmith staff 33920 Aug 25 14:44 lib1.so
-rwxr-xr-x 1 hsmith staff 165092 Aug 25 14:44 lib2.so
-rwxr-xr-x 1 hsmith staff 1614028 Aug 25 14:44 lib3.so
note there is no gdb.setup file
I don't use debuggable=true in the manifest because it isn't needed anymore however including it has no affect on the result.
UPDATE: https://code.google.com/p/android/issues/detail?id=183455
This is exactly the problem I'm having. if you copy the target gdb.setup file from the target directory to the ./lib directory you can get ndk-gdb to work; The COMPAT_ABI variable in ndk-gdb isn't being set correctly and sending the script into a spin. I hope they fix this one soon. almost three days wasted on a broken tool chain.
UPDATE: https://code.google.com/p/android/issues/detail?id=183455 This is exactly the problem I'm having. if you copy the target gdb.setup file from the target directory to the ./lib directory you can get ndk-gdb to work; The COMPAT_ABI variable in ndk-gdb isn't being set correctly and sending the script into a spin. I hope they fix this one soon. almost three days wasted on a broken tool chain.

iOS Cydia THEOS, make install, Could not find deb package

I followed the instructions here and it happens in both tweak and app:
http://iphonedevwiki.net/index.php/Theos/Setup#Creating_a_Project
But I don't see any .deb files
RoverMR-2:testapp rover$ find . -name "deb"
Here are several relevant command output logs:
https://gist.github.com/anonymous/42b4a086d6b7ee792b08
I just see this in packages:
RoverMR-2:testapp rover$ ls -la .theos/packages/
total 8
drwxr-xr-x 3 rover staff 102 Apr 30 11:12 .
drwxr-xr-x 4 rover staff 136 Apr 30 11:12 ..
-rw-r--r-- 1 rover staff 1 Apr 30 11:12 com.mysite.testapp-0.0.1
RoverMR-2:testapp rover$ make package
/Users/rover/Documents/Dev/Cydia/Theos/apps/testapp/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application testapp...
Copying resource directories into the application wrapper...
Compiling main.m...
Compiling testappApplication.mm...
Compiling RootViewController.mm...
Linking application testapp...
Stripping testapp...
Signing testapp...
Making stage for application testapp...
RoverMR-2:testapp rover$
RoverMR-2:testapp rover$ ls
Makefile RootViewController.h _ main.m testappApplication.mm
Resources RootViewController.mm control obj theos
RoverMR-2:testapp rover$
the error:
RoverMR-2:testapp rover$ make install
/Users/rover/Documents/Dev/Cydia/Theos/tweaks/testtweak/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Could not find "./com.yourcompany.testtweak_0.0.1-10_iphoneos-arm.deb" to install. Aborting.
I posted an issue about this https://github.com/DHowett/theos/issues/120
Type make package install all at once in the tweak's directory.

Building OpenCV with CUDA support Error on transpose.cu

Recently I am trying to build OpenCV with CUDA support, and I met problem while building the module cudaarithm.
OpenCV source: git cloned from : http://github.com/Itseez/opencv.git
OpenCV branch: master branch
OpenCV commit:
`commit 5466e321b8c8f97536002a357e5b7ff49a5d2bf9, on Tue Feb 10 12:17:11 2015 +0000`
CUDA version: CUDA 6.5
Hardware: MacBook Pro (13-inch, Mid 2010)
GPU: NVIDIA GeForce 320M 256 MB
OS Version: OS X Yosemite
Steps I used:
1. cd in OpenCVSource, then mkdir myrelease, and cd myrelease
2. cmake -DPLANTUML_JAR=/usr/local/Cellar/plantuml/8002 -D BUILD_DOCS=1 -DPYTHON2_LIBRARY=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib -DPYTHON2_INCLUDE_DIR=/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/include/python2.7 -DPYTHON3_LIBRARY=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/libpython3.4m.dylib -DPYTHON3_INCLUDE_DIR=/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/include/python3.4m -D CMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/usr/local -Wno-dev -DNVCC_FLAGS_EXTRA="-Xcompiler -stdlib=libstdc++; -Xlinker -stdlib=libstdc++" -DOPENCV_EXTRA_CXX_FLAGS=" -stdlib=libstdc++" -DOPENCV_EXTRA_EXE_LINKER_FLAGS="-stdlib=libstdc++" ..
3. make VERBOSE=1
Expect Result: Building success without error
Actual Result: when building OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu, error happend like below:
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(61): *error: identifier "getInputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(67): *error: identifier "getOutputMat" is undefined*
/Users/Hawk/Documents/study/DIP/OpenCV/OpenCVSource/modules/cudaarithm/src/cuda/transpose.cu(92): *error: identifier "syncOutput" is undefined*
Then what action I take:
check the code and I found these undefined symboles are defined in OpenCVSource/modules/core/include/opencv2/core/private.cuda.hpp
check the code and I confrim that the "transpose.cu" file include "opencv2/core/private.cuda.hpp"
check the building log, and I the confirm the private.cuda.hpp is in the search path of header file
cp "opencv2/core/private.cuda.hpp" as another file "opencv2/core/hawk.hpp", and then edit "transpose.cu" to include this new file, and I found
the "undifined symbole error" disapeared.
Although this is a workable workaround, I would like know whether the original OpenCV source cannot be compiled.
All, I think I found the problem cause.
Before I met such problem, I've already build and install OpenCV using older code from the git repo. So that there already have header files in my /usr/local/include/opencv2, especially there is /usr/local/include/opencv2/core/private.cuda.hpp.
However, it is an older one that doesn't define the symbols reporting undefined in above question. At the same time I found during the building nvcc have -I/usr/local/include in the command line, so that it use wrong private.cuda.hpp. As you know it should use the one in OpenCVSource, not the older installed one.
I think the solution is to gracefully remove the original installed OpenCV from my computer, then build again. I am trying and I will report later.

Resources