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

Cross-compilation on arm and mips devices #7

Open
cyadron opened this issue Aug 14, 2018 · 11 comments
Open

Cross-compilation on arm and mips devices #7

cyadron opened this issue Aug 14, 2018 · 11 comments

Comments

@cyadron
Copy link

cyadron commented Aug 14, 2018

Hello,

I have successfully cross-compiled microsocks on mips and also on arm devices.
On mips devices it works good so far.
But I have a strange issue when I tested on arm devices.
Some sites fail to load (like google.com, yahoo.com) with an error message (reported by proxifier) - Address type not supported.
But some sites load fine (except for elements from google.com domain) - like github.com
What could be the issue because this does not happen on mips devices?

@rofl0r
Copy link
Owner

rofl0r commented Aug 14, 2018

does it work when you add -fsigned-char to your CFLAGS ?

@cyadron
Copy link
Author

cyadron commented Aug 19, 2018

Unfortunately no.
Still no go.
I am getting other error also (with the original and the fsigned-char version).
Proxy server cannot establish a connection with the target - Network unreachable.
But some sites load fine.

@rofl0r
Copy link
Owner

rofl0r commented Aug 19, 2018

well from a C language PoV the only difference between x86 and ARM is that ARM defaults to char == unsigned char.
so i'd suspect that your issues are related to the specific ARM box you use - maybe some firewall rules, or a bad connection ?

@cyadron
Copy link
Author

cyadron commented Aug 21, 2018

I have tested another socks server on the same device and it loads the sites ok.
Any other idea?

@rofl0r
Copy link
Owner

rofl0r commented Aug 22, 2018

you could try this: #6 - increasing the stacksize

maybe for some reason the ARM implementation of GLIBC or whatever LIBC you use (which one is it?) wastes more RAM, and since google has a ton of DNS elements in its response it's sufficient to overwrite things and cause weird hickups.

@cyadron
Copy link
Author

cyadron commented Aug 28, 2018

Until now I was using release 0.1.0.
Now I am using the latest commit but I still have the problem.
I have tried to set size_t stacksz = 512 * 1024; but nothing changed.
The C library is uclibc.
And I do get the warning that this library sucks when I cross-compile it but no other warning/errors.
The error specified by proxifier is:

  • Proxy server cannot establish a connection with the target - Address type not supported.

and I get no other output/error on the arm machine where microsocks is running.
Could the uclibc library create this problem?

@cyadron
Copy link
Author

cyadron commented Aug 28, 2018

After more testing I find out that resolving hostnames through the socks server option causes problems.
If I use an external dns server the sites load fine.
I see that this is one difference between uclibc and glibc.
According to this paper:
https://mirrors.edge.kernel.org/pub/linux/libs/uclibc/Glibc_vs_uClibc_Differences.txt
uclibc does not support DNS resolution.
But since some sites load, I guess it is partially supported?

@rofl0r
Copy link
Owner

rofl0r commented Aug 29, 2018

yes, uclibc could be the culprit. i'd strongly suggest to use musl instead to build tiny static-linked binaries (build your own toolchain from the scripts in https://github.com/richfelker/musl-cross-make)

@cyadron
Copy link
Author

cyadron commented Mar 2, 2019

Hi,

I finally built microsocks using musl.
I have used the option for static-linked binaries and I was able to compile microsocks.
I ended up with a binary 3 times bigger (64 KB).
But the good news is that it works. Resolving hostnames finally works.
So this workaround is good but I guess there is no way to make it work with the default compiler?

@rofl0r
Copy link
Owner

rofl0r commented Mar 2, 2019

hi, if you want a smaller binary you can try use the following flags in config.mak:

CFLAGS = -Os -flto
LDFLAGS = -s -flto

as for making it work with your uclibc toolchain: did you try latest git ? some bugs have been fixed since you opened your issue.

@hdbreaker
Copy link

Hi @cyadron could you explain to me the steps to cross-compile the project to mipsle32?

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