emscripten-core / emsdk

Emscripten SDK
http://emscripten.org
Other
2.92k stars 662 forks source link

Build error due to connection refused #1335

Closed sunlin0oo closed 5 months ago

sunlin0oo commented 5 months ago

Clone a project from document, when I try to compile, I get the following error message:

ports:INFO: retrieving port: freetype from https://github.com/emscripten-ports/FreeType/archive/version_1.zip
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 203, in _new_conn
    sock = connection.create_connection(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py", line 85, in create_connection
    raise err
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/connection.py", line 73, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 790, in urlopen
    response = self._make_request(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 491, in _make_request
    raise new_e
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 467, in _make_request
    self._validate_conn(conn)
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 1096, in _validate_conn
    conn.connect()
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 611, in connect
    self.sock = sock = self._new_conn()
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connection.py", line 218, in _new_conn
    raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7f4eb8b83fa0>: Failed to establish a new connection: [Errno 111] Connection refused

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/requests/adapters.py", line 486, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/connectionpool.py", line 844, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/dist-packages/urllib3/util/retry.py", line 515, in increment
    raise MaxRetryError(_pool, url, reason) from reason  # type: ignore[arg-type]
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /emscripten-ports/FreeType/archive/version_1.zip (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f4eb8b83fa0>: Failed to establish a new connection: [Errno 111] Connection refused'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/emsdk/upstream/emscripten/emcc.py", line 4084, in <module>
    sys.exit(main(sys.argv))
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/emsdk/upstream/emscripten/emcc.py", line 4077, in main
    ret = run(args)
  File "/emsdk/upstream/emscripten/emcc.py", line 1194, in run
    phase_calculate_system_libraries(state, linker_arguments, linker_inputs, newargs)
  File "/usr/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/emsdk/upstream/emscripten/emcc.py", line 2795, in phase_calculate_system_libraries
    extra_files_to_link += ports.get_libs(settings)
  File "/emsdk/upstream/emscripten/tools/ports/__init__.py", line 342, in get_libs
    ret += [f for f in port.get(Ports, settings, shared) if not f.endswith('.txt')]
  File "/emsdk/upstream/emscripten/tools/ports/freetype.py", line 19, in get
    ports.fetch_project('freetype', 'https://github.com/emscripten-ports/FreeType/archive/' + TAG + '.zip', 'FreeType-' + TAG, sha512hash=HASH)
  File "/emsdk/upstream/emscripten/tools/ports/__init__.py", line 258, in fetch_project
    retrieve()
  File "/emsdk/upstream/emscripten/tools/ports/__init__.py", line 213, in retrieve
    response = requests.get(url,verify=False)
  File "/usr/local/lib/python3.8/dist-packages/requests/api.py", line 73, in get
    return request("get", url, params=params, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/dist-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /emscripten-ports/FreeType/archive/version_1.zip (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f4eb8b83fa0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Traceback (most recent call last):
  File "/opencascade.js/src/buildFromYaml.py", line 129, in <module>
    runBuild(buildConfig["mainBuild"])
  File "/opencascade.js/src/buildFromYaml.py", line 120, in runBuild
    subprocess.check_call([
  File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)

What have I done to resolve this issue? Thanks for your reply!

sbc100 commented 5 months ago

That looks like problem with github.com or your internet connection to it. Can you check your connection to github and try again?

If it continues to fail can you try running wget https://github.com/emscripten-ports/FreeType/archive/version_1.zip just to be sure you can actually fetch that file?

sunlin0oo commented 5 months ago

Thank you for your prompt reply! As you said, I can't connect to github normally. I modified the download address and placed it on my local server, and it was able to be downloaded, but there was a problem with the Hash verification. emcc: error: Unexpected hash: bb2338c9dadd5b6233d7a442eca992e585c012e71643471f0c9691ac12df159dc837c21dafa38fb5f908ed4be11c4b0e04a78108b5229551407ccd9e054f026b If you are updating the port, please update the hash. Traceback (most recent call last): File "/opencascade.js/src/buildFromYaml.py", line 128, in <module> runBuild(buildConfig["mainBuild"]) File "/opencascade.js/src/buildFromYaml.py", line 119, in runBuild subprocess.check_call([ File "/usr/lib/python3.8/subprocess.py", line 364, in check_call raise CalledProcessError(retcode, cmd) Thanks for your reply!

sbc100 commented 5 months ago

The tar archive has to match the expected hash. If you run sha512hash on the file you downloaded you should see the same hash as the mentioned in tools/ports/freetype.py file. If you don't get the same hash then something is wrong with your download.

sunlin0oo commented 5 months ago

Yes! Thank u for your prompt reply! First of all, I made sure that this Docker can run normally, because a normal compilation was successful before (the file can be pulled from Github) img_v3_0275_18e55680-627f-4706-943d-51c74389a6fg But after I download it normally, the following problems will appear: image What could be the reason?

sbc100 commented 5 months ago

Have you modified the freetype.py file somehow? What modifications did you make? The get() function in freetype.py, should never return None... it should always return a list of libraries to at the link command.

sunlin0oo commented 5 months ago

yes! When I modified the url address, it showed that there was a problem with the indentation of a function below in freetype.py. I modified the indentation problem. I think this problem may cause no return value. I tried to fix it. Thank you for your reply!

sunlin0oo commented 5 months ago

Thanks for your help, I've solved the problem: The main method is: Github cannot request to modify its download address.