ART 1.21 fails to build on AMD A4 CPU

I got a strange error when buildind ART on my laptop. It breaks with /bin/sh sintax error when PROC_LABEL consists brackets. In my case (A4 CPU) it’s Radeon™. Any suggestions&

please attach the console output for the failed build, thanks!

Here you go…
build.log.txt (11.4 KB)

@agriggio, any progress on this? It seems that on current AMD chips with embedded GPUs it would fail the same way, wouldn’t it?

/bin/sh: -c: line 1: syntax error near unexpected token `('
/bin/sh: -c: line 1: `cd /var/tmp/portage/media-gfx/ART-1.21/work/ART-1.21_build && /usr/bin/cmake -

What shell are you using ?
I don’t know if that is what’s failing but it ses from quickly checking the build log

Why do you name the thread ‘AMD A4’ ? I don’t think this has anything to do with gpu related things ?

Or can it be a ( character where a script doesn’t expect it (like an env variable where your cpu / gpu model is stored )

It says /bin/sh isn’t it? Which is a symlink to bash.

Because AMD A4 is a CPU+GPU combo labelled as
-DPROC_LABEL:STRING=AMD\ A4-4300M\ APU\ with\ Radeon(tm)\ HD\ Graphics
which made me think that the parenthesis it this string caused the issue. Looks like that the string has to be quoted.

How about this line (133)?

[1/303] cd /var/tmp/portage/media-gfx/ART-1.21/work/ART-1.21_build && /usr/bin/cmake -DPROJECT_SOURCE_DIR:STRING=/var/tmp/portage/media-gfx/ART-1.21/work/ART-1.21 -DCACHE_NAME_SUFFIX:STRING= -DPROC_LABEL:STRING=AMD\ A4-4300M\ APU\ with\ Radeon(tm)\ HD\ Graphics -DPROC_BIT_DEPTH:STRING=64 bits -DBUILD_TYPE:STRING=Gentoo -DGTKMM_VERSION:STRING=3.24.8 -DOPTION_OMP:STRING=yes -DLENSFUN_VERSION:STRING= -DEXIV2_VERSION:STRING=0.28.1 -DLCMS_VERSION_INFO:STRING=2.16-fastfloat -DART_MIMALLOC_VERSION_INFO:STRING=V2.1 -DSYSTEM:STRING="Linux" -DCXX_FLAGS:STRING=-O3\ -mfpmath=both\ -pipe\ -funroll-loops\ -fipa-pta\ -fno-plt\ -Wl,--hash-style=gnu\ -std=c++11\ -ffp-contract=off\ \ -Werror=unused-label\ -fno-math-errno\ -Wall\ -Wuninitialized\ -Wno-deprecated-declarations\ -Wno-unused-result\ -fopenmp\ -Werror=unknown-pragmas\ \ -ftree-vectorize -DLFLAGS:STRING=-Wl,-O1\ -Wl,--as-needed\ \ -DCOMPILER_INFO:STRING=x86_64-pc-linux-gnu-gcc\ 13.2.1 -DART_LIBRAW_VERSION_INFO:STRING="0.21.2" -DART_OCIO_VERSION_INFO:STRING="2.3.0" -DART_CTL_VERSION_INFO:STRING=version\ 1 -DBUILDINFO_OS:STRING=Linux -P /var/tmp/portage/media-gfx/ART-1.21/work/ART-1.21/UpdateInfo.cmake

Note this directive: -DPROC_LABEL:STRING=AMD\ A4-4300M\ APU\ with\ Radeon(tm)\ HD\ Graphics

Could that (tm) be the issue? May need to escape the parens in the label string (or quote it all maybe). Of course, take care of all such occurrences, there are several.

1 Like

I didn’t really address this sorry – I forgot I’m afraid :frowning:
But maybe you can simply redefine the var in CMakeCache.txt to remove the parentheses?

Hi Alberto,
I’ll give it a try, probably on Sunday, and will let you know. Thanks!

Okay. PROC_LABEL is "undefined" in CMakeCache.txt.
So I made an ulgy hack in CMakeLists.txt between configure and prepare stages, and it builds just fine. I suspect it would fail on any AMD APU…

Thanks, I’ll fix it later today

1 Like

Can you test whether this patch works?


diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,10 +82,11 @@
     if("${cpu}" STREQUAL "unknown")
+        set(_proc_label "${CMAKE_SYSTEM_PROCESSOR}")
-        set(PROC_LABEL "${cpu}")
+        set(_proc_label "${cpu}")
+    string(REGEX REPLACE "[^a-zA-Z0-9]" "_" PROC_LABEL "${_proc_label}")
 # If PROC_FORCED_LABEL exists, its value is loaded in PROC_LABEL to override the one from ProcessorTargets:

I always build ART with -DPROC_LABEL="arm64" on my M1. Works like a charm…

Yes, I can acknowledge that it works this way. Thanks!