Menu

#71 MinGW make error

release
accepted
None
1
2023-05-21
2023-05-12
Anonymous
No

Hi,

I'm having an issue with getting the stack to build the basic examples. select() seems to be declared twice and I have been unable to find a solution or any topics related top this issue. Any insight to where I should look would be very appreciated.

Thank you

1 Attachments

Discussion

  • Anonymous

    Anonymous - 2023-05-12

    It is likely that the MSYS2 environment is not configured correctly.

    Some background for configuration is here:
    https://stackoverflow.com/questions/48031258/mingw64-and-conflicting-declaration-of-c-function-int-select

    You can check the environment using uname and using gcc -dumpmachine

    You can setup the MSYS2 for MinGW32 environment using the appropriate launcher.
    https://www.msys2.org/wiki/Launchers/

    The check results:

    $ uname
    MINGW32_NT-10.0-19045
    
    $ gcc -dumpmachine
    i686-w64-mingw32
    

    To install from MSYS2, you can use winget and pacman:

    c:\> winget install --id=MSYS2.MSYS2  -e
    

    Launch MSYS and install the MinGW32 toolchain:

    $ pacman -Syu
    $ pacman -Sy base-devel
    $ pacman -Sy mingw-w64-i686-toolchain
    

    Note that I currently get a Linker (ld.exe) error when using MSYS MinGW32 shell.

    C:/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/13.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lbacnet: No such file or directory
    

    I use git-bash with my ~/.bashrc file configured as:

    $ cat ~/.bashrc
    alias make=mingw32-make.exe
    PATH=/c/msys64/mingw32/bin:$PATH
    export MAKE=mingw32-make.exe
    export CC=gcc.exe
    export OBJCOPY=objcopy.exe
    export AR=ar.exe
    export NM=nm.exe
    export STRIP=strip.exe
    export SIZE=size.exe
    

    and the checks return:

    $ gcc -dumpmachine
    i686-w64-mingw32
    

    and

    $ uname
    MINGW64_NT-10.0-19045
    

    My git-bash PATH starts with: /c/msys64/mingw32/bin:

     

    Last edit: Steve Karg 2023-05-12
  • Steve Karg

    Steve Karg - 2023-05-13
    • status: open --> accepted
    • assigned_to: Steve Karg
     
  • Steve Karg

    Steve Karg - 2023-05-13

    For compiling under MinGW32, MSYS2 installation is:

    c:\> winget install --id=MSYS2.MSYS2  -e
    

    Start MSYS, and install MinGW32.

    $ pacman -Syu mingw-w64-i686-toolchain
    

    Then edit ~/.bashrc file and add:

    alias make=mingw32-make.exe
    

    Exit MSYS.
    Start MSYS profile for MinGW32.
    Verify MSYS profile:

    $ uname
    MINGW32_NT-10.0-19045
    

    Verify GCC is targeting i686:

    $ gcc -dumpmachine
    i686-w64-mingw32
    

    Verify make is built for Windows32:

     make --version
     Built for Windows32
    
     
  • Anonymous

    Anonymous - 2023-05-21

    Thanks Steve! Those solved the issue.

     

Anonymous
Anonymous

Add attachments
Cancel