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

mips/mipsel support #10

Open
hook-s3c opened this issue Mar 28, 2019 · 4 comments
Open

mips/mipsel support #10

hook-s3c opened this issue Mar 28, 2019 · 4 comments

Comments

@hook-s3c
Copy link

Hi,

Just been playing around trying to get a mips build to work from a cross-compiled from x86 vua a musl buildchain tooling - arm/armel static builds work great this way.

I'm using the tools found on http://musl.cc/

  • mipsel-linux-musl-cross.tgz
  • mips-linux-musl-cross.tgz

I seem to be getting some errors thrown from libevent and wondered if there was a way to quick-hack this?

So I try;

CC=mips-linux-musl-gcc CXX=mips-linux-musl-g++ CGO_ENABLED=1 GOOS=linux GOARCH=mips go build -a -ldflags '-w -extldflags "-static"' -v

and this fails;

In file included from libtor/../libevent/include/event2/event.h:202,
                 from libtor/../libevent/compat/../buffer.c:85,
                 from libtor/libevent_buffer.go:8:
libtor/../libevent/include/event2/util.h:129:2: error: #error "No way to define ev_uint64_t"
 #error "No way to define ev_uint64_t"
  ^~~~~
libtor/../libevent/include/event2/util.h:148:2: error: #error "No way to define ev_uint32_t"
 #error "No way to define ev_uint32_t"
  ^~~~~
libtor/../libevent/include/event2/util.h:167:2: error: #error "No way to define ev_uint16_t"
 #error "No way to define ev_uint16_t"
  ^~~~~
libtor/../libevent/include/event2/util.h:283:2: error: #error "No way to define SIZE_MAX"

Any ideas? C is not my forte, but it looks like a default catch-all on an elseif.

I've had help building tor for mips before, so I know it's possible - would just be cool to get this CGO version working!

@hook-s3c
Copy link
Author

hook-s3c commented Mar 28, 2019

Hi,

So I went through and found libevent_config/event2/event-config.h

I dropped this at the bottom;

#define EVENT__HAVE_UINT64_T 0
#define EVENT__HAVE_UINT32_T 1
#define EVENT__HAVE_UINT16_T 1
#define EVENT__SIZEOF_SIZE_T 4
#define EVENT__SIZEOF_LONG 8
#define EVENT__SIZEOF_LONG_LONG 1

Seemed to get past the above errors, although I'm not really sure if the size values are correct.

Then I ran in to this;

# github.com/ipsn/go-libtor/libtor
In file included from libtor/openssl_crypto_bio_bss_dgram.go:10:
libtor/../openssl/include/../crypto/bio/bss_dgram.c:17:12: fatal error: netinet/sctp.h: No such file or directory
 #  include <netinet/sctp.h>
            ^~~~~~~~~~~~~~~~
compilation terminated.

@hook-s3c
Copy link
Author

hook-s3c commented Mar 28, 2019

So I searched my system for sctp.h and found it on /usr/include/netinet/sctp.h

-# include <netinet/sctp.h>
+# include </usr/include/netinet/sctp.h>

in openssl/crypto/bio/bss_dgram.c

I'm not proud, but it got me a little further...

# github.com/ipsn/go-libtor/libtor
In file included from libtor/openssl_crypto_bn_bn_dh.go:10:
libtor/../openssl/include/../crypto/bn/bn_dh.c:479:4: error: #error "unsupported BN_BITS2"
 #  error "unsupported BN_BITS2"
    ^~~~~

# error "unsupported BN_BITS2"

@hook-s3c hook-s3c mentioned this issue Mar 28, 2019
@hook-s3c
Copy link
Author

I tried to hack some C, but it's not going to work out - maybe you have a better idea of what's needed.
I can help with testing, just let me know!

@karalabe
Copy link
Member

Just saw this issue. So, the way I've been generating the correct constants is to manually build all the dependencies on the target hardware and then see what values the local make process generates. Then incorporate those into the pre-configured templates.

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