Problem generating exe files from linux

Hello everyone!

I’m trying to create binaries for all platforms using my Debian Linux. Everything seems to be fine (though I haven’t tried Mac OS distribution) except Windows build. It generates exe file alongside with lots of .dll’s, but it doesn’t run.

My setup.py looks like this:

from setuptools import setup

exclude = [
#bunch of files
]

setup(
    name="Heroin",
    options = {
        'build_apps': {
            'include_patterns': ['*'],
            'exclude_patterns': exclude,
            'file_handlers': [],
            'gui_apps': {
                'Heroin': 'demo_panda.py',
            },
            'plugins': [
                'pandagl',
                'p3openal_audio',
                'p3ptloader',
                'pandaegg',
                'pandafx',
                'p3ffmpeg'
            ],
            'platforms': [
                'manylinux1_x86_64',
                'macosx_10_6_x86_64',
                'win_amd64',
                "win32",
            ],
        }
    }
)

Output from python setup.py build_apps command:

running build_apps
Building platforms: manylinux1_x86_64,macosx_10_6_x86_64,win_amd64,win32
Gathering wheels for platform: manylinux1_x86_64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt
Collecting panda3d==1.10.0 (from -r /home/montreal/Creativity/vrijdag/requirements.txt (line 1))
  Downloading http://buildbot.panda3d.org/downloads/7e562b0eb3ef5aa407b16d768cc49c8112828ef5/opt/panda3d-1.10.0+opt-cp36-cp36m-manylinux1_x86_64.whl (49.1MB)
    100% |████████████████████████████████| 49.1MB 1.4MB/s 
  Saved ./build/__whl_cache__/panda3d-1.10.0+opt-cp36-cp36m-manylinux1_x86_64.whl
Successfully downloaded panda3d
Building runtime for platform: manylinux1_x86_64
There are some missing modules: ['__builtin__', '_winapi']
Copying game files for platform: manylinux1_x86_64
Gathering wheels for platform: macosx_10_6_x86_64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt
Collecting panda3d==1.10.0 (from -r /home/montreal/Creativity/vrijdag/requirements.txt (line 1))
  Downloading http://buildbot.panda3d.org/downloads/7e562b0eb3ef5aa407b16d768cc49c8112828ef5/opt/panda3d-1.10.0+opt-cp36-cp36m-macosx_10_6_x86_64.whl (54.6MB)
    100% |████████████████████████████████| 54.6MB 4.1MB/s 
  Saved ./build/__whl_cache__/panda3d-1.10.0+opt-cp36-cp36m-macosx_10_6_x86_64.whl
Successfully downloaded panda3d
Building runtime for platform: macosx_10_6_x86_64
Copying game files for platform: macosx_10_6_x86_64
Bundling macOS app into /home/montreal/Creativity/vrijdag/build/macosx_10_6_x86_64/Heroin.app
Gathering wheels for platform: win_amd64
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt
Collecting panda3d==1.10.0 (from -r /home/montreal/Creativity/vrijdag/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/f5/c4/39d29e84d6bd00e9e71eaacb8a9a350d21a035ebfb2520b57a0385e7d0c6/panda3d-1.10.0-cp36-cp36m-win_amd64.whl (57.3MB)
    100% |████████████████████████████████| 57.3MB 585kB/s 
  Saved ./build/__whl_cache__/panda3d-1.10.0-cp36-cp36m-win_amd64.whl
Successfully downloaded panda3d
Could not find an optimized wheel (using index https://archive.panda3d.org/simple/opt) for platform: win_amd64
Building runtime for platform: win_amd64
There are some missing modules: ['_bisect', '_blake2', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_heapq', '_md5', '_multibytecodec', '_opcode', '_pickle', '_posixsubprocess', '_random', '_sha1', '_sha256', '_sha3', '_sha512', '_struct', 'binascii', 'math', 'zlib']
warning: build_apps: could not find dependency VERSION.dll (referenced by python36.dll)

warning: build_apps: could not find dependency VCRUNTIME140.dll (referenced by python36.dll)

warning: build_apps: could not find dependency VCRUNTIME140.dll (referenced by deploy-stubw.exe)

warning: build_apps: could not find dependency SETUPAPI.dll (referenced by libpanda.dll)

warning: build_apps: could not find dependency CRYPT32.dll (referenced by avformat-55.dll)

Copying game files for platform: win_amd64
Gathering wheels for platform: win32
Looking in indexes: https://pypi.org/simple, https://archive.panda3d.org/simple/opt
Collecting panda3d==1.10.0 (from -r /home/montreal/Creativity/vrijdag/requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/f5/97/19f0d4d44f86e662627b17f4a7709a4fdc2d1efa075c649aa376cdc5f719/panda3d-1.10.0-cp36-cp36m-win32.whl (49.3MB)
    100% |████████████████████████████████| 49.3MB 692kB/s 
  Saved ./build/__whl_cache__/panda3d-1.10.0-cp36-cp36m-win32.whl
Successfully downloaded panda3d
Could not find an optimized wheel (using index https://archive.panda3d.org/simple/opt) for platform: win32
Building runtime for platform: win32
warning: build_apps: could not find dependency VERSION.dll (referenced by python36.dll)

warning: build_apps: could not find dependency VCRUNTIME140.dll (referenced by python36.dll)

warning: build_apps: could not find dependency VCRUNTIME140.dll (referenced by deploy-stubw.exe)

warning: build_apps: could not find dependency SETUPAPI.dll (referenced by libpanda.dll)

warning: build_apps: could not find dependency CRYPT32.dll (referenced by avformat-55.dll)

Copying game files for platform: win32

I guess, to run panda application on windows I just need those fantastic dlls, but where to find them?

You probably do not need to ship those DLLs with your game (although, you may need the MSVC redistributable as a result). What happens when you try to run the exe? You may want to switch from a gui_app to a console_app for easier debugging, or use the logging option. However, it looks like the logging option isn’t documented yet (I need to fix that).

App just does not run. Basically, nothing happens when I try to launch my exe file.

Please try generating a console app and checking the console output for more information.

EDIT: You can instead setup looking like is done in the asteroids sample and check the log output.

When I added log_filename and log_append, I’ve got this error:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'

Current thread 0x00007f1eea10e700 (most recent call first):
Aborted

The encodings module should very much be included (build_apps will always include encodings regardless of what dependencies it finds). Maybe try adding encodings to the list of include_modules? Something like:

'include_modules': ['*': 'encodings']

You know, after I’ve added encodings, it works… Don’t know if it was the issue, though/