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

Can't compile Windows executables on Ubuntu 22.04 #203

Open
andrasfuchs opened this issue Apr 27, 2022 · 2 comments
Open

Can't compile Windows executables on Ubuntu 22.04 #203

andrasfuchs opened this issue Apr 27, 2022 · 2 comments

Comments

@andrasfuchs
Copy link

I tried to compile the CJDNS source for Windows on Ubuntu with the following commands:

sudo apt-get install mingw-w64 build-essential nodejs git

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

git clone https://github.com/cjdelisle/cjdns.git
cd cjdns

SYSTEM=win32 CROSS_COMPILE=i686-w64-mingw32- ./cross-do

I got back this:

Using i686-w64-mingw32-gcc (GCC) 10-win32 20220113 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiler CC: i686-w64-mingw32-gcc
Compiler CFLAGS:
Compiler LDFLAGS:
   Compiling libsodium-sys v0.2.6 (https://github.com/cjdelisle/sodiumoxide?branch=cjdns#3aa7e8e2)
   Compiling cjdns_sys v0.1.0 (/home/andras/cjdns/rust/cjdns_sys)
error: failed to run custom build command for `cjdns_sys v0.1.0 (/home/andras/cjdns/rust/cjdns_sys)`

Caused by:
  process didn't exit successfully: `/home/andras/cjdns/target/release/build/cjdns_sys-6dbc8e88e4cae3eb/build-script-build` (exit status: 1)
  --- stdout
  Initialize 3ms
  testing python python3.7
  error starting python Error: spawn python3.7 ENOENT
  testing python python3
  sys.version_info(major=3, minor=10, micro=4, releaselevel='final', serial=0)

  Build Libuv
  Total build time: 174ms.

  --- stderr
  /home/andras/cjdns/node_build/CjdnsTest.js:36
          if (err) { throw err; }
                     ^

  Error: ENOENT: no such file or directory, stat './node_linux/nodejs/node/include/node/openssl/archs/BSD-x86'
      at Error (native)
  Error: Failed to build cjdns
  Traceback (most recent call last):
    File "/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/./gyp_uv.py", line 14, in <module>
      import gyp
    File "/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/build/gyp/pylib/gyp/__init__.py", line 10, in <module>
      import gyp.input
    File "/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/build/gyp/pylib/gyp/input.py", line 8, in <module>
      import gyp.common
    File "/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/build/gyp/pylib/gyp/common.py", line 497, in <module>
      class OrderedSet(collections.MutableSet):
  AttributeError: module 'collections' has no attribute 'MutableSet'
warning: build failed, waiting for other jobs to finish...
error: build failed

I don't completely understand the error, it might be because of a breaking change between Python 3.9 and 3.10?
I have Python 3.10 installed on WSL Ubuntu 22.04.

@andrasfuchs andrasfuchs changed the title Can't compile on Ubuntu - AttributeError: module 'collections' has no attribute 'MutableSet' Can't compile on Ubuntu 22.04 - AttributeError: module 'collections' has no attribute 'MutableSet' Apr 27, 2022
@andrasfuchs
Copy link
Author

I managed to install Python 3.7 with these commands:

sudo apt install software-properties-common -y

sudo add-apt-repository ppa:deadsnakes/ppa -y

sudo apt update

sudo apt-get install mingw-w64 build-essential nodejs git python3.7

ls /usr/bin/python* -l

sudo ln -vfns /usr/bin/python3.7 /usr/bin/python3

When I run SYSTEM=win32 CROSS_COMPILE=i686-w64-mingw32- ./cross-do again, I got a different error:

Using i686-w64-mingw32-gcc (GCC) 10-win32 20220113 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Compiler CC: i686-w64-mingw32-gcc
Compiler CFLAGS:
Compiler LDFLAGS:
   Compiling libsodium-sys v0.2.6 (https://github.com/cjdelisle/sodiumoxide?branch=cjdns#3aa7e8e2)
   Compiling cjdns_sys v0.1.0 (/home/andras/cjdns/rust/cjdns_sys)
error: failed to run custom build command for `cjdns_sys v0.1.0 (/home/andras/cjdns/rust/cjdns_sys)`

Caused by:
  process didn't exit successfully: `/home/andras/cjdns/target/release/build/cjdns_sys-6dbc8e88e4cae3eb/build-script-build` (exit status: 1)
  --- stdout
  Initialize 3ms
  testing python python3.7
  sys.version_info(major=3, minor=7, micro=13, releaselevel='final', serial=0)

  Build Libuv
  Total build time: 112ms.
  ['-DOS=win', '-f', 'make-linux', '/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/uv.gyp', '-I', '/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/common.gypi', '--depth=.', '-Goutput_dir=/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/out', '--generator-output', '/home/andras/cjdns/target/release/build/cjdns_sys-3ae9253361d09334/out/dependencies/libuv/out', '-Dhost_arch=x64', '-Dtarget_arch=x64', '-Dlibrary=static_library', '-Dcomponent=static_library']

  --- stderr
  /home/andras/cjdns/node_build/CjdnsTest.js:36
          if (err) { throw err; }
                     ^

  Error: ENOENT: no such file or directory, stat './node_linux/nodejs/node/include/node/libplatform/libplatform.h'
      at Error (native)
  Error: Failed to build cjdns
warning: build failed, waiting for other jobs to finish...
error: build failed

Interestingly nano ./node_linux/nodejs/node/include/node/libplatform/libplatform.h could open that file without any problems.

@andrasfuchs
Copy link
Author

After the steps above I could build the Windows executables using ./windows_do.

In order to use these files on Windows you must also get the libssp-0.dll from the LLVM based mingw-w64 toolchain repo.

It would be great to update the CJDNS Windows documentation based on these results.

@andrasfuchs andrasfuchs changed the title Can't compile on Ubuntu 22.04 - AttributeError: module 'collections' has no attribute 'MutableSet' Can't compile Windows executables on Ubuntu 22.04 Apr 27, 2022
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

1 participant