strophe / libstrophe

A simple, lightweight C library for writing XMPP clients
http://strophe.im/libstrophe
Other
401 stars 163 forks source link

Undefined symbol: _xmpp_vsnprintf _xmpp_snprintf when compiling for arm64 #173

Closed sbourji closed 1 year ago

sbourji commented 3 years ago

after upgrading from 0.9.3 to 0.10.1 unable to compile and link Undefined symbols for architecture arm64: "_xmpp_vsnprintf", referenced from: _xmpp_send_raw_string in conn.o "_xmpp_snprintf", referenced from: _sasl_scram in sasl.o _resolver_srv_lookup in resolver.o _digest_to_string in crypto.o __conn_sm_handle_stanza in conn.o handle_component_auth in auth.o make_scram_init_msg in auth.o _handle_stream_management in auth.o ... ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

sbourji commented 3 years ago

AC_CHECK_FUNCS([snprintf vsnprintf]) in Makefile.ac resolved the issue. Why?

pasis commented 3 years ago

libstrophe implements xmpp_snprintf() for old systems that don't have it. But it is better to use system snprintf() where it exists. Before 0.10 libstrophe always used own implementation and xmpp_snprintf() was a function. Starting from 0.10, xmpp_snprintf is a macro when your system has snprintf():

#ifdef HAVE_SNPRINTF
#define xmpp_snprintf snprintf
#else
int xmpp_snprintf(char *str, size_t count, const char *fmt, ...);
#endif

What's your OS and clang version? I didn't have this issue on RPi board with gcc.

sbourji commented 3 years ago

iOS 13.0 clang 12.0.0 Gcc /Applications/Xcode.app/Contents/Developer/Platform/MacOSX.ask/use/include/c++/4.2.1

Sent from my iPhone

On Jan 12, 2021, at 6:05 AM, Dmitry Podgorny notifications@github.com wrote:



libstrophe implements xmpp_snprintf() for old systems that don't have it. But it is better to use system snprintf() where it exists. Before 0.10 libstrophe always used own implementation and xmpp_snprintf() was a function. Starting from 0.10, xmpp_snprintf is a macro when your system has snprintf():

ifdef HAVE_SNPRINTF

define xmpp_snprintf snprintf

else

int xmpp_snprintf(char str, size_t count, const char fmt, ...);

endif

What's your OS and clang version? I didn't have this issue on RPi board with gcc.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/strophe/libstrophe/issues/173#issuecomment-758582172, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC364XJNCT4VMZUIJ5EGA2TSZQUHNANCNFSM4V4MP3QA.

sbourji commented 3 years ago

So have you found anything new. I have sent you the information your requested, and have not heard from you yet!

Sent from my iPhone

On Jan 12, 2021, at 6:05 AM, Dmitry Podgorny notifications@github.com wrote:



libstrophe implements xmpp_snprintf() for old systems that don't have it. But it is better to use system snprintf() where it exists. Before 0.10 libstrophe always used own implementation and xmpp_snprintf() was a function. Starting from 0.10, xmpp_snprintf is a macro when your system has snprintf():

ifdef HAVE_SNPRINTF

define xmpp_snprintf snprintf

else

int xmpp_snprintf(char str, size_t count, const char fmt, ...);

endif

What's your OS and clang version? I didn't have this issue on RPi board with gcc.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/strophe/libstrophe/issues/173#issuecomment-758582172, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC364XJNCT4VMZUIJ5EGA2TSZQUHNANCNFSM4V4MP3QA.

pasis commented 3 years ago

I have checked on macos (not iOS) with the same clang version and it builds without issues. It looks to me that the issue is with build system. For some reason all object files were compiled without HAVE_SNPRINTF, but snprintf.o with HAVE_SNPRINTF. I don't see issues in the code.

sbourji commented 3 years ago

So you did not compile it for iOS?

Sent from my iPhone

On Feb 4, 2021, at 5:14 AM, Dmitry Podgorny notifications@github.com wrote:



I have checked on macos (not iOS) with the same clang version and it builds without issues. It looks to me that the issue is with build system. For some reason all object files were compiled without HAVE_SNPRINTF, but snprintf.o with HAVE_SNPRINTF. I don't see issues in the code.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/strophe/libstrophe/issues/173#issuecomment-773193556, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AC364XNU63IKHYBH3JCZRDLS5JXPLANCNFSM4V4MP3QA.

sjaeckel commented 1 year ago

I'm closing this as there was no action for too long. Please re-open if you have further questions/comments.