Skip to content

docker: Fixing CFLAG for configuration on Apple ARM M1/2/3#5055

Merged
echoix merged 2 commits intoOSGeo:mainfrom
pwt-cd:arm64-configure-fix
Mar 13, 2025
Merged

docker: Fixing CFLAG for configuration on Apple ARM M1/2/3#5055
echoix merged 2 commits intoOSGeo:mainfrom
pwt-cd:arm64-configure-fix

Conversation

@pwt-cd
Copy link
Contributor

@pwt-cd pwt-cd commented Feb 6, 2025

The -m64 CFLAG causes the c++ compiler to be unavailable for make.

The `-m64` CFLAG causes the c++ compiler to be unavailable for make.
@github-actions github-actions bot added the docker Docker related label Feb 6, 2025
@nilason nilason changed the title Fixing CFLAG for configuration on Apple ARM M1/2/3 docker: Fixing CFLAG for configuration on Apple ARM M1/2/3 Feb 7, 2025
@nilason
Copy link
Contributor

nilason commented Feb 7, 2025

I'm not familiar with docker, but GRASS configures and builds fine with -m64 added to both CFLAGS and CXXFLAGS on Apple ARM machine (not using docker).

It is also a valid flag for Clang.

Could you perhaps provide us with the config.log?

@nilason nilason added the info needed Waiting on more info from the submitter label Feb 7, 2025
@pwt-cd
Copy link
Contributor Author

pwt-cd commented Feb 7, 2025

I am not sure where to find config.log but here is what happens when I build the docker image with -m64 in line 275 of the Dockerfile:

docker buildx build --platform linux/arm64 -t grass-failure --load .
[+] Building 3.9s (17/29)                                                          docker-container:charming_satoshi
 => [internal] load build definition from Dockerfile                                                            0.0s
 => => transferring dockerfile: 9.66kB                                                                          0.0s
 => WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 8)                                  0.0s
 => resolve image config for docker-image://docker.io/docker/dockerfile:1.13@sha256:426b85b823c113372f766a963f  0.0s
 => CACHED docker-image://docker.io/docker/dockerfile:1.13@sha256:426b85b823c113372f766a963f68cfd9cd4878e1bcc0  0.0s
 => => resolve docker.io/docker/dockerfile:1.13@sha256:426b85b823c113372f766a963f68cfd9cd4878e1bcc0fda58779127  0.0s
 => [internal] load metadata for docker.io/library/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab  0.0s
 => [internal] load .dockerignore                                                                               0.0s
 => => transferring context: 534B                                                                               0.0s
 => [common_start 1/2] FROM docker.io/library/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab72966  0.0s
 => => resolve docker.io/library/ubuntu:22.04@sha256:0e5e4a57c2499249aafc3b40fcd541e9a456aab7296681a3994d63158  0.0s
 => [internal] load build context                                                                               0.5s
 => => transferring context: 3.89MB                                                                             0.5s
 => CACHED [common_start 2/2] WORKDIR /tmp                                                                      0.0s
 => CACHED [grass_gis 1/3] RUN apt-get update     && apt-get install  -y --no-install-recommends --no-install-  0.0s
 => CACHED [grass_gis 2/3] RUN echo LANG="en_US.UTF-8" > /etc/default/locale     && echo en_US.UTF-8 UTF-8 >>   0.0s
 => CACHED [grass_gis 3/3] WORKDIR /src                                                                         0.0s
 => CACHED [build 1/7] RUN apt-get update     && apt-get install  -y --no-install-recommends --no-install-sugg  0.0s
 => CACHED [build 2/7] RUN (echo "Install Python"     && wget https://bootstrap.pypa.io/pip/get-pip.py     &&   0.0s
 => [build 3/7] COPY . /src/grass_build/                                                                        2.9s
 => [build 4/7] WORKDIR /src/grass_build                                                                        0.0s
 => [build 5/7] RUN make distclean || echo "nothing to clean"                                                   0.1s
 => ERROR [build 6/7] RUN ./configure   --enable-largefile   --with-blas   --with-bzlib   --with-cairo --with-  0.2s
------
 > [build 6/7] RUN ./configure   --enable-largefile   --with-blas   --with-bzlib   --with-cairo --with-cairo-ldflags=-lfontconfig   --with-cxx   --with-fftw   --with-freetype --with-freetype-includes=/usr/include/freetype2/   --with-gdal=/usr/bin/gdal-config   --with-geos   --with-lapack   --with-netcdf   --with-odbc   --with-openmp   --with-pdal   --with-postgres --with-postgres-includes=/usr/include/postgresql   --with-proj-share=/usr/share/proj   --with-readline   --with-sqlite   --with-zstd   --without-mysql    --without-opengl     && make -j 4     && make install && ldconfig     &&  cp /usr/local/grass85/gui/wxpython/xml/module_items.xml module_items.xml;     rm -rf /usr/local/grass85/demolocation;     rm -rf /usr/local/grass85/fonts;     rm -rf /usr/local/grass85/gui;     rm -rf /usr/local/grass85/share;     mkdir -p /usr/local/grass85/gui/wxpython/xml/;     mv module_items.xml /usr/local/grass85/gui/wxpython/xml/module_items.xml;:
0.135 checking build system type... aarch64-unknown-linux-gnu
0.182 checking host system type... aarch64-unknown-linux-gnu
0.182 checking for gcc... gcc
0.190 checking whether the C compiler works... no
0.193 configure: error: in `/src/grass_build':
0.193 configure: error: C compiler cannot create executables
0.193 See `config.log' for more details
0.205 mv: cannot stat 'module_items.xml': No such file or directory
------
Dockerfile:286
--------------------
 285 |     RUN make distclean || echo "nothing to clean"
 286 | >>> RUN ./configure $GRASS_CONFIG \
 287 | >>>     && make -j $NUMTHREADS \
 288 | >>>     && make install && ldconfig \
 289 | >>>     &&  cp /usr/local/grass85/gui/wxpython/xml/module_items.xml module_items.xml; \
 290 | >>>     rm -rf /usr/local/grass85/demolocation; \
 291 | >>>     rm -rf /usr/local/grass85/fonts; \
 292 | >>>     rm -rf /usr/local/grass85/gui; \
 293 | >>>     rm -rf /usr/local/grass85/share; \
 294 | >>>     mkdir -p /usr/local/grass85/gui/wxpython/xml/; \
 295 | >>>     mv module_items.xml /usr/local/grass85/gui/wxpython/xml/module_items.xml;
 296 |
--------------------
ERROR: failed to solve: process "/bin/bash -c ./configure $GRASS_CONFIG     && make -j $NUMTHREADS     && make install && ldconfig     &&  cp /usr/local/grass85/gui/wxpython/xml/module_items.xml module_items.xml;     rm -rf /usr/local/grass85/demolocation;     rm -rf /usr/local/grass85/fonts;     rm -rf /usr/local/grass85/gui;     rm -rf /usr/local/grass85/share;     mkdir -p /usr/local/grass85/gui/wxpython/xml/;     mv module_items.xml /usr/local/grass85/gui/wxpython/xml/module_items.xml;" did not complete successfully: exit code: 1

@echoix
Copy link
Member

echoix commented Feb 7, 2025

config.log would exist in the same directory that the repo is cloned and built when running locally. So it is in the docker's build context.

@nilason
Copy link
Contributor

nilason commented Feb 7, 2025

While you look for config.log @pwt-cd, I have an open question: is the flag -m64really needed for the docker build?

@nilason
Copy link
Contributor

nilason commented Feb 7, 2025

Just curious: would replacing -m64 with -march=native work?

@pwt-cd
Copy link
Contributor Author

pwt-cd commented Feb 7, 2025

While you look for config.log @pwt-cd, I have an open question: is the flag -m64really needed for the docker build?

@nilason TBC: removing that flag is what resulted in a successful docker build.

@pwt-cd
Copy link
Contributor Author

pwt-cd commented Feb 7, 2025

Just curious: would replacing -m64 with -march=native work?

Yes, that works. I'm not sure what the tradeoff between no flag -march=native is but both of those options work where -m64 fails. Happy to revise PR to include -march=native if you all think thats best...

@nilason
Copy link
Contributor

nilason commented Feb 7, 2025

While you look for config.log @pwt-cd, I have an open question: is the flag -m64really needed for the docker build?

@nilason TBC: removing that flag is what resulted in a successful docker build.

That was clear to me. My question relates to why the flag was added at all.

@pwt-cd
Copy link
Contributor Author

pwt-cd commented Feb 7, 2025

While you look for config.log @pwt-cd, I have an open question: is the flag -m64really needed for the docker build?

@nilason TBC: removing that flag is what resulted in a successful docker build.

That was clear to me. My question relates to why the flag was added at all.

Ah! Understood. I could't speak to that as thats how the Dockerfile comes from the main branch

Copy link
Member

@echoix echoix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see why we should let it wait any longer.

It wasn't supposed to not work on arm/apple silicon, but it'd it works like this, it's fine.

Unless we find that the arch is not 64 bit anymore for intel builds

Copy link
Contributor

@nilason nilason left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's but it to live test, and deal with it later if necessary.

@echoix echoix merged commit 7e7ef8b into OSGeo:main Mar 13, 2025
32 checks passed
@github-actions github-actions bot added this to the 8.5.0 milestone Mar 13, 2025
echoix added a commit to ninsbl/grass that referenced this pull request Mar 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docker Docker related info needed Waiting on more info from the submitter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants