mesonbuild / mesonbuild/meson

meson cannot understand supported standards of flang on termux (android)

Open
#11,633 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

language:fortran
Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

**Describe the bug**
meson cannot understand supported standards of flang on termux (android)

**To Reproduce**
install termux ( download from github https://github.com/termux/termux-app/releases )
then in termux:
```
pkg install python python-pip flang
git clone scipy
git clone meson
cd meson
pip install ./
cd ../scipy
FC=flang-new meson setup build --prefix=$PWD/build-install
```
i got a lot of stuff in console and then there was path to such log: https://bpa.st/SWLEC

**Expected behavior**
I guess it should stop not at point
```
linker stderr:

-----
Detecting LLD linker via: flang-new -Wl,-v
linker stdout:
LLD 15.0.7 (compatible with GNU linkers)

linker stderr:
ld.lld: error: undefined symbol: _QQmain
>>> referenced by Fortran_main.c
>>> Fortran_main.c.o:(main) in archive /data/data/com.termux/files/usr/lib/libFortran_main.a
flang-new: error: linker command failed with exit code 1 (use -v to see invocation)

```

I guess the reason why is that meson tries to get some info using `flang-new -Wl,-v `, but it should be something like `flang-new -w -v` but i'm not sure.
I guess so because:
```
~ $ flang-new -Wl,-v LLD 16.0.0 (compatible with GNU linkers)
ld.lld: error: undefined symbol: _QQEnvironmentDefaults
>>> referenced by Fortran_main.c
>>> Fortran_main.c.o:(main) in archive /data/data/com.termux/files/usr/lib/libFortran_main.a >>> referenced by Fortran_main.c
>>> Fortran_main.c.o:(main) in archive /data/data/com.termux/files/usr/lib/libFortran_main.a

ld.lld: error: undefined symbol: _QQmain >>> referenced by Fortran_main.c
>>> Fortran_main.c.o:(main) in archive /data/data/com.termux/files/usr/lib/libFortran_main.a flang-new: error: linker command failed with exit code 1 (use -v to see invocation)
```
```
~ $ flang-new -Wl -v
flang-new version 16.0.0
Target: aarch64-unknown-linux-android24 Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/bin Found candidate GCC installation: /data/data/com.termux/files/usr/lib/gcc/aarch64-linux-android/6.5.0 Found candidate GCC installation: /data/data/com.termux/files/usr/lib/gcc/aarch64-linux-android/8.3.0 Selected GCC installation: /data/data/com.termux/files/usr/lib/gcc/aarch64-linux-android/8.3.0
Candidate multilib: .;@m64 Selected multilib: .;@m64
flang-new: warning: argument unused during compilation: '-Wl'
```

Maybe the problem is somewhere there: https://github.com/mesonbuild/meson/blob/master/mesonbuild/compilers/fortran.py

**system parameters**
termux, android, a samsung phone
meson -- git version and all below i guess ( tried with another previous... )
ninja ( in the case it doesn't matter, but 1.11.1 )

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Termux command with FC=flang-new and reviewing mesonbuild/compilers/fortran.py. Compare the linker-detection invocations shown in the report, including flang-new -Wl,-v and flang-new -Wl -v. Done means Meson can detect the compiler's supported standards without the reported linker failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.