Skip to content

topology2: fix build issues with no command line definitions - #5249

Merged
lgirdwood merged 1 commit into
thesofproject:mainfrom
ranj063:fix/tplg2_build
Jan 24, 2022
Merged

lgirdwood merged 1 commit into
thesofproject:mainfrom
ranj063:fix/tplg2_build

Conversation

@ranj063

@ranj063 ranj063 commented Jan 24, 2022

Copy link
Copy Markdown
Collaborator

If there are not command line definitions, the build fails because the
4th argument to the add_alsatplg2_command macro is NULL.

Fix this by using named arguments for the macro and checking for the
optional argument for command line definitions.

Signed-off-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com

If there are no command line definitions, the build fails because the
4th argument to the add_alsatplg2_command macro is NULL.

Fix this by using named arguments for the macro and checking for the
optional argument for command line definitions.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@ranj063 ranj063 changed the title topology2: fix build issues wit no command line definitions topology2: fix build issues with no command line definitions Jan 24, 2022
@aiChaoSONG

Copy link
Copy Markdown
Collaborator

The build issue is fixed by this PR. But I found something unusual. For the cavs-nocodec topology, if I build it manually with

export ALSA_CONFIG_DIR=~/sof/tools/topology/topology2
alsatplg -p -v1 -c tools/topology/topology2/cavs/cavs-nocodec.conf -o cavs-nocodec.tplg

the size of the generated cavs-nocodec.tplg is 23884. But if I build it with the script ./scripts/build-tools.sh -T, the size is 23887.
I compared the two topology, the difference is in the manifect section.
image

@bardliao

Copy link
Copy Markdown
Collaborator

I tested the cavs-nocodec.tplg built by ./scripts/build-tools.sh and it works.

@ranj063

ranj063 commented Jan 24, 2022

Copy link
Copy Markdown
Collaborator Author

The build issue is fixed by this PR. But I found something unusual. For the cavs-nocodec topology, if I build it manually with

export ALSA_CONFIG_DIR=~/sof/tools/topology/topology2
alsatplg -p -v1 -c tools/topology/topology2/cavs/cavs-nocodec.conf -o cavs-nocodec.tplg

the size of the generated cavs-nocodec.tplg is 23884. But if I build it with the script ./scripts/build-tools.sh -T, the size is 23887. I compared the two topology, the difference is in the manifect section. image

@aiChaoSONG that's expected right? When u build manually , you won't include the manifest data

@aiChaoSONG

Copy link
Copy Markdown
Collaborator

@ranj063 Oh, yes, that makes sense, it's the SOF ABI.

@lgirdwood
lgirdwood merged commit cb80023 into thesofproject:main Jan 24, 2022
@marc-hb

marc-hb commented Jan 24, 2022

Copy link
Copy Markdown
Collaborator

Why was this failing only for incremental builds and not when building from scratch??

@marc-hb

marc-hb commented Jan 25, 2022 •

Copy link
Copy Markdown
Collaborator

Why was this failing only for incremental builds and not when building from scratch??

OK, mystery solved. The problem is ALSA_CONFIG_DIR is defined in ./scripts/build-tools.sh. This makes alsatplg fail differently when building incrementally = when using ./scripts/build-tools.sh vs not. I should have caught this in commit 308a24a

  • Green failure when using ./scripts/build-tools.sh with ALSA_CONFIG_DIR defined:
ALSA lib parser.c:182:(tplg_parse_config) unknown section Object
ALSA lib parser.c:182:(tplg_parse_config) unknown section Class
ALSA lib parser.c:182:(tplg_parse_config) unknown section Define
ALSA lib parser.c:182:(tplg_parse_config) unknown section IncludeByKey
B0x000000/000000 - header index 0 type 8 count 1 size 0x70/112 vendor 0 version 0
B0x000024/000036 - manifest: write 112 bytes
B0x000094/000148 - manifest: write 0 priv bytes
B0x000094/000148 - total size is 0x94/148

The -p is swallowed by -D

This is IMHO a bug in alsatplg, unknown sections should error and not just warn? @bardliao or @aiChaoSONG if you agree could you please file a new bug at https://github.com/alsa-project/alsa-utils/issues ?

  • Different, red failure when ALSA_CONFIG_DIR is not defined:
alsatplg -I sof.git/tools/topology/topology2/cavs -D -p -c cavs-gain-hdmi.conf -o cavs-gain-hdmi.tplg

ALSA lib conf.c:810:(get_char_skip_comments) Invalid search dir /usr/share/alsa/cavs
ALSA lib conf.c:2005:(_snd_config_load_with_include) _toplevel_:6:16:Invalid argument
ALSA lib parser.c:204:(tplg_load_config) could not load configuration
Unable to load configuration: Invalid argument

FAILED: topology/topology2/cavs/cavs-gain-hdmi.tplg 

I will submit a PR that moves ALSA_CONFIG_DIR to CMake so everything always passes or fails the same, not depending on how you build.

marc-hb added a commit to marc-hb/sof that referenced this pull request Jan 25, 2022
Fixes incremental builds of topology2 that were missing ALSA_CONFIG_DIR.

This was making it impossible to troubleshoot alsatplg issues like thesofproject#5249.
Now incremental builds fail or pass the same as builds from scratch.

Fixes commit 308a24a ("topology2: Add build support")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
ranj063 pushed a commit that referenced this pull request Jan 26, 2022
Fixes incremental builds of topology2 that were missing ALSA_CONFIG_DIR.

This was making it impossible to troubleshoot alsatplg issues like #5249.
Now incremental builds fail or pass the same as builds from scratch.

Fixes commit 308a24a ("topology2: Add build support")

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants