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

Some application on Mac OS X 12.3.1 M1 can't be used with 4.16 #451

Closed
ldzhjn opened this issue May 17, 2022 · 4 comments
Closed

Some application on Mac OS X 12.3.1 M1 can't be used with 4.16 #451

ldzhjn opened this issue May 17, 2022 · 4 comments

Comments

@ldzhjn
Copy link

ldzhjn commented May 17, 2022

When I try to list the topics from a Kafka cluster using the following shell wrapped java application, it throws exception.
proxychains4 ~/Downloads/kafka_2.11-2.3.0/bin/kafka-topics.sh --list --bootstrap-server server:port

[proxychains] config file found: /opt/homebrew/etc/proxychains.conf
[proxychains] preloading /opt/homebrew/Cellar/proxychains-ng/4.16/lib/libproxychains4.dylib
[2022-05-17 08:28:16,061] WARN Couldn't resolve server server:port from bootstrap.servers as DNS resolution failed for server:port (org.apache.kafka.clients.ClientUtils)
Exception in thread "main" org.apache.kafka.common.KafkaException: Failed to create new KafkaAdminClient
at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:407)
at org.apache.kafka.clients.admin.AdminClient.create(AdminClient.java:55)
at kafka.admin.TopicCommand$AdminClientTopicService$.createAdminClient(TopicCommand.scala:165)
at kafka.admin.TopicCommand$AdminClientTopicService$.apply(TopicCommand.scala:169)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:55)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
Caused by: org.apache.kafka.common.config.ConfigException: No resolvable bootstrap urls given in bootstrap.servers
at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:88)
at org.apache.kafka.clients.ClientUtils.parseAndValidateAddresses(ClientUtils.java:47)
at org.apache.kafka.clients.admin.KafkaAdminClient.createInternal(KafkaAdminClient.java:367)

But this same command works on Intel CPU Mac OS X 12.3.1 with 4.16.

https://github.com/apache/kafka/blob/trunk/bin/kafka-topics.sh

@ldzhjn ldzhjn changed the title Some application on Mac OS X 12.3.1 can't be used with 4.16 Some application on Mac OS X 12.3.1 M1 can't be used with 4.16 May 17, 2022
@rofl0r
Copy link
Owner

rofl0r commented May 17, 2022

please paste config.mak that's generated after running configure on both archs (and make sure to build and test master on each)

@ldzhjn
Copy link
Author

ldzhjn commented May 17, 2022

Works for curl after following these two tickets
#78 (comment)
#433 (comment)

But the kafka client still throws exception
dyld[15246]: terminating because inserted dylib '/usr/local/lib/libproxychains4.dylib' could not be loaded: tried: '/usr/local/lib/libproxychains4.dylib' (mach-o file, but is an incompatible architecture (have 'arm64e', need 'x86_64')), '/usr/lib/libproxychains4.dylib' (no such file)
dyld[15246]: tried: '/usr/local/lib/libproxychains4.dylib' (mach-o file, but is an incompatible architecture (have 'arm64e', need 'x86_64')), '/usr/lib/libproxychains4.dylib' (no such file)

Here's the contents of config.mak on M1
CC=cc
USER_CFLAGS=-arch arm64
USER_LDFLAGS=-arch arm64
prefix=/usr/local
exec_prefix=/usr/local
bindir=/usr/local/bin
libdir=/usr/local/lib
includedir=/usr/local/include
sysconfdir=/usr/local/etc
CPPFLAGS+= -DSUPER_SECURE
CPPFLAGS+= -DGN_NODELEN_T=socklen_t -DGN_SERVLEN_T=socklen_t -DGN_FLAGS_T=int -DHAVE_CLOCK_GETTIME
NO_AS_NEEDED=
LD_SET_SONAME = -Wl,-install_name,
LIBDL = -ldl
PTHREAD = -lpthread
LDSO_SUFFIX=dylib
MAC_CFLAGS+=-DIS_MAC=1
CFLAGS+=-DMONTEREY_HOOKING

@ldzhjn ldzhjn closed this as completed May 17, 2022
@ldzhjn ldzhjn reopened this May 18, 2022
@rofl0r
Copy link
Owner

rofl0r commented May 18, 2022

have 'arm64e', need 'x86_64'

this is the reason. your "kafka" binary is compiled for intel and executed via rosetta binary translation. therefore arm64e proxychains cant be injected.

2 solutions exist:

  • get a kafka version compiled for m1
  • make a fat binary for x86_64 and arm64e: it should work like this: CFLAGS="-arch x86_64 -arch=arm64e" LDFLAGS="-arch x86_64 -arch=arm64e" ./configure

@ldzhjn
Copy link
Author

ldzhjn commented May 19, 2022

have 'arm64e', need 'x86_64'

this is the reason. your "kafka" binary is compiled for intel and executed via rosetta binary translation. therefore arm64e proxychains cant be injected.

2 solutions exist:

  • get a kafka version compiled for m1
  • make a fat binary for x86_64 and arm64e: it should work like this: CFLAGS="-arch x86_64 -arch=arm64e" LDFLAGS="-arch x86_64 -arch=arm64e" ./configure

Tried both solutions, both worked.

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

2 participants