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

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 ().

Related

Linker Command Failing - Undefined symbols for architecture armv7

I am trying to install the Google Maps Utils plugin via cocoapods so I can utilize the clustering functionality. I have followed the setup guide provided by google step by step however I am getting a build error during the linking process.
The error I get is:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_POIItem", referenced from:
objc-class-ref in MainViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Does anyone have a solution to this? I have tried just about everything I could find on the web.
Thanks in advance!
EDIT:
I have defined the POIItem as follows:
#import "ViewController.h"
#import <Google-Maps-iOS-Utils/GMUMarkerClustering.h>
#import <GoogleMaps/GoogleMaps.h>
// Point of Interest Item which implements the GMUClusterItem
protocol.
#interface POIItem : NSObject<GMUClusterItem>
#property(nonatomic, readonly) CLLocationCoordinate2D position;
#property(nonatomic, readonly) NSString *name;
- (instancetype)initWithPosition:(CLLocationCoordinate2D)position name:(NSString *)name;
#end
and here is a link to the set up guide I followed: Google Guide

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.

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.

Using AFNetworking 2.0+ on OS X 10.8

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

Connecting MYSQL using C program in Eclipse

I am connecting the Mysql using c program in eclipse, I am using CYGWIN compiler to compile program. I have installed the mysql c connector and added the include files to the compiler and linker
but i am getting error
**** Build of configuration Debug for project DbConnectionC ****
make all
Building file: ../connection.c
Invoking: Cygwin C Compiler
gcc -I"C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include" -include"C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\include\mysql.h" -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"connection.d" -MT"connection.d" -o "connection.o" "../connection.c"
cygwin warning:
MS-DOS style path detected: D:\java\workspace\DbConnectionC\Debug
Preferred POSIX equivalent is: /cygdrive/d/java/workspace/DbConnectionC/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
../connection.c: In function `main':
../connection.c:57: warning: char format, different type arg (arg 2)
../connection.c:57: warning: char format, different type arg (arg 2)
../connection.c:61: warning: char format, different type arg (arg 2)
../connection.c:61: warning: char format, different type arg (arg 2)
Finished building: ../connection.c
Building target: DbConnectionC.exe
Invoking: Cygwin C Linker
gcc -L"C:\Program Files (x86)\MySQL\MySQL Connector C 6.0.2\lib\opt" -o "DbConnectionC.exe" ./connection.o -llibmysql.lib -lmysqlclient.lib
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibmysql.lib
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lmysqlclient.lib
collect2: ld returned 1 exit status
make: *** [DbConnectionC.exe] Error 1
makefile:29: recipe for target `DbConnectionC.exe' failed
**** Build Finished ****
Please help me on this
thanks in advance
In the first part you have some warnings about possible problems:
../connection.c:39: warning: implicit declaration of function `exit'
This means function exit() is not declared, your source needs an #include <stdlib.h>
../connection.c:46: warning: control reaches end of non-void function
You don't return a value at the end of main(), add a return 0; if the program succeeds.
In the second part are linker warnings:
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -llibmysql.lib
/usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lmysqlclient.lib
which means the linker needs a path to the libraries or the libraries do not exist or the library names are misspelled.
One possible solution is using -lmysql -lmysqlclient instead of -llibmysql.lib -lmysqlclient.lib, but I'm not that familiar with Windows.
Having said that, I suggest strongly, you look at https://stackoverflow.com/tags/c/info and look at some book links.