Compiling Ruby 1.9.1-p129 on HPUX - ruby

I am trying to compile Ruby on HPUX but get the following:
cc: "transcode.c", line 1489: error 1588: "SIZE_MAX" undefined.
cc: "transcode.c", line 1489: error 1563: Expression in if must be scalar.

I had a problem with SIZE_MAX being undefined using aCC compiler without the C99 flag. Using this environment option in the ./configure got me past it, but I'm hitting other problems later on (miniruby compiles and links, but throws a Bus Error when the make process continues :-/). Does this help you build?
CC="cc -AC99" CPPFLAGS="-D_HPUX_SOURCE" ./configure

What HPUX and compiler version?
If I remember correctly SIZE_MAX is only available if you use c99 compiler and include stdint.h (not limits.h).

Related

macOS Sierra CoreFoundation error while compiling wxWidgets for SimSpark

I am trying to to compile wxWidgets 3.0.2 found here.
I need this library, so that I can compile SimSpark.
I have tried installing the library via MacPorts - this does work. But when I try to compile SimSpark, the compiler states the following:
In file included from /opt/local/include/gcc49/c++/type_traits:35:0,
from /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/include/wx-3.0/wx/strvararg.h:25,
from /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/include/wx-3.0/wx/string.h:46,
from /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/include/wx-3.0/wx/memory.h:15,
from /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/include/wx-3.0/wx/object.h:19,
from /opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.0/include/wx-3.0/wx/event.h:16,
from /Users/YEED/Downloads/simspark-0.2.4/plugin/inputwx/inputwx.cpp:23:
/opt/local/include/gcc49/c++/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
I believe that I need to compile wxWidgets with C++11 support, since I already included the C++11 relevant flags when making SimSpark.
When I try to compile wxWidgets, I get a bunch of compiler errors that refer to the same .h file - which is part of CoreFoundation:
In file included from /usr/include/Availability.h:184:0,
from /usr/include/stdlib.h:61,
from /usr/include/assert.h:44,
from ../include/wx/debug.h:13,
from ../include/wx/defs.h:743,
from ../include/wx/wxprec.h:12,
from ../src/common/filefn.cpp:20:
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDateFormatter.h:53:34: error: expected '}' before '__attribute__'
kCFISO8601DateFormatWithYear API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = (1UL << 0),
When you look into that specific file, there are a bunch of lines that miss a closing ) and resemble the one printed by the compiler as well. (There should be a closing ) before the comma at the end of the line, right?)
So my question is, is this an actual error in CoreFoundation? If so, how can I fix this or work around it? Or am I actually completely misunderstanding the compiler error thrown when compiling SimSpark in the first place?
EDIT:
I couldn't get wxWidgets to compile, but I have fixed my issues compiling SimSpark with the MacPorts version of wxWidgets. The problem lay within using different compilers (gcc and clang) for the two.

"dereferencing type-punned pointer" error when compiling Go 1.4.2

I'm compiling Go from source on Windows with MinGW. When running make.bat, I get the following error:
# Building C bootstrap tool.
cmd/dist
cmd/dist/windows.c: In function `errstr`:
cmd/dist/windows.c:119: warning: deferencing type-punned pointer will break strict-aliasing rules
I'm not very experienced with compiling on Windows, and it appears like this issue isn't very common, as Google doesn't return anything for it specific to Go.
Edit 1: Admittedly this is a warning, not an error. However a check in the code if errorlevel 1 goto fail appears to consider this output an error, and stops the progress of the script.
Go for Windows uses TDM-GCC, a compiler suite for 32- and 64-bit Windows based on the GNU toolchain.
For example,
C:\>gcc --version
gcc (tdm64-1) 4.9.2

Xcode custom compiler which wraps and does a passthru to clang

I'm trying to implement a certain pre-compilation effect on objective-C code (explained here). I've managed to get a custom compiler in place in Xcode 5 following these helpful instructions. However my passthru attempt to clang results in an error:
My custom compiler's executable:
#!/bin/bash
clang "$#"
Error message:
While building module 'UIKit' imported from /Users/Club15CC/Google Drive/Code/Frogger/Frogger/Frogger-Prefix.pch:14:
...
In file included from
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIApplication.h:13:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIDevice.h:33:1:
error: use of empty enum
};
^
/Users/Club15CC/Google Drive/Code/Frogger/Frogger/Frogger-Prefix.pch:14:13: fatal error: could not build module 'UIKit'
#import <UIKit/UIKit.h>
~~~~~~~^
2 errors generated.
Command /usr/bin/frogger failed with exit code 1
Note the executable is called frogger and the test Xcode project Frogger.
It builds fine with the default compiler. Does the enum error imply some flag isn't being passed through? Does bash have a limit to the size of $#? The compiler invoking string is rather long and perhaps is being truncated?
Thanks for any help...
---- UPDATE ----
It seems as though it's passing the wrong "minimum version" flag to the custom compiler: The normal LLVM compiler has this flag: -mios-simulator-version-min=7.0 while my custom one is getting this flag: -mmacosx-version-min=10.6 - which is the cause of the UIDevice error. The correct flags are handled inside of /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Specifications/Native Build System.xcspec and the equivalent one for iOS as opposed to simulator. It seems somehow my custom compilers not picking up these specs. I'm in over my head here!

Not able to enable C++11 using autoconf

I am trying to enable c++11 for gcc 4.6; I am using autconf and I added following to my configure.ac file
AC_PREREQ(2.61)
AC_INIT(SOLARCORE, 1.0.0, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE([1.10 no-define foreign])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/threading/node.h])
AC_CONFIG_HEADER([config.h])
AC_OUTPUT([Makefile src/threading/Makefile])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
#AC_LANG_PUSH([C++])
AC_LANG([C++])
AC_GNU_SOURCE
AX_CXX_COMPILE_STDCXX_11(,[mandatory])
CXXFLAGS='-Wall -std=gnu++0x'
AC_TYPE_SIZE_T
AC_OUTPUT
I am getting following error
./configure: line 4949: syntax error near unexpected token ,mandatory'
./configure: line 4949:AX_CXX_COMPILE_STDCXX_11(,mandatory)'
I also tried AX_CXX_COMPILE_STDCXX_11([ext],[mandatory])
I want to enable C++11 so that I can use it. I tried without AX_CXX_COMPILE_STDCXX_11 and with just CXXFLAGS in my Makefile but it is not working. So please help. THanks.
Found the answer: Recent version of AX_CXX_COMPILE_STDCXX_11 doesnt need a argument.
Are you sure you have the latest version of the macro? Judging from the history available from the autoconf archive, the original version of the macro only expected one argument, not two. If you've not got the second or third revisions of the test, that might account for your trouble.

Getting started with GCC plugins

So after searching the web for a while, Ive decided to try here as it seems to be a good forum for discussion. Im trying to create a simple gcc plugin. The program code is attached in the end of this mail, but in plain english it registers the plugin and makes sure that the pragma_init function is called when pragmas are registered. It is here that I use c_register_pragma to intercept some of the pragmas.
I compile it using the example in http://gcc.gnu.org/onlinedocs/gccint/Plugins-building.html#Plugins-building. The compilation and linking works fine. However, when I load the plug-in I get:
gcc -c -fplugin=plugin.so test.c -o test.o
cc1: error: cannot load plugin plugin.so
plugin.so: undefined symbol: warning
What am I doing wrong? In addition, when including some header files (that will be required later), I get a lot of errors. For example, including "tree.h" yields (amongst 50 other errors):
/machmode.h:262:1: error: unknown type name 'class'
class bit_field_mode_iterator
^
/machmode.h:263:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
{
^
/plugin/include/tree.h:27:0,
from conftest.c:63:
/vec.h:220:8: error: field 'register_overhead' declared as a function
Anyone have a clue on what I am doing wrong?
Thank you
There are two problems here :
The error : "cannot load plugin plugin.so" means that you should add to your LD_LIBRARY_PATH the directory where you store your new shared library plugin.
The hundreds of errors you got with all the files in the include are resolved in my computer if you compile with g++ instead of gcc (not sure to understand why thought)
Which version of GCC are you using, both to compile your plugin, and to use the plugin? Run simply
gcc -v
without any other program argument to find out!
Did you install the appropriate package for GCC plugin development (on Debian or Ubuntu, it might be gcc-4.7-plugin-dev, but adapt the 4.7 version to your particular version of GCC)?
Did you install all the dependencies needed to build your GCC (on Debian or Ubuntu, apt-get build-dep gcc-4.7 gcc-4.7-plugin-dev)?
Recent versions of GCC (notably many GCC 4.7 shipped by distributions, and all GCC 4.8) are compiled by a C++ compiler, not a C compiler.
You may check how was your GCC built (in C or in C++) by running
nm -D -C $(gcc -print-file-name=cc1)
If that command shows typed C++ manged names, e.g. execute_ipa_pass_list(opt_pass*) instead of just execute_ipa_pass_list your GCC has been compiled with a C++ compiler (probably g++)
So you may need to use g++ (not gcc) to compile your GCC plugin.
As I commented, did you consider using MELT (a domain specific language to extend GCC) to extend or customize your gcc compiler?
I suggest downloading the very latest http://gcc-melt.org/melt-plugin-snapshot.tar.bz2 since I will release the next MELT in a few weeks for GCC 4.7 and 4.8
And don't expect to change the parsing behavior of your GCC with a plugin. That is not really possible (GCC provides only plugin hooks to add your builtins and pragmas, not to extend the parsed syntax).

Resources