g++ cannot link libatomic library on Microsoft user-agent - azure-devops

I have a very simple dummy program call main.c as below:
#include <stdlib.h>
#include <stdio.h>
#define TEST __atomic_compare_exchange
void test() {
__int128 unsigned a = 1, b = 2, c = 3;
__atomic_compare_exchange_16(&a, &b, c, 1, 1, 1);
printf("hello");
}
When compile using the following command, it works fine on my local Linux machine (Debian gcc version 6):
g++ --shared -o libmain.so -latomic main.c -Wl,--no-as-needed
However when using Microsoft hosted agent ubuntu-18.04, it fails regardless of whatever command I tried. Below is a list of commands that I have tried:
g++ --shared -o libmain.so -latomic main.c -Wl,--no-as-needed
g++ --shared -o libmain.so /usr/lib/x86_64-linux-gnu/libatomic.so.1 main.c -Wl,--no-as-needed
g++ --shared -o libmain.so -L/usr/lib/x86_64-linux-gnu/ -l:libatomic.so.1 main.c -Wl,--no-as-needed
When run ldd libmain.so not libatomic is showed in the list:
linux-vdso.so.1 (0x00007ffc3c5b6000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f889324e000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f8892eb0000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f8892c98000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f88928a7000)
/lib64/ld-linux-x86-64.so.2 (0x00007f889385d000)
When run readelf -W -s libatomic.so, the __atomic_compare_exchange_16 shows as undefined without any suffix #... indicating the libatomic libary to look for.
Symbol table '.dynsym' contains 14 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND printf#GLIBC_2.2.5 (2)
2: 0000000000000000 0 FUNC WEAK DEFAULT UND __cxa_finalize#GLIBC_2.2.5 (2)
3: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND __atomic_compare_exchange_16
4: 0000000000000000 0 FUNC GLOBAL DEFAULT UND __stack_chk_fail#GLIBC_2.4 (3)
5: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTable
6: 0000000000000000 0 NOTYPE WEAK DEFAULT UND __gmon_start__
7: 0000000000000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable
8: 0000000000201038 0 NOTYPE GLOBAL DEFAULT 22 _edata
9: 0000000000201040 0 NOTYPE GLOBAL DEFAULT 23 _end
10: 000000000000070a 150 FUNC GLOBAL DEFAULT 12 _Z4testv
11: 00000000000005c0 0 FUNC GLOBAL DEFAULT 9 _init
12: 0000000000201038 0 NOTYPE GLOBAL DEFAULT 23 __bss_start
13: 00000000000007a0 0 FUNC GLOBAL DEFAULT 13 _fini
I have also check the g++ --print-search-dirs and the libraries search dirs look all correct to me.
Is Microsoft Hosted Agent environment just different or am I missing any obvious linker option?
Update
This is a fundamental concept to linker symbol search order that I have missed. Usually, linker searches for symbols from left to right, but for some modern linkers, all libraries are searched regardless of order. I have tested this on one my other ubuntu VM and changing the order does work as expected.
Will update once I have tested with the Microsoft hosted user-agent.
Update 2
I can confirm that it is the difference between gcc linker in Ubuntu and my local machine Debian.

To answer my own question.
The difference that I found is that on the Ubuntu machine, the gcc linker appear to search symbols in left to right order. Thus placing '-latomic' before the source file cause the reference to not be found and the library is not linked.
On my local Debian machine, the linker search in both directions so the library is linked regardless of location of the '-l' option in the command.

Related

Assembly file(.S) throw errors with GNU ARM toolchain in Eclipse photon

Ported assembly file from ARMCC syntax to GNU syntax. Throwing error while compilation.
Environment: GNU arm toolchain for ARM7 in Eclipse photon.
Requirement: Porting from keil ARMCC to GNU arm toolchain in eclipse.
Compiled and build properly. When I added an assembly file iap_blue.S(attached), facing compilation errors (Pasted below).
//iap_blue.S
.section .text,"x"
.balign 4
.globl blue_execute
blue_execute:
STMFD SP!,{LR} // Save Return Address
ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
ADR LR,blue_exit // Return Address
LDR R2,=0x7FFFFFF1 // IAP Entry (Thumb Mode)
BX R2 // Execute IAP Command
blue_exit:
LDMFD SP!,{LR} // Restore Return Address
BX LR // Return
.end
12:18:38 **** Build of configuration Debug for project LEDblink ****
make all
Building file: ../LPC2468_startup.c
Invoking: GNU ARM Cross C Compiler
arm-none-eabi-gcc -mcpu=arm7tdmi-s -march=armv4t -marm -mthumb-interwork -O0 -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -g3 -include"E:\EclipseARM\workspace\LEDblink\iap_blue.S" -std=gnu11 -MMD -MP -MF"LPC2468_startup.d" -MT"LPC2468_startup.o" -c -o "LPC2468_startup.o" "../LPC2468_startup.c"
In file included from <command-line>:
E:\EclipseARM\workspace\LEDblink\iap_blue.S:1:13: error: expected identifier or '(' before '.' token
1 | .section .text,"x"
| ^
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:17: error: unknown type name 'ADD'
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^~~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:31: error: stray '#' in program
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^
E:\EclipseARM\workspace\LEDblink\iap_blue.S:7:32: error: expected identifier or '(' before numeric constant
7 | ADD R1,R0,#0x14 // R0 = &IAP.cmd, R1 = &IAP.stat
| ^~~~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:14:17: error: unknown type name 'BX'
14 | BX LR // Return
| ^~
E:\EclipseARM\workspace\LEDblink\iap_blue.S:15:5: error: expected '=', ',', ';', 'asm' or '__attribute__' before '.' token
15 | .end
| ^
In file included from c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\arm-none-eabi\include\stdint.h:14,
from c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\lib\gcc\arm-none-eabi\9.2.1\include\stdint.h:9,
from ../LPC2468_startup.c:1:
c:\program files (x86)\gnu tools arm embedded\9 2019-q4-major\arm-none-eabi\include\sys\_stdint.h:20:9: error: unknown type name '__int8_t'
20 | typedef __int8_t int8_t ;
| ^~~~~~~~
subdir.mk:31: recipe for target 'LPC2468_startup.o' failed
make: *** [LPC2468_startup.o] Error 1
Thank you. Problem is solved.
I will like to elaborate on what was the mistake I was doing and how it is solved. This may be helpful for others.
Mistake 1:
I was using .s instead of .S for assembly file.
Mistake 2:
Included .S file in eclipse compiler include files as part of project settings.
Solution:
Checked C/C++ General --> File types which lists .S as assembly file. I changed .s to .S , mistake 1 is corrected.
Even though I was facing compilation errors which I have posted here.
I was not sure whether there is some eclipse-related issue or issue with my assembly file since I ported it to GNU syntax from ARMCC syntax.
I created my own make file and build the code using a command line, it builds successfully without any error. That means there was some issue with eclipse project configuration.
Then, I realized You don't have include assembly file in compiler settings. If You have already included it in the project. That alone will get the file to be recognized properly and assembled.
This solved the mistake2.
Thank you.

Error in ./configure step in installation of libpqxx

this is a bit of a long shot but:
I'm following this guide: https://www.tutorialspoint.com/postgresql/postgresql_c_cpp.htm
But when running ./configure I get the following error:
(previous checking lines omitted for brevity)
checking for main in -lpq... yes
checking for PQexec in -lpq... yes
checking for correct C++ linkage of basic libpq functions...
sed: character class syntax is [[:space:]], not [:space:]
configure: error:
Linking a call to libpq failed in C++, even though it succeeded in C. If your
C and C++ compilers are very different beasts, this may mean that we do not have
the right options for linking with it after all.
Read the config.log file for more detailed information. Look for the last error
message, which may be several pages up from the end of the file.
And the configure.log file looks like this:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpqxx configure 4.0, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ ./configure
## --------- ##
## Platform. ##
## --------- ##
(some lines omitted)
configure:3039: g++ -V >&5
g++: error: unrecognized command line option '-V'
g++: fatal error: no input files
compilation terminated.
configure:3050: $? = 1
configure:3039: g++ -qversion >&5
g++: error: unrecognized command line option '-qversion'; did you mean '--version'?
g++: fatal error: no input files
compilation terminated.
(some lines omitted)
configure:7629: gcc -E conftest.c
conftest.c:11:10: fatal error: ac_nonexistent.h: No such file or directory
#include <ac_nonexistent.h>
^~~~~~~~~~~~~~~~~~
compilation terminated.
(some lines omitted)
configure:8319: gcc -c -g -O2 -fno-rtti -fno-exceptions conftest.c >&5
cc1: warning: command line option '-fno-rtti' is valid for C++/ObjC++ but not for C
(some lines omitted)
configure:16424: g++ -o conftest -g -O2 -L/usr/lib/x86_64-linux-gnu conftest.cpp >&5
/tmp/ccfFBf4K.o: In function `main':
/home/peter/libpqxx-4.0/conftest.cpp:44: undefined reference to `PQexec'
collect2: error: ld returned 1 exit status
(some liens omitted)
I don't believe I have any packages missing. I have the newest version of g++, psql and libpqxx installed.
I have updated and upgraded all packages on my system.
I have crawled the web for solutions to this error, but I have no clue what is wrong.
Do you have an idea where I can go from here?
There hasn't been a tarball release of libpqxx at the old spot in a long time, so the tutorial you used with its wget command to download the tarball is very outdated.
The issue you encountered looks related to this issue and appears to have been fixed in this commit:
commit 85e9336740475be25ed19924cca0961f7d844c4b
Author: Jeroen Vermeulen <jtvjtv#gmail.com>
Date: Thu Jun 1 11:39:08 2017 +0700
Fix #13: not linking to libpq.
This was that annoying interaction between autoconf, m4, GNU sed syntax,
and the shell which broke the "remove redundant -lpq options" code in
the configure script.
Solution: forget about GNU sed's "[[:space:]]" syntax, and just look for
a literal space. There aren't going to be any tabs, newlines,
non-breaking spaces, etc. there in even a moderately sane world.

MEX fortran file using Gnumex and MinGW (g77)

There is a problem that I ran into recently. It used to be working fine as far as I remember but after a few week I am trying again to MEX a fortran 77 file in MATLAB but it is giving me a weird error.
Ok, I made the MEX options file using Gnumex which is named mexopts_f77.bat.
This is the command that I run in MATLAB:
mex -v -f C:\Omid\Other\Gnumex\mexopts_f77.bat -c sodex.f decsol.f
And this is the the error that I get:
-> Options file specified on command line
----------------------------------------------------------------
-> Options file = C:\Omid\Other\Gnumex\mexopts_f77.bat
MATLAB = C:\PROGRA~2\MATLAB\R2011b
-> COMPILER = gcc
-> Compiler flags:
COMPFLAGS = -c -DMATLAB_MEX_FILE -fcase-upper -fnounderscoring
OPTIMFLAGS = -O0
DEBUGFLAGS = -g
arguments =
Name switch = -o
-> Pre-linking commands =
-> LINKER = C:\PROGRA~2\MATLAB\R2011b\sys\perl\win32\bin\perl.exe C:\omid\other\gnumex\linkmex.pl
-> Link directives:
LINKFLAGS = -LC:\Omid\Other\Gnumex\libs
LINKDEBUGFLAGS = -g -Wl,--image-base,0x28000000\n
LINKFLAGSPOST =
Name directive = -o sodex.mexw32
File link directive =
Lib. link directive =
Rsp file indicator =
-> Resource Compiler = C:\PROGRA~2\MATLAB\R2011b\sys\perl\win32\bin\perl.exe C:\omid\other\gnumex\rccompile.pl -o mexversion.res
-> Resource Linker =
----------------------------------------------------------------
--> gcc -c -DMATLAB_MEX_FILE -fcase-upper -fno-underscoring -osodex.obj -O0 -DMX_COMPAT_32 sodex.f
gcc: error: unrecognized command line option '-fcase-upper'
C:\PROGRA~2\MATLAB\R2011B\BIN\MEX.PL: Error: Compile of 'sodex.f' failed.
I think the problem is with -fcase-upper option. I looked it up but could not find any information regrading that option for gcc.
Edit:
I manually changed gcc to g77 in my options file and was successful to create the object files but still getting an error in the final step where I try to link the object files to the main fortran script named vdpsodex.F and create the MEX file. As requested, I am including the option file:
#echo off
rem C:\Omid\Other\Gnumex\mexopts_f77.bat
rem Generated by gnumex.m script in C:\omid\other\gnumex
rem gnumex version: 2.06
rem Compile and link options used for building MEX etc files with
rem the Mingw/Cygwin tools. Options here are:
rem Gnumex, version 2.06
rem MinGW linking
rem Mex (*.dll) creation
rem Libraries regenerated now
rem Language: Fortran 77
rem Optimization level: -O0 (no optimization)
rem StorageVersion: 1.0
rem C++keyName: GNU C++
rem C++keyManufacturer: GNU
rem C++keyLanguage: C++
rem C++keyVersion:
rem C++keyFileName: GNUMEXOPTS.bat
rem Matlab version 7.13
rem
set GCCINSTALLDIR=C:\Omid\Other\MinGW\bin
set MATLAB=C:\PROGRA~2\MATLAB\R2011b
set GM_PERLPATH=C:\PROGRA~2\MATLAB\R2011b\sys\perl\win32\bin\perl.exe
set GM_UTIL_PATH=C:\omid\other\gnumex
set PATH=C:\Omid\Other\MinGW\bin;%PATH%
set PATH=%PATH%;C:\Cygwin\usr\local\gfortran\libexec\gcc\i686-pc-cygwin\4.3.0
set LIBRARY_PATH=C:\Omid\Other\MinGW\lib
set G95_LIBRARY_PATH=C:\Omid\Other\MinGW\lib
set MW_TARGET_ARCH=win32
rem
rem precompiled library directory and library files
set GM_QLIB_NAME=C:\Omid\Other\Gnumex\libs
rem
rem directory for .def-files
set GM_DEF_PATH=C:\Omid\Other\Gnumex\libs
rem
rem Type of file to compile (mex or engine)
set GM_MEXTYPE=mex
rem
rem Language for compilation
set GM_MEXLANG=f77
rem
rem File for exporting mexFunction symbol
set GM_MEXDEF=C:\Omid\Other\Gnumex\libs\fmex.def
rem
set GM_ADD_LIBS=-lg2c -lflibmx -lflibmex -lflibmat
rem
rem compiler options; add compiler flags to compflags as desired
set NAME_OBJECT=-o
rem ************ This is where I replaced gcc with g77 ************
set COMPILER=g77
rem ***************************************************************
set COMPFLAGS=-c -DMATLAB_MEX_FILE -fcase-upper -fno-underscoring
set OPTIMFLAGS=-O0
set DEBUGFLAGS=-g
rem
rem NB Library creation commands occur in linker scripts
rem but LIBLOC is provided for compatibility with
rem mex.getCompilerConfigurations
rem
rem Linker parameters
set LIBLOC=
set LINKER=%GM_PERLPATH% %GM_UTIL_PATH%\linkmex.pl
set LINKFLAGS=
set LINKOPTIMFLAGS=-s
set LINKDEBUGFLAGS=-g -Wl,--image-base,0x28000000\n
set LINKFLAGS= -LC:\Omid\Other\Gnumex\libs
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT=-o %OUTDIR%%MEX_NAME%.mexw32
rem
rem Resource compiler parameters
set RC_COMPILER=%GM_PERLPATH% %GM_UTIL_PATH%\rccompile.pl -o %OUTDIR%mexversion.res
set RC_LINKER=
Now the above code does give me the object files but when I try to make the final MEX file using below command:
mex -v -f C:\Omid\Other\Gnumex\mexopts_f77.bat vdpsodex.F sodex.obj decsol.obj
it gives me the following error:
-> Options file specified on command line
----------------------------------------------------------------
-> Options file = C:\Omid\Other\Gnumex\mexopts_f77.bat
MATLAB = C:\PROGRA~2\MATLAB\R2011b
-> COMPILER = g77
-> Compiler flags:
COMPFLAGS = -c -DMATLAB_MEX_FILE -fcase-upper -fno-underscoring
OPTIMFLAGS = -O0
DEBUGFLAGS = -g
arguments =
Name switch = -o
-> Pre-linking commands =
-> LINKER = C:\PROGRA~2\MATLAB\R2011b\sys\perl\win32\bin\perl.exe C:\omid\other\gnumex\linkmex.pl
-> Link directives:
LINKFLAGS = -LC:\Omid\Other\Gnumex\libs
LINKDEBUGFLAGS = -g -Wl,--image-base,0x28000000\n
LINKFLAGSPOST =
Name directive = -o vdpsodex.mexw32
File link directive =
Lib. link directive =
Rsp file indicator =
-> Resource Compiler = C:\PROGRA~2\MATLAB\R2011b\sys\perl\win32\bin\perl.exe C:\omid\other\gnumex\rccompile.pl -o mexversion.res
-> Resource Linker =
----------------------------------------------------------------
--> g77 -c -DMATLAB_MEX_FILE -fcase-upper -fno-underscoring -oC:\Users\GHASEM~1\AppData\Local\Temp\2\mex_7FJjxb\vdpsodex.obj -O0 -DMX_COMPAT_32 vdpsodex.F
--> C:\PROGRA~2\MATLAB\R2011b\sys\perl\win32\bin\perl.exe C:\omid\other\gnumex\linkmex.pl -o vdpsodex.mexw32 -LC:\Omid\Other\Gnumex\libs -s C:\Users\GHASEM~1\AppData\Local\Temp\2\mex_7FJjxb\vdpsodex.obj sodex.obj decsol.obj
C:\Omid\Other\Gnumex\libs/flibmx.lib(ds00068.o):(.idata$7+0x0): undefined reference to `_head_C__Omid_Other_Gnumex_libs_flibmx_lib'
C:\Omid\Other\Gnumex\libs/flibmx.lib(ds00086.o):(.idata$7+0x0): undefined reference to `_head_C__Omid_Other_Gnumex_libs_flibmx_lib'
C:\Omid\Other\Gnumex\libs/flibmx.lib(ds00062.o):(.idata$7+0x0): undefined reference to `_head_C__Omid_Other_Gnumex_libs_flibmx_lib'
C:\Omid\Other\Gnumex\libs/flibmx.lib(ds00157.o):(.idata$7+0x0): undefined reference to `_head_C__Omid_Other_Gnumex_libs_flibmx_lib'
C:\Omid\Other\Gnumex\libs/flibmx.lib(ds00161.o):(.idata$7+0x0): undefined reference to `_head_C__Omid_Other_Gnumex_libs_flibmx_lib'
collect2: ld returned 1 exit status
link command: g77 -shared C:\Omid\Other\Gnumex\libs\fmex.def -o vdpsodex.mexw32 -LC:\Omid\Other\Gnumex\libs -s C:\Users\GHASEM~1\AppData\Local\Temp\2\mex_7FJjxb\vdpsodex.obj sodex.obj decsol.obj -lg2c -lflibmx -lflibmex -lflibmat
C:\PROGRA~2\MATLAB\R2011B\BIN\MEX.PL: Error: Link of 'vdpsodex.mexw32' failed.
emphasized textFinally, I was able to pin point the issue and I thought it might be beneficial to others who may be facing the same issue (or similar to this one) to share the answer. Let me just mention that it was looking strange to me at the first place because I had MEX'ed the exact same files using an option files created by Gnumex and had not problem at all. I just noticed that because I changed my MinGW build a while ago I was not able to MEX the same Fortran files anymore even though I re-created the options file (mexopts_f77.bat).
Anyways, to make the long story short I found this link very useful. Basically, it suggests downloading five packages and extracting them to the root directory of MinGw. Four of those links are still alive. One of them is dead but I found it by Googling the package name. What you see below is the updated links of the packages.
Last but not least, here is the solution if your g77 is not working with a Gnumex-made options file:
Download following packages:
binutils-2.19.1-mingw32-bin.tar.gz
gcc-core-3.4.5-20060117-3.tar.gz
gcc-g77-3.4.5-20060117-3.tar.gz
mingw-runtime-3.14.tar.gz
w32api-3.11.tar.gz
Extract them to your MinGW root directory, e.g. C:\MinGW
Re-make your options file by selecting Fortran 77 as compilation language, e.g. mexopt_f77.bat
MEX you Fortran script using following syntax.
mex -f [options-file] [fortran-file.f]
If you need to link some files to the main script then you have to compile them first to object files and then link them.
mex -f [options-file] -c [linkfile1.f] [linkfile2.f]
mex -f [options-file] [fortran-file.f] [linkfile1.obj] [linkfile2.obj]

Inline::C build failure

I am using active perl 5.14.2. Here I am trying to use a windows C library in my perl code using Inline::C
use strict;
use Inline C => DATA =>
CCFLAGS => '-std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_' =>
INC => '"-ID:\test\incl"' =>
LIBS => '"-LD:\test\lib" -llib1 -llib2 -llib3 -llib4';
test();
__END__
__C__
#include <incl/hd1.h>
#include <stdio.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
void test(void) {
.........
While I am trying to run the script its failing with below error
Warning. No Inline C functions bound to Perl in .\test.pl
Check your C function definition(s) for Inline compatibility
Microsoft (R) Program Maintenance Utility Version 9.00.30729.01
Copyright (C) Microsoft Corporation. All rights reserved.
C:\Perl5.14\bin\perl.exe C:\Perl5.14\lib\ExtUtils\xsubpp -typemap "C:\Perl5.14\lib\ExtUtils\typemap" test_pl_7fbb.xs > test_pl_7fbb.xsc && C:\Perl5.14\bin\perl.exe -M
ExtUtils::Command -e "mv" -- test_pl_7fbb.xsc test_pl_7fbb.c
cl -c -I"D:/test" "-ID:\test\incl" -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -Gd -Ze -Go -D_USER_SPACE_ -MD -Zi -DNDEBUG -O1 -DVERSIO
N=\"0.00\" -DXS_VERSION=\"0.00\" "-IC:\Perl5.14\lib\CORE" test_pl_7fbb.c
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\cl.EXE"' : return code '0xc0000135'
Stop.
A problem was encountered while attempting to compile and install your Inline
C code. The command that failed was:
C:\PROGRA~2\MICROS~1.0\VC\bin\nmake.exe > out.make 2>&1
The build directory was:
D:\test\_Inline\build\test_pl_7fbb
To debug the problem, cd to the build directory, and inspect the output files.
at .\test.pl line 0
...propagated at C:/Perl5.14/site/lib/Inline/C.pm line 772.
INIT failed--call queue aborted.
PS D:\cmapl_test> perl -v
This is perl 5, version 14, subversion 2 (v5.14.2) built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Binary build 1402 [295342] provided by ActiveState http://www.ActiveState.com
Built Oct 7 2011 15:49:44
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
I tried to build the test_pl_7fbb.c file using the command:
cl -c "-ID:\test" "-ID:\test\include" -std:C99 -Tx86-coff -Zi -Ob1 -fp:precise -W1 -
Gd -Ze -Go -D_USER_SPACE_ -MD -Zi -DNDEBUG -O1 "-DVERSION=0.00"
"-DXS_VERSION=0.00" "-IC:\Perl5.14\lib\CORE" test_pl_7fbb.c
It got completed without error.
My guess the option -I"D:/test" used by Inline while compiling is causing the issue.
Thanks in advance for any help on this.
You seem to have installed Visual C VC-9 (VS 2008), but last time I used Activeperl's Inline C it required VC-6.
If that's the reason, you could try to install VC 6 or switch to Strawberry Perl which has the gcc 4.6 tool chain included.
You could try installing MinGW from ActivePerl's PPM servers. It would probably need a recompile of many of your installed modules to work, but i'm sure it'll make things like Inline::C work properly.

Compiling Ncurses on Solaris - "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"?

I'm trying to compile a GNU stack on Solaris 10 (x86).
I've managed to get the following up so far:
GMP
MPFR
MPC
GCC
binutils
libiconv
gettext
I'm currently trying to build Ncurses, and I'm hitting an error:
/db/pub/eq/tools/bin/g++ -I../c++ -I../include -I/db/pub/eq/src/ncurses-5.9/c++ -DHAVE_CONFIG_H -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -D_FILE_OFFSET_BITS=64 -DNDEBUG -I. -I../include -I/db/pub/eq/src/ncurses-5.9/c++/../include -I/db/pub/eq/tools/include/ncurses -O2 -c /db/pub/eq/src/ncurses-5.9/c++/cursesf.cc -o ../objects/cursesf.o
<command-line>:0:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
<built-in>:0:0: note: this is the location of the previous definition
In file included from /usr/include/iso/stdlib_iso.h:30:0,
from /usr/include/stdlib.h:18,
from /db/pub/eq/src/ncurses-5.9/c++/internal.h:53,
from /db/pub/eq/src/ncurses-5.9/c++/cursesf.cc:34:
/db/pub/eq/tools/lib/gcc/i386-pc-solaris2.10/4.6.1/include-fixed/sys/feature_tests.h:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"
*** Error code 1
make: Fatal error: Command failed for target `../objects/cursesf.o'
Current working directory /db/pub/eq/src/ncurses-5.9/c++
*** Error code 1
make: Fatal error: Command failed for target `all'
I'm not quite sure what the above error (Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications) means, or how to troubleshoot it.
I saw this error once before when I was building MPC (during gmake check), but I had no idea what it meant then, or how to fix it - but since it was in checks, it was ok.
Cheers,
Victor
apply this patch to the configure script:
--- configure.orig Fri Aug 5 14:28:28 2011
+++ configure Fri Aug 5 14:31:11 2011
## -7246,7 +7246,7 ##
# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
;;
solaris2.1[0-9]) #(vi
- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ cf_xopen_source="-D__EXTENSIONS__"
;;
solaris2.[1-9]) #(vi
cf_xopen_source="-D__EXTENSIONS__"
Ncurses 5.6 did not define _XOPEN_SOURCE for solaris either.
Cheers