Skip to content
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

build error: linkage specification is incompatible with previous "Perl___notused" #7

Closed
daxim opened this issue Feb 17, 2013 · 9 comments

Comments

@daxim
Copy link

daxim commented Feb 17, 2013

~/hack/CUDA-Minimal$ perl Build.PL
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'CUDA-Minimal' version '0.01'

~/hack/CUDA-Minimal$ ./Build
Building CUDA-Minimal
/home/daxim/local/share/perlbrew/perls/gcc46/bin/perl -MExtUtils::nvcc::Backend -eExtUtils::nvcc::Backend::compiler -- -I. -I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE -DXS_VERSION="0.01" -DVERSION="0.01" -fPIC -c -D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -o lib/CUDA/Minimal.o lib/CUDA/Minimal.c
lib/CUDA/Minimal.c(374): error: linkage specification is incompatible with previous "Perl___notused"
(163): here

1 error detected in the compilation of "/tmp/tmpxft_00004081_00000000-6_Minimal.cpp1.ii".
nvcc encountered a problem
error building lib/CUDA/Minimal.o from 'lib/CUDA/Minimal.c' at /home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/ExtUtils/CBuilder/Base.pm line 177.

~/hack/CUDA-Minimal$ /home/daxim/local/share/perlbrew/perls/gcc46/bin/perl -MExtUtils::nvcc::Backend -eExtUtils::nvcc::Backend::compiler -- -v -I. -I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE -DXS_VERSION="0.01" -DVERSION="0.01" -fPIC -c -D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -o lib/CUDA/Minimal.o lib/CUDA/Minimal.c
ExtUtils::nvcc found nvcc args [[-v]], [[-I.]], [[-I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE]], [[-DXS_VERSION=0.01]], [[-DVERSION=0.01]], [[-c]], [[-D_REENTRANT]], [[-D_GNU_SOURCE]], [[-DDEBUGGING]], [[-I/usr/local/include]], [[-D_LARGEFILE_SOURCE]], [[-D_FILE_OFFSET_BITS=64]], [[-O2]], [[-g]], [[-o]], [[lib/CUDA/Minimal.o]]
ExtUtils::nvcc found other args [[-fPIC]], [[-fPIC]], [[-fno-strict-aliasing]], [[-pipe]], [[-fstack-protector]]
ExtUtils::nvcc found source files [[lib/CUDA/Minimal.c]]
Running nvcc with args [[-Xcompiler=-fPIC,-fPIC,-fno-strict-aliasing,-pipe,-fstack-protector]], [[-v]], [[-I.]], [[-I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE]], [[-DXS_VERSION=0.01]], [[-DVERSION=0.01]], [[-c]], [[-D_REENTRANT]], [[-D_GNU_SOURCE]], [[-DDEBUGGING]], [[-I/usr/local/include]], [[-D_LARGEFILE_SOURCE]], [[-D_FILE_OFFSET_BITS=64]], [[-O2]], [[-g]], [[-o]], [[lib/CUDA/Minimal.o]], [[--x=cu]], [[lib/CUDA/Minimal.c]], [[--compiler-bindir=gcc-4.6]]
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=/usr/local/cuda/bin
#$ _THERE_=/usr/local/cuda/bin
#$ _TARGET_SIZE_=64
#$ TOP=/usr/local/cuda/bin/..
#$ LD_LIBRARY_PATH=/usr/local/cuda/bin/../lib:/usr/local/cuda/lib64:/usr/local/cuda/lib:
#$ PATH=/usr/local/cuda/bin/../open64/bin:/usr/local/cuda/bin/../nvvm:/usr/local/cuda/bin:/home/daxim/local/share/perlbrew/bin:/home/daxim/local/share/perlbrew/perls/gcc46/bin:/home/daxim/local/bin:/usr/local/cuda/bin:/opt/kde3/sbin:/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/sbin:/usr/sbin
#$ INCLUDES="-I/usr/local/cuda/bin/../include"
#$ LIBRARIES=  "-L/usr/local/cuda/bin/../lib64" -lcudart
#$ CUDAFE_FLAGS=
#$ OPENCC_FLAGS=
#$ PTXAS_FLAGS=
#$ gcc-4.6 -D__CUDA_ARCH__=100 -E -x c++    -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS -DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS  -D__CUDACC__ -D__NVCC__  -fPIC -fPIC -fno-strict-aliasing -pipe -fstack-protector -O2 -I"." -I"/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE" -I"/usr/local/include" "-I/usr/local/cuda/bin/../include"   -D"XS_VERSION=0.01" -D"VERSION=0.01" -D"_REENTRANT" -D"_GNU_SOURCE" -D"DEBUGGING" -D"_LARGEFILE_SOURCE" -D"_FILE_OFFSET_BITS=64" -include "cuda_runtime.h" -m64 -g -o "/tmp/tmpxft_0000408a_00000000-6_Minimal.cpp1.ii" "lib/CUDA/Minimal.c"
#$ cudafe --m64 --gnu_version=40603 -tused --no_remove_unneeded_entities  --gen_c_file_name "/tmp/tmpxft_0000408a_00000000-3_Minimal.cudafe1.c" --stub_file_name "/tmp/tmpxft_0000408a_00000000-3_Minimal.cudafe1.stub.c" --gen_device_file_name "/tmp/tmpxft_0000408a_00000000-3_Minimal.cudafe1.gpu" --nv_arch "compute_10" --gen_module_id_file --module_id_file_name "/tmp/tmpxft_0000408a_00000000-2_Minimal.module_id" --include_file_name "tmpxft_0000408a_00000000-1_Minimal.fatbin.c" "/tmp/tmpxft_0000408a_00000000-6_Minimal.cpp1.ii"
lib/CUDA/Minimal.c(374): error: linkage specification is incompatible with previous "Perl___notused"
(163): here

lib/CUDA/Minimal.c(386): error: expected a ")"

2 errors detected in the compilation of "/tmp/tmpxft_0000408a_00000000-6_Minimal.cpp1.ii".
# --error 0x2 --
nvcc encountered a problem

~/hack/CUDA-Minimal$ git log --format=raw | head -n 1
commit 991419acb95d17320f6fdaf203dc7afcbd85ed08

~/hack/CUDA-Minimal$ uname -a
Linux champion 3.4.28-2.20-desktop #1 SMP PREEMPT Tue Jan 29 16:51:37 UTC 2013 (143156b) x86_64 x86_64 x86_64 GNU/Linux

~/hack/CUDA-Minimal$ perl -V
Summary of my perl5 (revision 5 version 16 subversion 2) configuration:

Platform:
    osname=linux, osvers=3.4.28-2.20-desktop, archname=x86_64-linux-thread-multi-ld
    uname='linux champion 3.4.28-2.20-desktop #1 smp preempt tue jan 29 16:51:37 utc 2013 (143156b) x86_64 x86_64 x86_64 gnulinux '
    config_args='-de -Dprefix=/home/daxim/local/share/perlbrew/perls/gcc46 -Dcc=gcc-4.6 -DDEBUGGING -Dusemorebits -Dusethreads -Dcf_email=daxim@cpan.org -Dperladmin=daxim@cpan.org -Accflags=-fPIC -Aeval:scriptdir=/home/daxim/local/share/perlbrew/perls/gcc46/bin'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=define
    usemymalloc=n, bincompat5005=undef
Compiler:
    cc='gcc-4.6', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -g',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
    ccversion='', gccversion='4.6.3 20120531 [gcc-4_6-branch revision 188067]', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
    alignbytes=16, prototype=define
Linker and Libraries:
    ld='gcc-4.6', ldflags =' -fstack-protector -L/usr/local/lib'
    libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
    libc=/lib/libc-2.16.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.16'
Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'


Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS
                        PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
                        PERL_MALLOC_WRAP PERL_PRESERVE_IVUV
                        PERL_TRACK_MEMPOOL USE_64_BIT_ALL USE_64_BIT_INT
                        USE_ITHREADS USE_LARGE_FILES USE_LOCALE
                        USE_LOCALE_COLLATE USE_LOCALE_CTYPE
                        USE_LOCALE_NUMERIC USE_LONG_DOUBLE USE_PERLIO
                        USE_PERL_ATOF USE_REENTRANT_API
Built under linux
Compiled at Feb 17 2013 18:15:44
%ENV:
    PERLBREW_BASHRC_VERSION="0.58"
    PERLBREW_HOME="/home/daxim/.perlbrew"
    PERLBREW_MANPATH="/home/daxim/local/share/perlbrew/perls/gcc46/man"
    PERLBREW_PATH="/home/daxim/local/share/perlbrew/bin:/home/daxim/local/share/perlbrew/perls/gcc46/bin"
    PERLBREW_PERL="gcc46"
    PERLBREW_ROOT="/home/daxim/local/share/perlbrew"
    PERLBREW_VERSION="0.58"
@INC:
    /home/daxim/local/share/perlbrew/perls/gcc46/lib/site_perl/5.16.2/x86_64-linux-thread-multi-ld
    /home/daxim/local/share/perlbrew/perls/gcc46/lib/site_perl/5.16.2
    /home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld
    /home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2
    .
@run4flat
Copy link
Owner

Thanks Daxim. On my system these are warnings, not errors. This means I can reproduce them, but I hadn't given them a high priority to solve. I see if I can figure out what's going on. :-)

@eperry
Copy link

eperry commented Dec 13, 2013

Did you happen to resolve this issue? I am getting it with my build too

[cuda@localhost perl-CUDA-Minimal]$ ./Build
Building CUDA-Minimal
/usr/bin/perl -MExtUtils::nvcc::Backend -eExtUtils::nvcc::Backend::compiler -- -I. -I/usr/lib64/perl5/CORE -DXS_VERSION="0.01" -DVERSION="0.01" -fPIC -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -o lib/CUDA/Minimal.o lib/CUDA/Minimal.c
lib/CUDA/Minimal.c(374): error: linkage specification is incompatible with previous "Perl___notused"
(163): here

1 error detected in the compilation of "/tmp/tmpxft_00003ea5_00000000-6_Minimal.cpp1.ii".
nvcc encountered a problem
error building lib/CUDA/Minimal.o from 'lib/CUDA/Minimal.c' at /home/cuda/perl5/lib/perl5/ExtUtils/CBuilder/Base.pm line 175.

[cuda@localhost perl-CUDA-Minimal]$ uname -a
Linux localhost.localdomain 3.11.10-200.fc19.x86_64 #1 SMP Mon Dec 2 20:28:03 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

[cuda@localhost perl-CUDA-Minimal]$ perl -V
Summary of my perl5 (revision 5 version 16 subversion 3) configuration:

Platform:
osname=linux, osvers=3.10.9-200.fc19.x86_64, archname=x86_64-linux-thread-multi
uname='linux buildvm-01.phx2.fedoraproject.org 3.10.9-200.fc19.x86_64 #1 smp wed aug 21 19:27:58 utc 2013 x86_64 x86_64 x86_64 gnulinux '
config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Dccdlflags=-Wl,--enable-new-dtags -Dlddlflags=-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro -DDEBUGGING=-g -Dversion=5.16.3 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl5 -Dsitearch=/usr/local/lib64/perl5 -Dprivlib=/usr/share/perl5 -Dvendorlib=/usr/share/perl5/vendor_perl -Darchlib=/usr/lib64/perl5 -Dvendorarch=/usr/lib64/perl5/vendor_perl -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Duseshrplib -Dusethreads -Duseithreads -Dusedtrace=/usr/bin/dtrace -Duselargefiles -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/bin -Dusesitecustomize'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.8.2 20131017 (Red Hat 4.8.2-1)', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -fstack-protector'
libpth=/usr/local/lib64 /lib64 /usr/lib64
libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.17'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,--enable-new-dtags -Wl,-rpath,/usr/lib64/perl5/CORE'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -Wl,-z,relro '

Characteristics of this binary (from libperl):
Compile-time options: HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV USE_64_BIT_ALL
USE_64_BIT_INT USE_ITHREADS USE_LARGE_FILES
USE_LOCALE USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
USE_REENTRANT_API USE_SITECUSTOMIZE
Built under linux
Compiled at Nov 11 2013 12:36:47
%ENV:
PERL5LIB="/home/cuda/perl5/lib/perl5:"
PERL_LOCAL_LIB_ROOT="/home/cuda/perl5:"
PERL_MB_OPT="--install_base /home/cuda/perl5"
PERL_MM_OPT="INSTALL_BASE=/home/cuda/perl5"
@inc:
/home/cuda/perl5/lib/perl5/x86_64-linux-thread-multi
/home/cuda/perl5/lib/perl5
/usr/local/lib64/perl5
/usr/local/share/perl5
/usr/lib64/perl5/vendor_perl
/usr/share/perl5/vendor_perl
/usr/lib64/perl5
/usr/share/perl5
.

@eperry
Copy link

eperry commented Dec 13, 2013

Ok not an elegant fix but I renamed the dNOOP to dNOOP1 so it did not apply
From
define dNOOP extern int /@unused@/ Perl___notused PERL_UNUSED_DECL
To
define dNOOP1 extern int /@unused@/ Perl___notused PERL_UNUSED_DECL

I hope it will not break anything

@run4flat
Copy link
Owner

@eperry, dNOOP is a preprocessor macro used in the Perl sources. I never managed to track down the source of the problem and gave up trying a while ago, so the fact that you've uncovered this as the problem is marvelous!

What happens if you place the following at the very top of Minimal.xs?

#ifdef dNOOP
    /* If the CUDA sources define this, clear it */
    #undef dNOOP
#endif

@run4flat
Copy link
Owner

I made some hard-won but ultimately good progress on this problem today. In particular, I took all day to solve what ultimately boiled down to an alignment issue.

The solution that I propose above does not solve this problem. However, it is only a problem for Perl v5.16. CUDA::Minimal compiles for v5.14 and v5.18, with and without threads, which gives us a much narrower search window.

@eperry
Copy link

eperry commented Dec 17, 2013

sorry I did not get a chance to try the compile today, to many monday
morning issues. but good to hear it is some change between 5.18 and 5.14
as what ever broke in 5.15 - 5.17 was corrected. :)

I'll see if what the beta version of Fedora perl is up to, and give that a
try if it is higher.

Thanks for your efforts. I'll try the comment you had above.

On Mon, Dec 16, 2013 at 7:59 PM, David Mertens notifications@github.comwrote:

I made some hard-won but ultimately good progress on this problem today.
In particular, I took all day to solve what ultimately boiled down to an
alignment issue.

The solution that I propose above does not solve this problem. However, it
is only a problem for Perl v5.16. CUDA::Minimal compiles for v5.14 and
v5.18, with and without threads, which gives us a much narrower search
window.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-30717355
.

Sincerely

Edward Perry

@run4flat
Copy link
Owner

This error first arose in Perl's core with commit bafdc25d and fixed with commit 7db66e12

Thanks to bisect.pl for that.

This means we can, potentially, include a fix for v5.16 by using proper #ifdef checks.

run4flat added a commit that referenced this issue Dec 19, 2013
Perl has had a couple of different definitions for dNOOP, and some
of them made nvcc mad. The current solution in the Perl core can be
applied to fix the problem, and that is done with this commit.
@run4flat
Copy link
Owner

That should do it. Please let me know if it doesn't work on your end. If this works, I'll try to get this fix added to ppport.h, as I believe this solution would solve the most problems there.

@eperry
Copy link

eperry commented Dec 21, 2013

Hi David,

Thanks so much for the quick work. I had the chance the other day to purge
the install I hacked and re-checkout the project and compile it without
modifications.

Seemed to work flawlessly.

THANKS!

This fixes Fedora 19 standard server installs. :) With Cuda 5.5

On Thu, Dec 19, 2013 at 12:02 AM, David Mertens notifications@github.comwrote:

That should do it. Please let me know if it doesn't work on your end. If
this works, I'll try to get this fix added to ppport.h, as I believe this
solution would solve the most problems there.


Reply to this email directly or view it on GitHubhttps://github.com//issues/7#issuecomment-30905430
.

Sincerely

Edward Perry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants