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 compile for Windows using x86_64-w64-mingw64 #632

Open
JlnWntr opened this issue Aug 18, 2021 · 5 comments
Open

Cross compile for Windows using x86_64-w64-mingw64 #632

JlnWntr opened this issue Aug 18, 2021 · 5 comments

Comments

@JlnWntr
Copy link
Contributor

JlnWntr commented Aug 18, 2021

I tried to CC="x86_64-w64-mingw32-gcc" ./configure --host=x86_64-w64-mingw64 on a Ubuntu subystem and make gave me

Making all in usrsctplib
make[1]: Entering directory '/mnt/c/git/usrsctp/usrsctplib'
/bin/bash ../libtool  --tag=CC   --mode=compile x86_64-w64-mingw32-gcc -DPACKAGE_NAME=\"libusrsctp\" -DPACKAGE_TARNAME=\"libusrsctp\" -DPACKAGE_VERSION=\"0.9.5.0\" -DPACKAGE_STRING=\"libusrsctp\ 0.9.5.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libusrsctp\" -DVERSION=\"0.9.5.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -DSCTP_DEBUG=1 -DINET=1 -DINET6=1 -DHAVE_STDATOMIC_H=1 -Dsocklen_t=int -I.    -DSCTP_PROCESS_LEVEL_LOCKS -DSCTP_SIMPLE_ALLOCATOR -D__Userspace__ -g -O2 -std=c99 -pthread -D_GNU_SOURCE -Wno-address-of-packed-member -pedantic -Wall -Werror -g -O0 -MT netinet/libusrsctp_la-sctp_cc_functions.lo -MD -MP -MF netinet/.deps/libusrsctp_la-sctp_cc_functions.Tpo -c -o netinet/libusrsctp_la-sctp_cc_functions.lo `test -f 'netinet/sctp_cc_functions.c' || echo './'`netinet/sctp_cc_functions.c
libtool: compile:  x86_64-w64-mingw32-gcc -DPACKAGE_NAME=\"libusrsctp\" -DPACKAGE_TARNAME=\"libusrsctp\" -DPACKAGE_VERSION=\"0.9.5.0\" "-DPACKAGE_STRING=\"libusrsctp 0.9.5.0\"" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"libusrsctp\" -DVERSION=\"0.9.5.0\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -DSCTP_DEBUG=1 -DINET=1 -DINET6=1 -DHAVE_STDATOMIC_H=1 -Dsocklen_t=int -I. -DSCTP_PROCESS_LEVEL_LOCKS -DSCTP_SIMPLE_ALLOCATOR -D__Userspace__ -g -O2 -std=c99 -pthread -D_GNU_SOURCE -Wno-address-of-packed-member -pedantic -Wall -Werror -g -O0 -MT netinet/libusrsctp_la-sctp_cc_functions.lo -MD -MP -MF netinet/.deps/libusrsctp_la-sctp_cc_functions.Tpo -c netinet/sctp_cc_functions.c  -fPIC -DPIC -o netinet/.libs/libusrsctp_la-sctp_cc_functions.o
<command-line>: error: two or more data types in declaration specifiers
make[1]: *** [Makefile:694: netinet/libusrsctp_la-sctp_cc_functions.lo] Error 1
make[1]: Leaving directory '/mnt/c/git/usrsctp/usrsctplib'
make: *** [Makefile:410: all-recursive] Error 1

Am I doing this right? :)

@tuexen
Copy link
Member

tuexen commented Aug 18, 2021

No idea, since I have no experience with Windows based systems including cross compiling for it... Can't you compile it natively on Windows?

@weinrank
Copy link
Contributor

Give CMAKE a try... :)

@JlnWntr
Copy link
Contributor Author

JlnWntr commented Aug 25, 2021

Give CMAKE a try

I believe you have to know cmake in order to do that. (And that's an entirely different chore.)
How do you tell cmake to use mingw or crosscompile for windows?

$ CC="x86_64-w64-mingw32-gcc" cmake ../usrsctp/ throws this error:

The C compiler

    "/usr/bin/x86_64-w64-mingw32-gcc"

  is not able to compile a simple test program.

Which is odd, since I've already compiled other libraries using mingw.

@tuexen : The possibility to crosscompile usrsctp is in my opinion really interesting combined with the idea that it is advertised to be portable. (Which it is.)

@tuexen
Copy link
Member

tuexen commented Aug 25, 2021

Give CMAKE a try

I believe you have to know cmake in order to do that. (And that's an entirely different chore.)
How do you tell cmake to use mingw or crosscompile for windows?

$ CC="x86_64-w64-mingw32-gcc" cmake ../usrsctp/ throws this error:

The C compiler

    "/usr/bin/x86_64-w64-mingw32-gcc"

  is not able to compile a simple test program.

No idea. I'm always referring to @weinrank for any cmake related question...

Which is odd, since I've already compiled other libraries using mingw.

@tuexen : The possibility to crosscompile usrsctp is in my opinion really interesting combined with the idea that it is advertised to be portable. (Which it is.)

I agree, but I have never done it...

@lgrahl
Copy link
Contributor

lgrahl commented Aug 25, 2021

Not touching CMake with a ten foot pole but I regularly built usrsctp for Windows as a Meson subproject via Dockcross in a CI environment, so it's definitely possible: https://github.com/rawrtc/ci-image/tree/cross/windows-x64

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

4 participants