Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't seem to work on osx. #1

Open
vito-c opened this issue Jul 15, 2013 · 6 comments
Open

Doesn't seem to work on osx. #1

vito-c opened this issue Jul 15, 2013 · 6 comments

Comments

@vito-c
Copy link

vito-c commented Jul 15, 2013

does this work on osx?

make
cc -Wl,-rpath -Wl,. -o libjson2pb.so json2pb.o -Wl,-soname=libjson2pb.so -Wl,-h -Wl,libjson2pb.so -shared -L. -lcurl -lprotobuf -lstdc++ -ljansson
ld: unknown option: -soname=libjson2pb.so
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libjson2pb.so] Error 1

clang -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

jansson 2.4 is installed here in my /usr/local area ... i do see the json2pb.o so that might just mean it's failing on the unix

@mhaberler
Copy link

Am 16.07.2013 um 01:58 schrieb vito-c notifications@github.com:

does this work on osx?

make
cc -Wl,-rpath -Wl,. -o libjson2pb.so json2pb.o -Wl,-soname=libjson2pb.so -Wl,-h -Wl,libjson2pb.so -shared -L. -lcurl -lprotobuf -lstdc++ -ljansson
ld: unknown option: -soname=libjson2pb.so
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libjson2pb.so] Error 1

clang -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

jansson 2.4 is installed here in my /usr/local area ... i do see the json2pb.o so that might just mean it's failing on the unix


Reply to this email directly or view it on GitHub.

well try this, without the arguments you cant see what failed:

cc -v -Wl,-rpath -Wl,. -o libjson2pb.so json2pb.o -Wl,-soname=libjson2pb.so -Wl,-h -Wl,libjson2pb.so -shared -L. -lcurl -lprotobuf -lstdc++ -ljansson
-----^

very likely its the different naming scheme for shared libs on osx, .dynload or so - the Apple docs and related examples should help

-m

@vito-c
Copy link
Author

vito-c commented Jul 16, 2013

ok I'm working on adding osx compatibility in my fork and send you a pull request :)
Currently I'm seeing this error:

make: *** No rule to make target -lprotobuf', needed bytest_json'. Stop.

So it's a little unlcear what this is supposed to do:
https://github.com/shramov/json2pb/blob/master/Makefile#L9

What command is supposed to be run by the test_json target? Thanks!

@mhaberler
Copy link

Am 16.07.2013 um 04:00 schrieb vito-c notifications@github.com:

ok I'm working on adding osx compatibility in my fork and send you a pull request :)
Currently I'm seeing this error:

make: *** No rule to make target -lprotobuf', needed bytest_json'. Stop.

So it's a little unlcear what this is supposed to do:
https://github.com/shramov/json2pb/blob/master/Makefile#L9

yeah, that -lprotobuf should be replace by the full pathname to the protobuf library, looks like a mistake

but those are generic Makefile issues

What command is supposed to be run by the test_json target? Thanks!


Reply to this email directly or view it on GitHub.

@vito-c
Copy link
Author

vito-c commented Jul 16, 2013

took a little bit more mucking with but i got it working thanks for the quick responses and help :) Can you pull it down and run on nix to make sure I didn't completely foo bar it on nix too?

@cugarteblair
Copy link

@vito-c What was the solution? I have the same problem. I substituted the full path (/usr/local/lib) for -lprotobuf and that did not help?

@cugarteblair
Copy link

all: libjson2pb.so test_json

clean:
-rm -f .o *.so *.a libjson2pb.so. test .pb.cc *.pb.h test_json

test_json: test.pb.o libjson2pb.so test_json.o
$(CC) $^ $(LDFLAGS) -o $@

test_json.o: test.pb.h

json2pb.o: bin2ascii.h

libjson2pb.so: json2pb.o
$(CC) $(LDFLAGS) -o $@ -shared -L. -lcurl -lprotobuf -lstdc++ -ljansson $^

test.pb.h test.pb.cc: test.proto
protoc --cpp_out=$(shell pwd) test.proto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants