Spaces in C macro expansion when running in docker bash

  bash, c#, docker

I hit a strange issue when compiling a source file with docker.

When I launch a docker container and execute the gcc compiler from the bash shell, it works as expected (simplified version):

> docker run -it myImage bash
[email protected]:/# gcc main.c

However, when I invoke it as follows

> docker run -it myImage bash -l -c gcc main.c

I get

fatal error: 'linux / mymodule _ linux .h' file not found

note: expanded from macro 'TARGET_INCLUDE'
#define TARGET_INCLUDE(module) STR(IDENT(PLATFORM) IDENT(/) IDENT(module) IDENT(_) IDENT(PLATFORM) IDENT(.h))

The spaces in the include file shouldn’t be there.

Anyone?

Source: Docker Questions

LEAVE A COMMENT