Teach upcxx to compile C files

Issue #229 resolved
Dan Bonachea created an issue

Our upcxx compiler wrapper currently does not allow the user to safely compile C language source files. Instead it blindly passes them to the C++ compiler, and some C++ compilers (notably clang) rightly complain about the incorrect language source file.

This unfortunately leaves C/C++ hybrid programmers without a robust/portable solution for compiling their C files using upcxx in a way that will be link-compatible with their UPC++ application. nobs (and upcxx-meta) have the information about the link-compatible C compiler (the one used to build GASNet and C components of libupcxx), so we should expose that to the end user through the upcxx compiler wrapper for building their own C language files.

The recommended workaround for users of the current release is to use upcxx-meta as follows:

$ `upcxx-meta CC` -O -c mycfile.c
$ upcxx -O myupcxx.cxx mycfile.o 

Comments (3)

  1. Dan Bonachea reporter

    Proposed fix in pull request #92.

    The caveats:

    1. Cannot compile C and C++ language source files during the same invocation of upcxx (use separate invocations for each language)
    2. Cannot link while compiling C language source files (compile them separately first)

    The updated usage given the enhancement:

    $ upcxx -O -c mycfile.c
    $ upcxx -O myupcxx.cxx mycfile.o 
    
  2. Log in to comment