unknown compiler error for SHARC DSP
- Dominant language
- Python
- Stars
- 6.6k
- Forks
- 1.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 33
Description
Hi,
My team started to use Meson in replacements of Makefile and I currently encountered an issue with cross-compilation.
As I'm not very confident on that topic, please forgive me if I didn't give enough details or information.
So we want to build a library for a DSP SHARC. The compiler is private and needs a license to use it.
## ini file `sharc_ADSP-21565.ini`
```ini
# Meson cross-compilation file for SHARC ADSP-21565 compilation
[constants]
toolchain = '/opt/analog/cces/2.9.4'
cpu_revision = '0.2'
cpu_name = 'ADSP-21565'
[binaries]
c = toolchain / 'cc21k'
as = toolchain / 'easm21k'
ar = toolchain / 'cc21k'
ld = toolchain / 'cc21k'
[properties]
objcopy = toolchain / 'cc21k'
needs_exe_wrapper = true
[host_machine]
system = 'none'
cpu_family = 'SHARC'
endian = 'little'
cpu = cpu_name
[built-in options]
c_args = ['-proc' + cpu_name, '-flags-compiler', '--no_wrap_diagnostics', '-si-revision' + cpu_revision, '-O', '-Ov100', '-structs-do-not-overlap', '-no-const-strings', '-no-multiline', '-warn-protos', '-double-size-32', '-char-size-8', '-swc']
c_link_args = ['-proc' + cpu_name, '-si-revision' + cpu_revision, '-no-mem', '-flags-link', '-ip', '-flags-link', '-e']
c_std = 'gnu11'
b_staticpic = false
```
## commands
```terminal
export MESON_FORCE_BACKTRACE=1
meson build --cross-file toolchains/sharc_ADSP-21565.ini
```
## outputs
```terminal
The Meson build system
Version: 0.60.99
Source dir: /home/alexf/dive/libdive
Build dir: /home/alexf/dive/libdive/build
Build type: cross build
Project name: Dive library
Project version: 1.0
meson.build:1:0: ERROR: Unknown compiler(s): [['/opt/analog/cces/2.9.4/cc21k']]
A full log can be found at /home/alexf/dive/libdive/build/meson-logs/meson-log.txt
Traceback (most recent call last):
File "/home/alexf/meson/meson-env/bin/meson", line 10, in
sys.exit(main())
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 241, in main
return run(sys.argv[1:], launcher)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 232, in run
return CommandLineParser().run(args)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/mesonmain.py", line 138, in run
return options.run_func(options)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/msetup.py", line 294, in run
app.generate()
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/msetup.py", line 185, in generate
self._generate(env)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/msetup.py", line 207, in _generate
intr = interpreter.Interpreter(b, user_defined_options=user_defined_options)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreter/interpreter.py", line 308, in __init__
self.parse_project()
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 118, in parse_project
self.evaluate_codeblock(self.ast, end=1)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 173, in evaluate_codeblock
raise e
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 166, in evaluate_codeblock
self.evaluate_statement(cur)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 179, in evaluate_statement
return self.function_call(cur)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreterbase/interpreterbase.py", line 454, in function_call
res = func(node, func_args, kwargs)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreterbase/decorators.py", line 276, in wrapper
return f(*nargs, **wrapped_kwargs)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreterbase/decorators.py", line 561, in wrapper
return f(*wrapped_args, **wrapped_kwargs)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreter/interpreter.py", line 1171, in func_project
self.add_languages(proj_langs, True, MachineChoice.HOST)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreter/interpreter.py", line 1300, in add_languages
success = self.add_languages_for(args, required, for_machine)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/interpreter/interpreter.py", line 1338, in add_languages_for
comp = compilers.detect_compiler_for(self.environment, lang, for_machine)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/compilers/detect.py", line 215, in detect_compiler_for
comp = compiler_from_language(env, lang, for_machine)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/compilers/detect.py", line 212, in compiler_from_language
return lang_map[lang](env, for_machine) if lang in lang_map else None
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/compilers/detect.py", line 635, in detect_c_compiler
return _detect_c_or_cpp_compiler(env, 'c', for_machine)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/compilers/detect.py", line 631, in _detect_c_or_cpp_compiler
_handle_exceptions(popen_exceptions, compilers)
File "/home/alexf/meson/meson-env/lib/python3.7/site-packages/mesonbuild/compilers/detect.py", line 258, in _handle_exceptions
raise EnvironmentException(errmsg)
mesonbuild.mesonlib.universal.EnvironmentException: Unknown compiler(s): [['/opt/analog/cces/2.9.4/cc21k']]
```
I performed some investigations on my side with a clone of meson and additional traces in `detect.py`. In addition with #2867 and #8814 it seems that I have to contribute and add a `CCompiler` class for my compiler?
Am I right or do I missed something?
Thanks for your help and your great job in Meson!
Regards,
Alex F.
Contributor guide
Research direction
Start by reading mesonbuild/compilers/detect.py and the discussion in issues #2867 and #8814 about adding compiler support. Reproduce the provided cross-compilation command if the SHARC toolchain is available, then determine the required compiler integration and verify that Meson no longer reports an unknown compiler.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100