pristineio / webrtc-build-scripts

A set of build scripts useful for building WebRTC libraries for Android and iOS.
BSD 3-Clause "New" or "Revised" License
1.13k stars 447 forks source link

link error while build my ndk code #152

Closed xiaopeifeng closed 8 years ago

xiaopeifeng commented 8 years ago

hi, there, firstly, I should say thanks so much that you scripts is so useful for me, i want to build the webrtc into arm version shared library, as you know, the libjingle_peerconnection_so.so has been sucessfully built, but when I build my code, some link errors occured, error info as follow:

/home/im/im-webrtc/im-webrtc/jni/../peerconnection_client.cpp:34: error: undefined reference to 'rtc::Thread::Current()' /home/im/im-webrtc/im-webrtc/jni/../peerconnection_client.cpp:36: error: undefined reference to 'rtc::SocketAddress::ipaddr() const' /home/im/im-webrtc/im-webrtc/jni/../peerconnection_client.cpp:39: error: undefined reference to 'rtc::SocketAddress::SetIP(std::string const&)' /home/im/im-webrtc/im-webrtc/jni/../peerconnection_client.cpp:40: error: undefined reference to 'rtc::SocketAddress::SetPort(int)' /home/im/im-webrtc/im-webrtc/jni/../callbackimpl.cpp:130: error: undefined reference to 'webrtc::CreateSessionDescription(std::string const&, std::string const&, webrtc::SdpParseError)' /home/im/im-webrtc/im-webrtc/jni/../callback_impl.cpp:143: error: undefined reference to 'webrtc::SessionDescriptionInterface::kOffer' /home/im/im-webrtc/im-webrtc/jni/../callbackimpl.cpp:167: error: undefined reference to 'webrtc::CreateIceCandidate(std::string const&, int, std::string const&, webrtc::SdpParseError)' /home/im/im-webrtc/im-webrtc/jni/../callback_impl.cpp:334: error: undefined reference to 'cricket::DeviceManagerFactory::Create()' /home/im/im-webrtc/im-webrtc/jni/../callback_impl.cpp:283: error: undefined reference to 'webrtc::MediaConstraintsInterface::kEnableDtlsSrtp' /home/im/im-webrtc/im-webrtc/jni/../callback_impl.cpp:245: error: undefined reference to 'webrtc::CreatePeerConnectionFactory()'

xiaopeifeng commented 8 years ago

another problem is that, how can i build the webrtc to static library?

ArikYa commented 8 years ago

Are you sure you're building the library to the same architecture as your application? Regarding static library, all the files are there as part of the build process. Search for all .a files

xiaopeifeng commented 8 years ago

yes, I am sure the architecture is the same, both are armeabi-v7a, I link the libjingle_peerconnection_so.so to my ndk code. and the compiler's path is webrtc_android/src/third_party/android_tools/ndk/ndk-build part of the function unlinked is libjingle_peerconnection.a 's content. while i try to link the libjingle_peerconnection.a, another new link problems occured as fellow: error: cannot open /home/im/im-webrtc/im-webrtc/jni/app/webrtc/libjingle_peerconnection.mediaconstraintsinterface.o

I can find all the .a file, but i don't know how to merge them to a static file under ubuntu. I try to use the command ar -x *.a , buf it failed. anyone can help? thanks so much.

jngd commented 8 years ago

@xiaopeifeng have you solved this issue? I have the same issue linking with libjingle_peerconnection but in this case with OSx application.