1

I am running the following command, with the verbose output below it:

$ clang++ -m32 -I ../include -o format.cc.o -c format.cc -v
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: i386-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: 32;@m32
 "/usr/lib/llvm-6.0/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name format.cc -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -fuse-init-array -target-cpu pentium4 -dwarf-column-info -debugger-tuning=gdb -v -coverage-notes-file /home/TABLETOPMEDIA/robert/frontend/Core/ThirdParty/fmt/src/format.cc.gcno -resource-dir /usr/lib/llvm-6.0/lib/clang/6.0.0 -I ../include -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++ -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/x86_64-linux-gnu/32 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/backward -internal-isystem /usr/include/clang/6.0.0/include/ -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-6.0/lib/clang/6.0.0/include -internal-externc-isystem /usr/include/i386-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/TABLETOPMEDIA/robert/frontend/Core/ThirdParty/fmt/src -ferror-limit 19 -fmessage-length 142 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o format.cc.o -x c++ format.cc
clang -cc1 version 6.0.0 based upon LLVM 6.0.0 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/x86_64-linux-gnu/32"
ignoring nonexistent directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/backward"
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/include/clang/6.0.0/include"
#include "..." search starts here:
#include <...> search starts here:
 ../include
 /usr/bin/../lib/gcc/x86_64-linux-gnu/8/../../../../include/c++
 /usr/include/clang/6.0.0/include
 /usr/local/include
 /usr/include/i386-linux-gnu
 /usr/include
End of search list.
In file included from format.cc:8:
In file included from ../include/fmt/format-inl.h:11:
../include/fmt/format.h:31:10: fatal error: 'algorithm' file not found
#include <algorithm>
         ^~~~~~~~~~~
1 error generated.

I'm on Ubuntu 18.04 (64-bit) compiling using 32-bit libraries. I do have STL headers at /usr/include/c++/7, but this doesn't appear to be in the paths shown above. Is this an OS problem with my Ubuntu installation? Which packages might I be missing if so?

EDIT

I have g++-multilib installed:

$ dpkg -l | grep multilib
ii  g++-7-multilib                        7.3.0-25ubuntu1~18.04               amd64        GNU C++ compiler (multilib support)
ii  g++-multilib                          4:7.3.0-3ubuntu2                    amd64        GNU C++ compiler (multilib files)
ii  gcc-7-multilib                        7.3.0-25ubuntu1~18.04               amd64        GNU C compiler (multilib support)
ii  gcc-8-multilib                        8.1.0-10ubuntu1~18.04               amd64        GNU C compiler (multilib support)
ii  gcc-multilib                          4:7.3.0-3ubuntu2                    amd64        GNU C compiler (multilib files)

However, it only shows installed for amd64, assuming I need the i386 version, I tried installing that but it fails:

$ sudo apt install g++-multilib:i386
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 g++-multilib:i386 : Depends: gcc-multilib:i386 (>= 4:7.3.0-3ubuntu2) but it is not going to be installed
                     Depends: g++:i386 (>= 4:7.3.0-3ubuntu2) but it is not going to be installed
                     Depends: g++-7-multilib:i386 (>= 7.3.0-12~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

Weirdly, I have a foreign architecture installed through dpkg and I was hoping the i386 versions of packages would be automatically installed for me:

$ dpkg --print-foreign-architectures
i386
  • 1
    Is the g++-multilib package installed? – steeldriver Jul 18 '18 at 19:19
  • @steeldriver I have updated my post with more details related to your question. – void.pointer Jul 18 '18 at 19:30
  • You don't want g++-multilib:i386 - that would be for cross-compiling 64-bit on a 32-bit host – steeldriver Jul 18 '18 at 19:32
  • The solution, oddly, was to install g++-8-multilib... this is very confusing :( – void.pointer Jul 18 '18 at 19:42
  • 1
    OK so I guess clang++ tries to use the newest g++ that it detects (and all its associated components - including multilib) whereas installing g++-multilib only installs it for the default g++ (likely g++-7 on your system) – steeldriver Jul 18 '18 at 19:51

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.