New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Will not compile on Solaris 11 with gcc #28
Comments
Your environment misses diff --git a/include/common.hpp b/include/common.hpp
index f674d8a..ab7398a 100644
--- a/include/common.hpp
+++ b/include/common.hpp
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <stdint.h>
#include <memory.h>
#include <iostream> |
Thanks so much for the pointer! Things got a little farther, but still no luck. It looks like it does not realize that it should be compiling C++. Maybe I need to explicitly define the include for iostream? Here is the output: cpan[9]> test Compiler::Lexer CPAN.pm: Going to build G/GO/GOCCY/Compiler-Lexer-0.18.tar.gz Created MYMETA.yml and MYMETA.json |
@jimhall Could you try to apply following patch for compiling sources as C++ ? diff --git a/builder/MyBuilder.pm b/builder/MyBuilder.pm
index d8b5dd4..fb532f1 100644
--- a/builder/MyBuilder.pm
+++ b/builder/MyBuilder.pm
@@ -15,7 +15,7 @@ sub new {
c_source => [qw/src/],
xs_files => { 'src/Compiler-Lexer.xs' => 'lib/Compiler/Lexer.xs' },
cc_warnings => 0, # TODO
- extra_compiler_flags => ['-Iinclude', @ignore_warnings_options, '-g3'],
+ extra_compiler_flags => ['-Iinclude', @ignore_warnings_options, '-g3', '-x', 'c++'],
add_to_cleanup => [
'lib/Compiler/Lexer/*.o', 'lib/Compiler/Lexer/*.c',
'lib/Compiler/Lexer/*.xs', |
|
Ah may not be that bad. On my Linux env: [oracle@localhost Lexer]$ ldd Lexer.so On my Solaris box: ldd /home/jhall/.cpan/build/Compiler-Lexer-0.18-2QYcAh/blib/arch/auto/Compiler/Lexer/Lexer.so So maybe one of the switches I need is for the C++ std library? |
Could you specified linker option diff --git a/builder/MyBuilder.pm b/builder/MyBuilder.pm
index d8b5dd4..065f96a 100644
--- a/builder/MyBuilder.pm
+++ b/builder/MyBuilder.pm
@@ -15,7 +15,8 @@ sub new {
c_source => [qw/src/],
xs_files => { 'src/Compiler-Lexer.xs' => 'lib/Compiler/Lexer.xs' },
cc_warnings => 0, # TODO
- extra_compiler_flags => ['-Iinclude', @ignore_warnings_options, '-g3'],
+ extra_compiler_flags => ['-Iinclude', @ignore_warnings_options, '-g3', '-x', 'c++'],
+ extra_linker_flags => ['-lstdc++'],
add_to_cleanup => [
'lib/Compiler/Lexer/*.o', 'lib/Compiler/Lexer/*.c',
'lib/Compiler/Lexer/*.xs', |
Ok - that did it! But, I noticed that I had in entry in my MyConfig.pm in my CPAN shell: mbuild_arg [--extra_linker_flags -L/export/code/perl5/lib] This seemed to overwrite your extra_linker_flags entry. Once I zero'd this option out, your option took precedence. And everything compiled! I do get the following warning: src/compiler/lexer/Compiler_lexer.cpp: In member function ‘void Lexer::parseSpecificStmt(Token*)’: Otherwise - clean: ExtUtils::Mkbootstrap::Mkbootstrap('blib/arch/auto/Compiler/Lexer/Lexer.bs') Is there something wrong with my environment that I needed these extra flags or are you making some assumptions that are common to these environments? I can't find these options in Config_heavy.pl for example. Also - what packaging framework are you using? Is it CPAN::Meta? Thank you so much for taking the time to help me with this! JIM |
|
Do you happen to know how Module::Build::XSUtil finds the proper flags to set? For example, is it from entries from Config_heavy.pl? Or something from perl -V? This way I could develop a proper work around. |
See Also. |
excellent - thanks! |
Thank you for reporting. Also, thanks for the appropriate advice for it!!! |
oops... seems the github editing interface made some changes. Will preview next time. Wondering if anyone understands the fix the first issue hit with strlen function call. The line that was offered to change in common.hpp in is:
This modification in common.hpp allowed for good compile:
Why won't gcc take the
as correct? Could this be another side effect of using Sun Studio with the original perl compile? |
I suppose it is better to include diff --git a/include/common.hpp b/include/common.hpp
index f674d8a..de76ad1 100644
--- a/include/common.hpp
+++ b/include/common.hpp
@@ -1,5 +1,6 @@
-#include <stdio.h>
-#include <stdlib.h>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
#include <stdint.h>
#include <memory.h>
#include <iostream> FYI. I think you should not use default perl of solaris you should build perl with |
Yes - I hear you. I just wish I knew why I can pick up I do appreciate your help on this matter. I have actually learned a lot here. |
Ok - I am back. I have installed perlbrew and created a gcc build of perl 5.12.5 and I still broke down here:
All I needed to do to fix it was add Thanks for your help on this -- learned a lot! |
Include headers issue was fixed at #29. |
ok - i guess this issue can be closed also... thanks! |
Hit the following issue compiling on Solaris 11:
cpan[5]> test Compiler::Lexer
Running test for module 'Compiler::Lexer'
Running Build for G/GO/GOCCY/Compiler-Lexer-0.17.tar.gz
Has already been unwrapped into directory /home/jhall/.cpan/build/Compiler-Lexer-0.17-1z7dih
CPAN.pm: Going to build G/GO/GOCCY/Compiler-Lexer-0.17.tar.gz
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Compiler-Lexer' version '0.17'
Merging cpanfile prereqs to MYMETA.yml
Merging cpanfile prereqs to MYMETA.json
Building Compiler-Lexer
gcc -Isrc -I/usr/perl5/5.12/lib/i86pc-solaris-64int/CORE -fPIC -Iinclude -Wno-missing-field-initializers -g3 -c -DPTR_IS_LONG -I/usr/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV -O2 -o src/compiler/util/Compiler_token.o src/compiler/util/Compiler_token.cpp
In file included from src/compiler/util/Compiler_token.cpp:1:0:
include/lexer.hpp: In member function ‘TokenInfo TokenManager::getTokenInfo(const char*)’:
include/lexer.hpp:55:67: error: ‘strlen’ was not declared in this scope
error building src/compiler/util/Compiler_token.o from 'src/compiler/util/Compiler_token.cpp' at /export/code/perl5/lib/site_perl/ExtUtils/CBuilder/Base.pm line 175, line 1.
GOCCY/Compiler-Lexer-0.17.tar.gz
./Build --extra_linker_flags -L/export/code/perl5/lib --extra_linker_flags -L/export/code/perl5/lib -- NOT OK
Running Build test
Can't test without successful make
Failed during this command:
GOCCY/Compiler-Lexer-0.17.tar.gz : make NO
This is my environment:
perlgcc2 -V
Summary of my perl5 (revision 5 version 12 subversion 5) configuration:
Platform:
osname=solaris, osvers=2.11, archname=i86pc-solaris-64int
uname='sunos localhost 5.11 i86pc i386 i86pc'
config_args='-Dprefix=/usr/perl5/5.12 -Dprivlib=/usr/perl5/5.12/lib -Dsitelib=/usr/perl5/site_perl/5.12 -Dvendorprefix=/usr/perl5/5.12 -Dvendorlib=/usr/perl5/vendor_perl/5.12 -Dlibperl=libperl.so -Duseshrplib -Dusedtrace -Duse64bitint -Dcc=cc -Doptimize=-xO4 -Dcf_email=userland-discuss@opensolaris.org -Dcf_by=perl-bugs -Dmyhostname=localhost -Dmksymlinks -O -de'
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-DPTR_IS_LONG -I/usr/gnu/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DPERL_USE_SAFE_PUTENV',
optimize='-O2 ',
cppflags='-DPTR_IS_LONG -I/usr/gnu/include'
ccversion='Sun C 5.10 SunOS_i386 Patch 142363-07 2010/12/09', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/lib -L/usr/ccs/lib -L/lib -L/usr/gnu/lib '
libpth=/usr/lib /usr/ccs/lib /lib /usr/gnu/lib
libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -R /usr/perl5/5.12/lib/i86pc-solaris-64int/CORE'
cccdlflags='-fPIC', lddlflags='-G -L/usr/lib -L/usr/ccs/lib -L/lib -L/usr/gnu/lib'
Characteristics of this binary (from libperl):
Compile-time options: PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
PERL_USE_SAFE_PUTENV USE_64_BIT_INT USE_LARGE_FILES
USE_PERLIO USE_PERL_ATOF
Locally applied patches:
7111771 Problem with utility/perl
7125218 Problem with utility/perl
7030196 Problem with utility/perl
15820486 Problem with utility/perl
15880426 Problem with utility/perl
16417744 Problem with utility/perl
16427786 Problem with utility/perl
Built under solaris
Compiled at Dec 3 2013 00:45:56
%ENV:
PERL5LIB="/export/code/perl5/lib/PerlGcc2:/export/code/perl5/lib:/export/code/perl5/lib/site_perl:/export/code/perl5/lib/perl5"
PERL5_OVERRIDE_CONFIG="1"
@inc:
/export/code/perl5/lib/PerlGcc2
/export/code/perl5/lib/i86pc-solaris-64int
/export/code/perl5/lib
/export/code/perl5/lib/site_perl/5.12.5/i86pc-solaris-64int
/export/code/perl5/lib/site_perl/5.12.5
/export/code/perl5/lib/site_perl
/export/code/perl5/lib/perl5/i86pc-solaris-64int
/export/code/perl5/lib/perl5
/usr/perl5/site_perl/5.12/i86pc-solaris-64int
/usr/perl5/site_perl/5.12
/usr/perl5/vendor_perl/5.12/i86pc-solaris-64int
/usr/perl5/vendor_perl/5.12
/usr/perl5/5.12/lib/i86pc-solaris-64int
/usr/perl5/5.12/lib
.
Any suggestions?
The text was updated successfully, but these errors were encountered: