GitHub user BewareMyPower added a comment to the discussion: Strange failure 
when build Pulsar Docker image on M1

You can debug it by executing the commands inside the ubuntu:20.04 container.

```bash
docker run -it -v $PWD:/pulsar ubuntu:20.04
```

---- 

Regarding the 1st question, I think it's caused by 
https://github.com/apache/pulsar/blob/e16a35dbc5b18c45ab9549b5143d849958b996a7/docker/pulsar/Dockerfile#L80.

The directory might not be java-17-openjdk-**amd64**.

Regarding the 2nd question, yes, it doesn't contain `cc` by default. I think 
the problem happened during `pip3 install grpcio`. I suspect gRPC must be 
compiled from source in ARM arch (the arch of docker container is the same with 
the host) so it requires the GCC. Here are the outputs in my env, no C++ 
compilation is needed.

```bash
$ pip3 install grpcio
Collecting grpcio
  Downloading 
grpcio-1.47.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (4.5 MB)
     |████████████████████████████████| 4.5 MB 16 kB/s 
Requirement already satisfied: six>=1.5.2 in /usr/lib/python3/dist-packages 
(from grpcio) (1.14.0)
Installing collected packages: grpcio
Successfully installed grpcio-1.47.0
```

Regarding the 4th question, first you should install `python3-dev` because 
`python-dev` is for Python2. Then, the `python3-dev` is installed to 
`/usr/local/python3.8` directory, which is not included in the default search 
path of GCC.

Maybe you can set the `C_INCLUDE_PATH` environment variable. See the following 
commands and outputs in my container:

```bash
$ ls /usr/include/python3.8/Python.h 
/usr/include/python3.8/Python.h
$ cat 1.c
#include <Python.h>

int main() {
        return 0;
}
$ gcc 1.c
1.c:1:10: fatal error: Python.h: No such file or directory
    1 | #include <Python.h>
      |          ^~~~~~~~~~
compilation terminated.
$ C_INCLUDE_PATH=/usr/include/python3.8 gcc 1.c
$ echo $?
0
```

GitHub link: 
https://github.com/apache/pulsar/discussions/17166#discussioncomment-3424174

----
This is an automatically sent email for dev@pulsar.apache.org.
To unsubscribe, please send an email to: dev-unsubscr...@pulsar.apache.org

Reply via email to