msys2 / setup-msys2

GitHub Action to setup MSYS2
https://github.com/marketplace/actions/setup-msys2
MIT License
282 stars 36 forks source link

[question] how to move needed binaries (DLL's) to release zip? [SOLVED] #356

Closed UnrealKaraulov closed 5 months ago

UnrealKaraulov commented 5 months ago

[question] how to move needed binaries (DLL's) to release zip

where located libgcc_s_seh-1.dll, libwinpthread-1.dll, libstdc++-6.dll files to add it to output archive?

Biswa96 commented 5 months ago

where located libgcc_s_seh-1.dll, libwinpthread-1.dll, libstdc++-6.dll files to add it to output archive?

Those files are in $MINGW_PREFIX/bin directory.

UnrealKaraulov commented 5 months ago

Member

thanks !

Biswa96 commented 5 months ago

Maybe You know how to add it in github workflow? just 'cp $MINGW_PREFIX\bin\filename \target_dir\ ?'

It depends on the project. If you need just those three files cp command would be enough. Here are some projects which uses binaries from msys2 packages https://www.msys2.org/docs/who-is-using-msys2/

UnrealKaraulov commented 5 months ago

cp command would be enough

cp $MINGW_PREFIX\bin\libgcc_s_seh-1.dll build\win64_cmake_release\

 ```|  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | Cannot find path 'D:\bin\libgcc_s_seh-1.dll' because it does not exist.```
 run: >
          mkdir -p build\win64_cmake_release

          cp $MINGW_PREFIX\bin\libgcc_s_seh-1.dll build\win64_cmake_release\

          ...
Biswa96 commented 5 months ago

I can not provide any suggestion without knowing the project or build environment.

UnrealKaraulov commented 5 months ago

@Biswa96 missing prefix in env, solved

    env: 
      MINGW64_PREFIX: "C:/msys64/mingw64"
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          submodules: true
      - name: Setup MinGW GCC
        uses: msys2/setup-msys2@v2
        with:
          update: true
          location: C:/
          install: >-
            mingw-w64-x86_64-binutils

          cp ${{env.MINGW64_PREFIX}}\bin\libgcc_s_seh-1.dll build\win64_cmake_release\

          cp ${{env.MINGW64_PREFIX}}\bin\libwinpthread-1.dll build\win64_cmake_release\

          cp ${{env.MINGW64_PREFIX}}\bin\libstdc++-6.dll build\win64_cmake_release\

          cp glew\bin\Release\x64\glew32.dll build\win64_cmake_release\

Now it works)

UnrealKaraulov commented 5 months ago

@Biswa96 Thanks for help!

It works but I got error when try to run executable:

---------------------------
release.exe - Entry Point Not Found
---------------------------
The entry point for the procedure _ZNKSt25__codecvt_utf8_utf16_baseIwE10do_unshiftER9_MbstatetPcS3_RS3_ was not found in the DLL library C:\Users\Karaulov\Downloads\win7_x64_gcc_release\libstdc++-6.dll.
---------------------------
OK   
---------------------------
UnrealKaraulov commented 5 months ago

image

Biswa96 commented 5 months ago

Please try to change the default shell to shell: msys2 {0}, see https://www.msys2.org/docs/ci/

Also, it is not required to set MINGW64_PREFIX. The MINGW_PREFIX variable is set automatically if you are using the above suggestion.

UnrealKaraulov commented 5 months ago

@Biswa96 very strange, but after adding 'shell: msys2 {0}' i got error at start: 'cmake command not found' :)

Biswa96 commented 5 months ago

i got error at start: 'cmake command not found' :)

You have to install cmake in msys2. Previously, you were using default cmake in GitHub runners.

UnrealKaraulov commented 5 months ago

i got error at start: 'cmake command not found' :)

You have to install cmake in msys2. Previously, you were using default cmake in GitHub runners.

But without command 'shell: msys2 {0}' cmake found and program compiled without error (except missing functions in dll) , maybe this shell command loss cmake in PATH variables ?

UnrealKaraulov commented 5 months ago

@Biswa96 thanks this issue solved! instead of

      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          submodules: true
      - name: Setup MinGW GCC
        uses: msys2/setup-msys2@v2
        with:
          update: true
          location: C:/
          install: >-
            mingw-w64-x86_64-binutils

added

      - name: Checkout
        uses: actions/checkout@v4
      - name: Setup MinGW GCC
        uses: msys2/setup-msys2@v2
        with:
          release: false
          msystem: mingw64
          path-type: inherit
          update: true
          cache: false
          location: C:/
          pacboy: cc:p cmake:p ninja:p lld:p
          install: >-
            mingw-w64-x86_64-binutils

Also mingw64 missing std::quick_exit(0), I replaced this function to another exit function.

Now compiled success!