Clang uses wrong include headers when compiling 32 bit on 64 bit ubuntu

Bug #998046 reported by Alan Birtles
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
clang (Ubuntu)
New
Undecided
Unassigned

Bug Description

64-bit clang uses 64-bit headers when compiling 32-bit code. GCC works correctly.

This example program reproduces the problem:

#include <fstream>

int main(void)
{
  std::ifstream in( "test.dat" );
  in.rdbuf()->pubseekoff( 0, std::ios::beg, std::ios_base::in );
}

This can then be built with:

#!/bin/bash
BUILD=clang++
#BUILD=g++
$BUILD -m32 -c test.cpp
$BUILD -m32 -v test.o

Which produces a link error with clang but not with gcc:
test.cpp:(.text+0x76): undefined reference to `std::basic_streambuf<char, std::char_traits<char> >::pubseekoff(long, std::_Ios_Seekdir, std::_Ios_Openmode)'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

All the above was done on Ubuntu 12.04 64 bit with clang 3.0-6ubuntu3

Revision history for this message
Sylvestre Ledru (sylvestre) wrote :

Could you report upstream too (Debian) ?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.