Using AFNetworking 2.0+ on OS X 10.8 - afnetworking-2

Is there anyone successfully using AFNetworking 2.* on OS X 10.8? Its documentation says that minimal requirements is OS X 10.8 but I have no luck using it in application with deployment target and Base SDK 10.8.
I'm getting the following error:
Undefined symbols for architecture x86_64:
"_NSURLSessionTransferSizeUnknown", referenced from:
-[AFURLSessionManagerTaskDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:] in libPods.a(AFURLSessionManager.o)
-[AFURLSessionManager uploadTaskWithTask:progress:completionHandler:] in libPods.a(AFURLSessionManager.o)
"_OBJC_CLASS_$_NSURLSession", referenced from:
objc-class-ref in libPods.a(AFURLSessionManager.o)
"_OBJC_CLASS_$_NSURLSessionConfiguration", referenced from:
objc-class-ref in libPods.a(AFHTTPSessionManager.o)
objc-class-ref in libPods.a(AFURLSessionManager.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is it possible to use AFNetworking 2 on OS X 10.8?

AFNetworking 2.0 can be used on OSX 10.8, but you cannot use the classes based on NSURLSession (Available from 10.9) Basically don't use AFURLSessionManager & AFHTTPSessionManager or even the constants defined in NSURLSession.
Use below:
AFURLConnectionOperation
AFHTTPRequestOperation
AFHTTPRequestOperationManager

Related

fail to link cuda example with clang++-9 under Ubuntu 18.04

I am trying to follow the example in
https://llvm.org/docs/CompileCudaWithLLVM.html#invoking-clang
I use Ubuntu 18.04.3 LTS, clang version 9.0.0-2
The device I have is (snippet from the output of deviceQuery):
Detected 1 CUDA Capable device(s)
Device 0: "Quadro P520"
CUDA Driver Version / Runtime Version 10.2 / 10.2
CUDA Capability Major/Minor version number: 6.1
I ran the command:
clang++-9 --verbose --cuda-path=/usr/local/cuda-10.2 axpy.cu -o axpy --cuda-gpu-arch=sm_61 -L/usr/local/cuda-10.2 -lcudart_static -ldl -lrt -pthread
And the output is:
clang version 9.0.0-2~ubuntu18.04.1 (tags/RELEASE_900/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.4.0
Candidate multilib: .;#m64
Selected multilib: .;#m64
Found CUDA installation: /usr/local/cuda-10.2, version unknown
clang: error: cannot find libdevice for sm_61. Provide path to different CUDA installation via --cuda-path, or pass -nocudalib to build without linking with libdevice.
As far as I can tell, libdevice is right where it should be:
~>ls /usr/local/cuda-10.2/nvvm/libdevice/
libdevice.10.bc
What am I doing wrong ?
Added Nov 2020:
Following #ArtemB comment, I tried running it with clang++-10, which throws a warning, but compiles and runs just fine.
Short answer: The version of cuda my driver supports (10.2) is too current for my clang (9.0.0).
Here is the top of the output of nvidia-smi on my machine:
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 440.33.01 Driver Version: 440.33.01 CUDA Version: 10.2 |
So my driver indeed supports cuda-10.2. However, it seems this version is not supported by clang 9.0.0. Indeed when running the above command with the extra flag -nocudalib , one gets the following response (only showing the last lines):
In file included from <built-in>:1:
/usr/lib/llvm-9/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:52:2: error: "Unsupported CUDA version!"
#error "Unsupported CUDA version!"
^
axpy.cu:23:7: error: use of undeclared identifier cudaConfigureCall
axpy<<<1, kDataLen>>>(a, device_x, device_y);
^
2 errors generated when compiling for sm_61.
When inspecting the offending file (the clang cuda runtime wrapper), one sees the following in lines 48-53:
#include "cuda.h"
#if !defined(CUDA_VERSION)
#error "cuda.h did not define CUDA_VERSION"
#elif CUDA_VERSION < 7000 || CUDA_VERSION > 10010
#error "Unsupported CUDA version!"
#endif
Until recently clang was rather particular about CUDA versions. I've relaxed it a bit lately, so clang-10 is more lenient and will attempt to use a newer CUDA version at a feature parity with the latest supported CUDA version (currently 10.1). It will also issue a warning. It does work with CUDA-11.0 well enough to compile Tensorflow.
CUDA-11.1 (and I believe 11.0 update1 on windows) have dropped the version.txt file from the distribution and that will break CUDA compilation with the currently released clang versions, again. This should be fixed in clang-11.0.1 when it's released (version match with CUDA is purely coincidental).

Linker can't find 'get_int_member_with_default' from json-glib

I am currently working on a library that interacts with a REST API. This API responds with a JSON object, which I'm parsing with json-glib-1.0. As some of the members of the object might not exist I wanted to use the get_x_member_with_default function of the Json.Object class.
Even though both the Vala and the C compiler see the functions the linker gives me several errors:
Undefined symbols for architecture x86_64:
"_json_object_get_boolean_member_with_default", referenced from:
_discord_message_construct in message-f5c60f.o
"_json_object_get_int_member_with_default", referenced from:
_discord_message_construct in message-f5c60f.o
"_json_object_get_string_member_with_default", referenced from:
_discord_message_construct in message-f5c60f.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
To reproduce this you can try this code:
void main() {
string json = "{\"one\": 1337}";
Json.Parser parser = new Json.Parser();
parser.load_from_data(json, -1);
int64 val = parser.get_root().get_object().get_int_member_with_default("one", 666);
stdout.printf(#"$val\n");
}
and compile it with this command: valac --pkg json-glib-1.0 file.vala.
This gives me
Undefined symbols for architecture x86_64:
"_json_object_get_int_member_with_default", referenced from:
__vala_main in json2-ec99c2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This is obviously not a library; when compiling my library I only generate the C code and compile and link everything with the output of pkg-config --cflags --libs json-glib-1.0. Is there anything I have to link additionally?
You need to install a newer version of json-glib, or more likely, not use that symbol. The Vala documentation for the symbol shows this is since version 1.6 of the library. This information is taken from the C source for the library and the symbol was added with this commit. The problem is the latest stable release appears to be 1.4.4 - see the source repository tags. So it looks like you have to build your own development version with the latest symbols or not use get_int_member_with_default ().

Error compiling caffe on Mac OS

I compiled caffe successfully at first and tried the MNIST example. But there is something wrong when I tried to install pycaffe. So I reinstalled caffe. However I received compiling error this time.
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
make: *** [.build_release/lib/libcaffe.so.1.0.0] Error 1
After I input the command 'clang -v'
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I figured out it was the problem between two version of python. The system default version and the anaconda one. You have to make sure the compiling and executing using the same one.

opencv 3.1 wxwidgets cv::imwrite error

I am building a project using Opencv 3.1 and wxwidgets 3.1. The code I use:
[wxOpenCv Demo1]
I try to add a write frame object, using the function cv::imwrite().
(I changed the c calls to c++ eg: cvQueryFrame( m_pCapture ) to m_pCapture >> m_CurFrame;)
I get this error:
Undefined symbols for architecture x86_64:
"cv::imwrite(cv::String const&, cv::_InputArray const&,
std::vector > const&)", referenced from:
CCamera::SaveFrame() in camera.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Without wxwidgets the opencv functions work fine. So its seems that it has to do with the combination of wxwidgets and opencv.
This works fine with wxwidgets and Opencv:
cv::imshow("tmp",m_CurFrame);
cv::waitKey(4);
// cv::imwrite(Tmp , m_CurFrame);
If I uncomment the last line, I get the error.
OS X: 10 Yosemite and I use the default compiler (Apple LLVM 7.0)
I have no idea what to do about this!
solved the problem (and more) by recompiling wxwidgets 3.1.0 and Opencv 3.1. I used these links to get it going.
Small guide to compiling wxWidgets, Opencv against C++ 11:
Compile wxwidgets 3.1.0: I followed the install.txt for OSX. And tweaked the ../configure call with help from this
I added: --enable-debug and changed the macosx version
../configure --disable-shared --enable-debug --enable-unicode --with-cocoa --with-macosx-version-min=10.7 --with-macosx-sdk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk CXXFLAGS="-std=c++0x -stdlib=libc++" CPPFLAGS="-stdlib=libc++" LIBS=-lc++
Then with the help of this page I build a xcode project. Tweaking a few things:
(wxcocoa.xcodeproj and minimal.xcodeproj, and a all new projects)
Add to the Header Search Path: $(WXROOT)/build/osx (to find wx.xcconfig)
base SDK: latest OS X (10.11)
C language dialect: GNU 11(not sure if this is right)
C++ language dialect: GNU++11 [-std=gnu++11]
C++ Standard Library: libc++ (LLVM C++ standard library with C++ 11 support)
placed the WXROOT under “preference->locations->Source Trees. Not important, but seems to be a better location (restart xcode)
in wxcocoa.xcconfig I changed: MACOSX_DEPLOYMENT_TARGET = 10.10
Somehow I have to change the name of the created library from libwx_osx_cocoa_static.a to: lwx_osx_cocoa_static.a (why, I do not know)
I use GNU++ 11 and thus libc++ to be able to use new functionality like “future"
I then added OpenCV to my newly created wxXcode project:
Compile OpenCV following this: (search the web for: howto-install-build-and-use-opencv-macosx-10-10)
Make sure that the SDK is the right version (here was my biggest problem), matching the build of wxWidgets
The compiler settings same as for wxWidgets (see above)
(added:) To do this I added some lines to the CMakeLists.txt in the (Opencv-master folder). Below the line: # OpenCV compiler and linker options
(I found this trick here: search the web for: OpenCV with C++11 on OS X 10.8
message("Setting up Xcode for C++11 with libc++.")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD "c++0x")
set(CMAKE_XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
Then follow this page to update the newly created wxWidgets xcode project (search the web for: howto-setup-xcode-6-1-to-work-with-opencv-libraries)
This should do the trick! I can now combine wxWidgets, OpenCV and the libc++
(multithreading, “future")
I hope this helps.
Please let me know if you found out more!

Caffe compilation fails: Undefined symbols for architecture x86_64?

If I try building the newest version of Caffe, it leads to this error:
$ make all
CXX/LD -o .build_release/tools/caffe.bin
clang: warning: argument unused during compilation: '-pthread'
Undefined symbols for architecture x86_64:
"caffe::Net<float>::Forward(float*)", referenced from:
test() in caffe.o
time() in caffe.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [.build_release/tools/caffe.bin] Error 1
I'm building on osx, OpenBLAS, and CPU_ONLY. I found a kind of similar issue on here but it appears to have been a resolved issue, and I'm not getting the exact same error, though perhaps it's related? I can also build and run an older version of Caffe from a month ago, so I think something has changed very recently.
Any ideas on how to overcome this error?
It shows a link problem when compile.On osx this problem will happen usually.I guess the problem happened in Makefile.config.You can change to
# To customize your choice of compiler, uncomment and set the following.
# N.B. the default for Linux is g++ and the default for OSX is clang++
CUSTOM_CXX := g++
and confirm some path is correct.
I had exactly the same problem. Its now resolved.
Do check if you already have a libcaffe.so in your system library paths (maybe /usr/local/lib). If so, delete the existing libcaffe.so and build again.