IBM Support

Using GCC5.x with IBM Rational Rhapsody In C results in compiler or linker errors

Troubleshooting


Problem

When rebuilding the C language OXF framework with IBM Rational Rhapsody, you might experience this build error, "conflicting types for 'select'" or when trying to build/simulate your C language project you might observe multiple linker errors reporting missing Rhapsody OXF framework symbols.

Symptom

When rebuilding the C language OXF framework with IBM Rational Rhapsody, you might experience this build error:



    In file included from /usr/include/w32api/windows.h:92:0,
    from ../oxf/RiCOSNT.h:25,
    from ../osconfig/cygwin/RiCOS.h:22,
    from ../oxf/RiCOSWrap.h:26,
    from aombrk.c:29:
    /usr/include/w32api/winsock.h:299:34: error: conflicting types for 'select'
    WINSOCK_API_LINKAGE int WSAAPI select(int nfds,fd_set *readfds,fd_set *writefds,fd_set *exceptfds,const PTIMEVAL timeout);
    ^
    In file included from /usr/include/sys/types.h:68:0,
    from /usr/include/stdio.h:61,
    from aombrk.c:21:
    /usr/include/sys/select.h:73:5: note: previous declaration of 'select' was here
    int select __P ((int __n, fd_set *__readfds, fd_set *__writefds,
    ^
    make[1]: *** [cygwinaom.mak:31: aombrk.o] Error 1
    make[1]: Leaving directory '/cygdrive/c/Rhapsody8.1.4/Share/LangC/aom'
    make: *** [cygwinbuild.mak:28: aomlibs] Error 2

Or when you try to build/simulate your C language project you may observe multiple linker errors reporting missing Rhapsody OXF framework symbols:



    /cygdrive/c/Rhapsody8.1.3/Samples/CSamples/Dishwasher/DefaultComponent_Cygwin/Release/MainDefaultComponent_Cygwin.c:25: undefined reference to `RiCOXFInit'

    /cygdrive/c/Rhapsody8.1.3/Samples/CSamples/Dishwasher/DefaultComponent_Cygwin/Release/MainDefaultComponent_Cygwin.c:25:(.text+0x73): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `RiCOXFInit'

    /cygdrive/c/Rhapsody8.1.3/Samples/CSamples/Dishwasher/DefaultComponent_Cygwin/Release/MainDefaultComponent_Cygwin.c:30: undefined reference to `RiCOXFStart'

    /cygdrive/c/Rhapsody8.1.3/Samples/CSamples/Dishwasher/DefaultComponent_Cygwin/Release/MainDefaultComponent_Cygwin.c:30:(.text+0x86): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `RiCOXFStart'

Cause

Cygwin GNU GCC compiler has added an additional select function to its conditional compiler directives

Resolving The Problem

This is fixed in Rhapsody 8.1.5 as an internal maintenance update. Therefore, we recommend that you upgrade to Rhapsody 8.1.5 or higher.

If you cannot upgrade you can fix this issue with the following modification:

  1. Open /Share/LangC/aom/cygwinaom.mak. For example,
    C:/Rhapsody8.1.4/Share/LangC/aom/cygwinaom.mak
  2. Modify line 10 so as to include the directive "-D__USE_W32_SOCKETS". For example,

    ADDED_CFLAGS = $(DEFAULT_CFLAGS) -DUSE_SYS_TYPES_FD_SET -D__USE_W32_SOCKETS -I.. -I../osconfig/cygwin -DCYGWIN $(RHAP_FLAGS)



    Disclaimer:

    All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"8.0;8.0.1;8.0.2;8.0.3;8.0.4;8.0.5;8.0.6;8.1;8.1.1;8.1.2;8.1.2.1;8.1.3;8.1.4","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21990096