New user self-registration is disabled due to spam. For an account please email bugs-admin@lists.llvm.org with your e-mail address and full name.

Bug 20380 - Fails to build under GNU/Linux Powerpc
Summary: Fails to build under GNU/Linux Powerpc
Status: RESOLVED FIXED
Alias: None
Product: lldb
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: LLDB commit list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-21 02:39 PDT by Sylvestre Ledru
Modified: 2014-08-04 15:01 PDT (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
Use __linux__ instead of __linux (2.37 KB, patch)
2014-07-29 10:37 PDT, Dimitri John Ledkov
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvestre Ledru 2014-07-21 02:39:10 PDT
LLDB fails to build under GNU/Linux powerpc:

if  g++-4.9 -I/«PKGBUILDDIR»/build-llvm/include -I/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi -I/«PKGBUILDDIR»/include -I/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi  -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/../../include -I/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/../../include -I/«PKGBUILDDIR»/tools/clang/include -I/«PKGBUILDDIR»/build-llvm/tools/clang/include -I/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/../../source -I/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/../../source/Utility -I/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/../../source/Plugins/Process/Utility -I/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/../../source/Plugins/Process/POSIX -I/usr/include/python2.7 -I/usr/include/powerpc-linux-gnu/python2.7 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -g -O2 -fomit-frame-pointer -std=c++11 -fvisibility-inlines-hidden -fno-exceptions -fPIC -Woverloaded-virtual -ffunction-sections -fdata-sections -Wcast-qual -fno-strict-aliasing -std=c++0x -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2 -D_FORTIFY_SOURCE=2  -Wall -W -Wno-unused-parameter -Wwrite-strings  -Wno-unknown-pragmas -Wno-sign-compare -Wno-sign-compare -Wno-unused-function   -Wno-maybe-uninitialized -Wno-missing-field-initializers -c -MMD -MP -MF "/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/Release/MICmnLogMediumFile.d.tmp" -MT "/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/Release/MICmnLogMediumFile.o" -MT "/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/Release/MICmnLogMediumFile.d" /«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/MICmnLogMediumFile.cpp -o /«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/Release/MICmnLogMediumFile.o ; \
        then /bin/mv -f "/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/Release/MICmnLogMediumFile.d.tmp" "/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/Release/MICmnLogMediumFile.d"; else /bin/rm "/«PKGBUILDDIR»/build-llvm/tools/lldb/tools/lldb-mi/Release/MICmnLogMediumFile.d.tmp"; exit 1; fi
/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/MICmnLogMediumFile.cpp: In member function 'bool CMICmnLogMediumFile::FileFormFileNamePath()':
/«PKGBUILDDIR»/tools/lldb/tools/lldb-mi/MICmnLogMediumFile.cpp:225:20: error: 'CMIUtilSystem' was not declared in this scope
  if( CMIUtilSystem().GetLogFilesPath( strPathName ) )
                    ^

Full log:
https://buildd.debian.org/status/fetch.php?pkg=llvm-toolchain-snapshot&arch=powerpc&ver=1%3A3.5~svn213451-1&stamp=1405816471
Comment 1 Dimitri John Ledkov 2014-07-29 10:06:22 PDT
Something very odd is going on.

In: tools/lldb/tools/lldb-mi/MICmnLogMediumFile.cpp

If I add two static asserts just before the relevant SystemLinux inclusion I get:
static_assert(__linux__ == 1, "__linux__ == 1 failed");
static_assert(__linux == 1, "__linux == 1 failed");

#if defined( _MSC_VER )
        #include "MIUtilSystemWindows.h"
#elif defined( __FreeBSD__ ) || defined( __linux__ )
        #include "MIUtilSystemLinux.h"
#elif defined( __APPLE__ )
        #include "MIUtilSystemOsx.h"
#endif // defined( _MSC_VER )


I get:

/home/xnox/llvm-toolchain-3.5-3.5~+rc1/tools/lldb/tools/lldb-mi/MICmnLogMediumFile.cpp:31:15: error: '__linux' was not declared in this scope
 static_assert(__linux == 1, "__linux == 1 failed");

So __linux__ is defined, and __linux is not. I typically saw everyone use __linux__, but looks like it should be defined on powerpc if it's defined on all other arches.
Comment 2 Dimitri John Ledkov 2014-07-29 10:16:29 PDT
Looks like there is something wrong with the powerpc g++-4.9 compiler:

$ g++-4.9 -dM -E - < /dev/null | grep linux
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1
#define linux 1

$ g++-4.9 -std=c++0x -dM -E - < /dev/null | grep linux
#define __linux__ 1
#define __gnu_linux__ 1
Comment 3 Dimitri John Ledkov 2014-07-29 10:24:11 PDT
As per, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=28314 __linux__ should be used, instead of __linux. I'll provide a patch.
Comment 4 Dimitri John Ledkov 2014-07-29 10:37:07 PDT
Created attachment 12837 [details]
Use __linux__ instead of __linux
Comment 5 Sylvestre Ledru 2014-07-29 10:39:30 PDT
Looks great. Many thanks.
Do you need someone to commit that for you?
Comment 6 Dimitri John Ledkov 2014-07-29 10:51:00 PDT
(In reply to comment #5)
> Looks great. Many thanks.
> Do you need someone to commit that for you?

My test build is still running here.

And yes, I will need someone to sponsor/commit this patch. I don't have any commit rights in llvm.
Comment 7 Sylvestre Ledru 2014-07-30 02:55:40 PDT
Your tests are OK ?
Comment 8 Dimitri John Ledkov 2014-07-30 03:30:54 PDT
(In reply to comment #7)
> Your tests are OK ?

Yeap, all is good. After I test mesa, in Ubuntu we will probably switch to 3.5 by default now.

https://launchpad.net/ubuntu/+source/llvm-toolchain-3.5/1:3.5~+rc1-1ubuntu2/+build/6222106
Comment 9 Sylvestre Ledru 2014-07-30 03:34:12 PDT
(In reply to comment #8)
> (In reply to comment #7)
> > Your tests are OK ?
> 
> Yeap, all is good. 
Thanks, Commit as r214291.

> After I test mesa, in Ubuntu we will probably switch to
> 3.5 by default now.
That sounds premature and too early for me.
You should wait at least for the final version.
Comment 10 Bill Wendling 2014-08-04 13:21:40 PDT
Is this for 3.5?
Comment 11 Sylvestre Ledru 2014-08-04 13:49:09 PDT
Yes
Comment 12 Bill Wendling 2014-08-04 15:01:33 PDT
(In reply to comment #11)
> Yes

Done. Thanks!