I'm trying to build an iOS application using QT6.4.2 and Cmake, I'm getting following linking error
Undefined symbols for architecture arm64:
"_main", referenced from:
user_main_trampoline() in libqios_debug.a(qioseventdispatcher.mm.o)
(maybe you meant: _jinit_d_main_controller, _jinit_c_main_controller , _qt_main_wrapper )
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
this is m list of installed libs
My main entry point looks like this
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
// ...
return app.exec();
}
following is my cmake script
set(TARGET_NAME Focus)
set(CMAKE_SUPPRESS_REGENERATION true)
include(../cute.cmake)
include(../files.cmake)
cute_add_executable(${TARGET_NAME})
target_sources(${TARGET_NAME}
PRIVATE
${FOCUS_HEADER}
${OBJECTIVE_HEADER}
${COMMON_HEADER}
${FOCUS_SOURCE}
${OBJECTIVE_SOURCE}
${COMMON_SOURCE}
${QUICK_IOS_SOURCE}
${FOCUS_QML_SOURCE}
${QUICK_IOS_QML_SOURCE}
${QRC_FILES}
${QT_QML_PLUGIN_CPP}
)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core OpenGL Concurrent Widgets Multimedia Network Sql Qml Quick QuickWidgets Svg WebView QuickControls2 Core5Compat REQUIRED)
# set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-Wl,-e,_qt_main_wrapper")
# set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-u _qt_registerPlatformPlugin")
target_link_libraries(${TARGET_NAME}
PRIVATE
#MySharedLibrary
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Concurrent
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Qml
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::OpenGL
Qt${QT_VERSION_MAJOR}::Multimedia
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Sql
Qt${QT_VERSION_MAJOR}::Qml
Qt${QT_VERSION_MAJOR}::Quick
Qt${QT_VERSION_MAJOR}::QuickControls2
Qt${QT_VERSION_MAJOR}::QuickWidgets
Qt${QT_VERSION_MAJOR}::Svg
Qt${QT_VERSION_MAJOR}::WebView
Qt${QT_VERSION_MAJOR}::Core5Compat
)
if (${QT_VERSION_MAJOR} EQUAL 6)
qt6_import_qml_plugins(${TARGET_NAME})
endif ()
file(GLOB LOCAL_LIB_FILES "${CMAKE_SOURCE_DIR}/lib/ios/*.a")
message("CMAKE_SOURCE_DIR : " ${CMAKE_SOURCE_DIR})
target_link_libraries(${TARGET_NAME}
PRIVATE
${LOCAL_LIB_FILES}
)
Any guidance/help is appreciated.
I've already gone through following posts from QT community and SO but no luck,
https://forum.qt.io/topic/136707/undefined-symbols-_main-when-building-a-shared-lib-on-ios-with-qt-statemachine
https://forum.qt.io/topic/80775/main-function-required-when-compiling-shared-library-for-ios
QT IOS linker error entry point (_main) undefined
LINKER COMMAND: https://pastebin.com/CdARmarQ
CMAKE SCRIPT: https://pastebin.com/xXnCUKC6
NOTE: I've used https://github.com/cuteserver/hello-world as my toolchain and qt configuration for iOS.
Related
I am a new user of tensorflow. I wish to integrate a specific graph.pb file into an ios device, and have followed all the compilation instructions carefully as described in tensorflow git.
yet when I try to run the camera example app I get the error:
E /tensorflow/tensorflow/examples/ios/camera_copy/tensorflow_utils.mm:140] Could not create TensorFlow Graph: Invalid argument: No OpKernel was registered to support Op 'Conv2D' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[{{node pyramid_regression_0/convolution}} = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true](input_2, pyramid_regression_0/kernel/read)]]
2018-08-22 16:54:00.303760: F tensorflow/examples/ios/camera_copy/tensorflowUtil.mm:68] Couldn't load model: Invalid argument: No OpKernel was registered to support Op 'Conv2D' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[{{node pyramid_regression_0/convolution}} = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="SAME", strides=[1, 1, 1, 1], use_cudnn_on_gpu=true](input_2, pyramid_regression_0/kernel/read)]]
I also followed the instructions according to the solution offered in here, but I got there are some differences (probably due to the versions diffs between a year ago and now (Aug 2018))
bazel build --copt="-DUSE_GEMM_FOR_CONV" tensorflow/python/tools/print_selective_registration_header compiled without errors
then created the ops_to_register.h file:
when used the bazel-bin command, it adds a strange print of tf.estimator package not installed to the first line.
In addition, during the file creation this warning appears multiple times:
RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 88
when I create the ops_to_register.h file using python3 , it creates the file without strange prints
in both cases there are no occurrences of strcmp or strcmpc at all, and got Conv2DUsingGemmOp op in the bazel created file instead of Conv2DOp by python3
I tried to use the ops_to_register.h file for the tensorflow/contrib/makefile/compile_ios_tensorflow.sh compilation, but it fails during the compilation:
Undefined symbols for architecture arm64:
"nsync::nsync_cv_signal(nsync::nsync_cv_s_)", referenced from:
tensorflow::condition_variable::notify_one() in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_cv_wait_with_deadline(nsync::nsync_cv_s_, nsync::nsync_mu_s_, timespec, nsync::nsync_note_s_)", referenced from:
tensorflow::condition_variable::wait_until_system_clock(tensorflow::mutex_lock&, std::__1::chrono::time_point > >) in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_cv_init(nsync::nsync_cv_s_)", referenced from:
tensorflow::condition_variable::condition_variable() in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_from_time_point_(std::__1::chrono::time_point > >)", referenced from:
tensorflow::condition_variable::wait_until_system_clock(tensorflow::mutex_lock&, std::__1::chrono::time_point > >) in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_cv_wait(nsync::nsync_cv_s_, nsync::nsync_mu_s_)", referenced from:
tensorflow::condition_variable::wait(tensorflow::mutex_lock&) in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_mu_runlock(nsync::nsync_mu_s_)", referenced from:
tensorflow::mutex::unlock_shared() in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_mu_rlock(nsync::nsync_mu_s_)", referenced from:
tensorflow::mutex::lock_shared() in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_mu_unlock(nsync::nsync_mu_s_)", referenced from:
tensorflow::mutex::unlock() in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_mu_lock(nsync::nsync_mu_s_)", referenced from:
tensorflow::mutex::lock() in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_cv_broadcast(nsync::nsync_cv_s_)", referenced from:
tensorflow::condition_variable::notify_all() in libtensorflow-core-arm64.a(mutex.o)
"nsync::nsync_mu_init(nsync::nsync_mu_s_*)", referenced from:
tensorflow::mutex::mutex() in libtensorflow-core-arm64.a(mutex.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make:
[/tensorflow/tensorflow/contrib/makefile/gen/bin/ios_ARM64/benchmark] Error 1
'[' 2 -ne 0 ']'
echo 'arm64 compilation failed.'
arm64 compilation failed.
exit 1
environment details:
tensorflow 1.9.0 (there is tensorflow 1.10.0, but is currently not supported for the ios compilations)
python 3.6.6
all the compilations are done with -a arm64 only
does anyone have an idea what went wrong here?
thanks a lot
I once had a similar error when compiling for the raspberry pi, I had to manually export the environment variables HOST_NSYNC_LIB and TARGET_NSYNC_LIB
First check if you have them already exported: echo $HOST_NSYNC_LIB
if that is empty you should look where your nsync library is compiled (just look for libnsync.a)
Then export both paths:
export HOST_NSYNC_LIB='your/path/to/libnsync.a'
export TARGET_NSYNC_LIB="$HOST_NSYNC_LIB"
Hope this works for you!
I have a unity project that i'm building for iOS. I've included EasyAR, OneSignal, Firebase Analytics in the project.
It is working fine on Android without ant hiccups.
But on iOS I get this error in Xcode:
clang: error: unable to execute command: Killed: 9
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: aarch64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg:
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/fq/1sb3yqqx5s75s2h8m5z56fwm0000gn/T/Bulk_Assembly-CSharp_7-05e3fe.cpp
clang: note: diagnostic msg: /var/folders/fq/1sb3yqqx5s75s2h8m5z56fwm0000gn/T/Bulk_Assembly-CSharp_7-05e3fe.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/amit/Library/Logs/DiagnosticReports/clang__.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg:
Unity version: 2017.3
Xcode: 9.3
i met the some problem and solve it
with c# code
public class SomeWord
{
public static List<string> Words = new List<string>(new string[]
{
"aaa"
, "bbb"
, "ccc"
, "ddd"
, "eee"
, "fff"
, "ggg"
// the list has 3w ele
il2cpp convert this to
extern "C" void SomeWord__cctor_m3830774958 (Il2CppObject * __this /* static, unused */, const MethodInfo* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (SomeWord__cctor_m3830774958_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
StringU5BU5D_t1642385972* L_0 = ((StringU5BU5D_t1642385972*)SZArrayNew(StringU5BU5D_t1642385972_il2cpp_TypeInfo_var, (uint32_t)((int32_t)26109)));
NullCheck(L_0);
ArrayElementTypeCheck (L_0, _stringLiteral1002530778);
(L_0)->SetAt(static_cast<il2cpp_array_size_t>(0), (String_t*)_stringLiteral1002530778);
StringU5BU5D_t1642385972* L_1 = L_0;
NullCheck(L_1);
ArrayElementTypeCheck (L_1, _stringLiteral632527236);
(L_1)->SetAt(static_cast<il2cpp_array_size_t>(1), (String_t*)_stringLiteral632527236);
StringU5BU5D_t1642385972* L_2 = L_1;
NullCheck(L_2);
// this style of code repeat nearly 3w times
just pick out the string in list and put it in a file, then read in from file solve the problem. the c# code is auto generate with some reason maybe i don't know why. next time if someone meet the same problem, do with this step:
1) check out the xcode compile step and find out which file cost a lot of time
2) open the file and find if there is some weird function with a lot of statement in
3) find out which c# file convert to those code and change it
I use the ffmpeg version is 3.0, Xcode version 7.3.1, compile time has been reported as the following error:
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_avcodec_decode_subtitle2 in libavcodec.a(utils.o)
"_libiconv_close", referenced from:
_avcodec_open2 in libavcodec.a(utils.o)
_avcodec_decode_subtitle2 in libavcodec.a(utils.o)
"_libiconv_open", referenced from:
_avcodec_open2 in libavcodec.a(utils.o)
_avcodec_decode_subtitle2 in libavcodec.a(utils.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
My project has been introduced in the following framework and library:
1.VideoToolbox.framework
2.libiconv.2.4.0.tbd
3.libz.tbd
4.libbz2.tbd
I agree with Eureka.gh. The root cause should be symbol mismatch.
I show my test result below.
LiaotekiMacBook-Pro:lib liaokuohsun$ nm libavcodec.a | grep iconv
U _libiconv
U _libiconv_close
U _libiconv_open
LiaotekiMacBook-Pro:lib liaokuohsun$ nm libiconv.dylib | grep iconv
00000000000f2d80 S ___iconv_2VersionNumber
00000000000f2d50 S ___iconv_2VersionString
00000000000f4750 D __libiconv_version
0000000000003174 T _iconv
00000000000034b7 T _iconv_canonicalize
0000000000003196 T _iconv_close
0000000000001cdd T _iconv_open
00000000000031a3 T _iconvctl
00000000000032ac T _iconvlist
0000000000015f0d T _libiconv_relocate
00000000000f4760 b _libiconv_relocate.initialized
0000000000015e54 T _libiconv_set_relocation_prefix
Here I provide another solution.
With some wrapper functions in your code, this link error can be fixed.
#include <iconv.h>
iconv_t libiconv_open(const char *tocode, const char *fromcode)
{
return iconv_open(tocode, fromcode);
}
size_t libiconv(iconv_t cd,
char **inbuf, size_t *inbytesleft,
char **outbuf, size_t *outbytesleft)
{
return iconv( cd, inbuf, inbytesleft, outbuf, outbytesleft);
}
int libiconv_close(iconv_t cd)
{
return iconv_close(cd);
}
I have the same issue with you. What I found is that the libiconv.tbd (or libiconv2.tbd or libiconv2.4.0.tbd) comes from macOS 10.12(in my case) have compatible issue where the exported symbols are iconv/iconv_open/iconv_close whereas ffmpeg calls libiconv functions like libiconv/libiconv_open/libiconv_close.
Solution is to remove libiconv.2.4.0 from framework/library and one specific version of libiconv.a where libiconv/libiconv_open/libiconv_close are the exported symbols. In my case, I found another copy of libiconv.a in /opt/local/lib. I simply copy this lib file to my project and add it.
Please have a try and let me know if it's able to resolve your issue.
I'm using the following CMake file to build an opencv project using the command cmake followed by make.
cmake_minimum_required(VERSION 2.8)
project(t)
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} /home/keiths/opencv/opencv-2.4.11_build/build)
SET(CMAKE_C_COMPILER mpicc)
SET(CMAKE_CXX_COMPILER mpicxx)
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories(${OpenCV_INCLUDE_DIRS})
find_package(OpenCV REQUIRED)
find_package(MPI REQUIRED)
add_executable(t t.cpp)
target_link_libraries(t ${OpenCV_LIBS} ${OpenCV_LIBRARIES} opencv_core opencv_highgui opencv_calib3d opencv_contrib opencv_core opencv_features2d opencv_flann opencv_gpu opencv_highgui opencv_imgproc opencv_legacy opencv_ml opencv_nonfree opencv_objdetect opencv_ocl opencv_photo opencv_stitching opencv_superres opencv_ts opencv_video opencv_videostab rt pthread m dl)
MESSAGE(${OpenCV_LIBS})
MESSAGE(${OpenCV_INCLUDE_DIRS})
cmake completes fine, but make gives me the following error:
CMakeFiles/t.dir/t.cpp.o: In function main': t.cpp:(.text+0x56):
undefined reference to
cv::namedWindow(std::__cxx11::basic_string, std::allocator > const&, int)' collect2:
error: ld returned 1 exit status make[2]: * [t] Error 1 make[1]: *
[CMakeFiles/t.dir/all] Error 2 make: *** [all] Error 2
I've tried running the following command
g++ t.cpp $(pkg-config --libs opencv --cflags)
but get the following error
/home/keiths/tmp/ccWFcaXH.o: In function main': t.cpp:(.text+0x56):
undefined reference to
cv::namedWindow(std::__cxx11::basic_string, std::allocator > const&, int)' collect2:
error: ld returned 1 exit status
I'm running the following simple code
#include "opencv2/opencv.hpp"
#include "opencv2/core/core.hpp"
#include "opencv2/highgui/highgui.hpp"
//#include <mpi.h>
using namespace cv;
int main(int argc, char **argv) {
Mat image;
namedWindow( "Display window", WINDOW_AUTOSIZE );
return 0;
}
I've tried as many recommendations as I can without success. Platform is CentOS and I'm a limited user (non-root) with my locally installed (more recent) versions of g++/gcc. I get the correct list of libraries for the pkg-config command and have configured library paths as well as the PATH to my local opencv folder
Just to add a very important point, I tried compiling the same code while explicitly specifying the stock g++ compiler (/usr/bin/g++) and all went well. So it seems that the problem would be with my local g++ compiler at '/home/keiths/lbin'. I need this latest version however for the c++11 capability (the old is 4.4.7 and it would take ages for the Sysadmin to upgrade it)
I had built my OpenCV library using the old g++ compiler (in the system bin folder), prior to building the latest g++. Rebuilding the OpenCV library using the new g++ compiler did it for me. Out of curiosity, I tried building the OpenCV example using the old compiler and it returned many 'undefined reference' lines, but I'm happy to swap problems since I don't need it anyway!
I tried to use LibEtPan as a backend for a mail client. I downloaded the source code from https://github.com/dinhviethoa/libetpan and additional libs from https://github.com/bindle/iOSPorts too. I ran the LibEtPan build-mac/update.sh and added the libetpan.xcodeproj to my project as well as openldap.xcodeproj, openssl.xcodeproj, Cyrus SASL.xcodeproj.
I set the following Target Dependencies: libetpan ios (libetpan), lber (openldap), ldap (openldap), crypto (openssl), ssl (openssl), sasl2 (Cyrus SASL) and I Linked Binary With Libraries: libetpan-ios.a, libiconv.dylib, liblber.a, libldap.a, libcrypto.a, libsasl2, libssl.a
But as soon as I call something like mailimap_new i get the error message:
Undefined symbols for architecture i386:
"_mailimap_extension_xgmmsgid", referenced from:
_internal_extension_list in libetpan-ios.a(mailimap_extension.o)
(same with armv7 or other architectures)
I have no idea which lib i have to include additionally.