unknown target CPU 'pentium-m'

Hi,

I asked this in cfe-users in September but
unfortunately it didn't receive much attention and
remains unresolved.

I am trying to cross compile a program on an i7 CPU
for a target "Intel(R) Celeron(R) M processor
1.50GHz". Here is `cat /proc/cpuinfo` for the target:

https://susepaste.org/40af776d

In my attempt to find the proper architecture name I
ran on the target:

gcc -march=native -Q --help=target | grep -- '-march=' | cut -f3

which gave me "pentium-m". Normally for gcc I would
use:

CFLAGS="-O3 -pipe -march=pentium-m -mtune=pentium-m"

However as per the subject of this message it seems
Clang doesn't recognize this target and throws a
series of similar errors:

error: unknown target CPU 'pentium-m'
note: valid target CPU values are: nocona, core2, penryn, bonnell, atom, silvermont, goldmont-plus, tremont, nehalem, corei7, westmere, sandybridge, corei7-avx, iavx-i, haswell, core-avx2, broadwell, skylake, skylake-avx512, skx, cannonlake, iicelake-server, knl, knm, k8, athlon64, athlon-fx, opteron, k8-sse3, athlon64-sse, amdfam10, barcelona, btver1, btver2, bdver1, bdver2, bdver3, bdver4, znver1, x8

Then I found this info:

https://stackoverflow.com/a/35061913

which suggests running:

$ llc --version
(to show supported architectures)

$ llc -march=ARCH -mattr=help
(to list "available CPUs" and "available features")

So I found for my case:

$ llc -march=x86 -mattr=help
Available CPUs for this target:
...
pentium-m - Select the pentium-m processor.
...

And I modified my script to use:

CFLAGS='-O3 -march=x86 -mtune=pentium-m'

Unfortunately clang complains again:

error: unknown target CPU 'x86'
note: valid target CPU values are: (same old list)

I hope someone can shed some light on all this. There
seem to be others complaining from the lack of info.

What target should I use and how can I optimize the
build for it?

Clang is rejecting pentium-m because the compiler is trying to output 64-bit mode code presumably because your host OS is a 64-bit OS. 64-bit code won’t run on pentium-m. I apologize that the error message for that is bad.

Add -m32 to your command line and that should fix it.

This works. Thanks!

Unfortunately now I am getting some other errors
(which I don't get if I compile or cross-compile for
64-bit architecture):

https://susepaste.org/a3d7b5bc

Any idea what else is needed?

Do you have 32bit libstdc++ headers installed? You can try adding -v to your clang++ command line to see which include directories are being used.

If you’re using suse (guessing based on your pastebin url), then maybe this is the package you need to install:
https://software.opensuse.org/package/libstdc++6-32bit

-Mostyn.

Do you have 32bit libstdc++ headers installed?

Yes:

https://susepaste.org/318d0e5a

You can try adding -v to your clang++ command line to
see which include directories are being used.

I am afraid this is not so simple because it is not
"my" command line in the sense that I didn't write the
scripts which call clang. Those scripts come with
chromium source and trying to find out all the
occurrences of clang++ in them seems an impossible task
for a non-developer like me.

What else can I do?

You can copy a sample failed compile command from your terminal, cd into the build directory (looks like “out/Release/gn_build/” in your log) and copy+paste the command and run it with -v appended.

-Mostyn.

Nice idea. So I have done that and the output is
(username hidden):

[/tmp/download/ungoogled-chromium/build/src/out/Release/gn_build]: ~/---builds/llvm-build/bin/clang++ -MMD -MF base/command_line.o.d -I/tmp/download/ungoogled-chromium/build/src/tools/gn -I/tmp/download/ungoogled-chromium/build/src/out/Release/gn_build -O3 -pipe -m32 -march=pentium-m -mtune=pentium-m -DNDEBUG -O3 -fdata-sections -ffunction-sections -D_FILE_OFFSET_BITS=64 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -pthread -pipe -fno-exceptions -fno-rtti -fdiagnostics-color -O3 -pipe -m32 -march=pentium-m -mtune=pentium-m -std=c++14 -Wno-c++11-narrowing -c /tmp/download/ungoogled-chromium/build/src/tools/gn/base/command_line.cc -o base/command_line.o -v
clang version 8.0.0 (trunk 346299)
Target: i386-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/████/---builds/llvm-build/bin
Found candidate GCC installation: /usr/lib64/gcc/x86_64-suse-linux/7
"/home/████/---builds/llvm-build-good/bin/clang-8" -cc1 -triple i386-unknown-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -discard-value-names -main-file-name command_line.cc -mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium-m -dwarf-column-info -debugger-tuning=gdb -momit-leaf-frame-pointer -v -ffunction-sections -fdata-sections -coverage-notes-file /tmp/download/ungoogled-chromium/build/src/out/Release/gn_build/base/command_line.gcno -resource-dir /home/████/---builds/llvm-build-good/lib/clang/8.0.0 -dependency-file base/command_line.o.d -MT base/command_line.o -I /tmp/download/ungoogled-chromium/build/src/tools/gn -I /tmp/download/ungoogled-chromium/build/src/out/Release/gn_build -D NDEBUG -D _FILE_OFFSET_BITS=64 -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -internal-isystem /usr/local/include -internal-isystem /home/████/---builds/llvm-build-good/lib/clang/8.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wno-c++11-narrowing -std=c++14 -fdeprecated-macro -fdebug-compilation-dir /tmp/download/ungoogled-chromium/build/src/out/Release/gn_build -ferror-limit 19 -fmessage-length 89 -pthread -fno-rtti -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp -o base/command_line.o -x c++ /tmp/download/ungoogled-chromium/build/src/tools/gn/base/command_line.cc -faddrsig
clang -cc1 version 8.0.0 based upon LLVM 8.0.0svn default target x86_64-unknown-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/tmp/download/ungoogled-chromium/build/src/tools/gn
/tmp/download/ungoogled-chromium/build/src/out/Release/gn_build
/usr/local/include
/home/████/---builds/llvm-build-good/lib/clang/8.0.0/include
/usr/include
End of search list.
In file included from /tmp/download/ungoogled-chromium/build/src/tools/gn/base/command_line.cc:5:
/tmp/download/ungoogled-chromium/build/src/tools/gn/base/command_line.h:19:10: fatal error:
      'map' file not found
#include <map>
         ^~~~~
1 error generated.

So what should be done to fix that?