GNU bug report logs - #59967
Fix missing -fPIC parameter when compiling tree-sitter module

Previous Next

Package: emacs;

Reported by: lux <lx <at> shellcodes.org>

Date: Sun, 11 Dec 2022 15:37:02 UTC

Severity: normal

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 59967 in the body.
You can then email your comments to 59967 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#59967; Package emacs. (Sun, 11 Dec 2022 15:37:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to lux <lx <at> shellcodes.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 11 Dec 2022 15:37:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: lux <lx <at> shellcodes.org>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Fix missing -fPIC parameter when compiling tree-sitter module
Date: Sun, 11 Dec 2022 23:35:53 +0800
[Message part 1 (text/plain, inline)]
GCC in Fedora Linux does not use --enable-default-pie by default, so
I will encounter the following errors when running the build.sh:


$ ./build.sh c     
Building c
/usr/bin/ld: parser.o: relocation R_X86_64_32S against `.rodata' can
not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: failed to set dynamic section sizes: bad value collect2:
error: ld returned 1 exit status cp: cannot stat 'libtree-sitter-c.so':
No such file or directory

Following are my gcc configure information:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto
--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-12.2.1-20221121/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1 Thread
model: posix Supported LTO compression algorithms: zlib zstd gcc
version 12.2.1 20221121 (Red Hat 12.2.1-4) (GCC) 

I added -fPIC option in build.sh.

[0001-admin-notes-tree-sitter-build-module-build.sh-Add-fP.patch (text/x-patch, attachment)]

Reply sent to Yuan Fu <casouri <at> gmail.com>:
You have taken responsibility. (Mon, 12 Dec 2022 22:43:02 GMT) Full text and rfc822 format available.

Notification sent to lux <lx <at> shellcodes.org>:
bug acknowledged by developer. (Mon, 12 Dec 2022 22:43:02 GMT) Full text and rfc822 format available.

Message #10 received at 59967-done <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: lx <at> shellcodes.org
Cc: 59967-done <at> debbugs.gnu.org
Subject: Re: bug#59967: Fix missing -fPIC parameter when compiling 
 tree-sitter module
Date: Mon, 12 Dec 2022 14:42:20 -0800
lux <lx <at> shellcodes.org> writes:

> GCC in Fedora Linux does not use --enable-default-pie by default, so
> I will encounter the following errors when running the build.sh:
>
>
> $ ./build.sh c     
> Building c
> /usr/bin/ld: parser.o: relocation R_X86_64_32S against `.rodata' can
> not be used when making a shared object; recompile with -fPIC
> /usr/bin/ld: failed to set dynamic section sizes: bad value collect2:
> error: ld returned 1 exit status cp: cannot stat 'libtree-sitter-c.so':
> No such file or directory
>
> Following are my gcc configure information:
>
> $ gcc -v
> Using built-in specs.
> COLLECT_GCC=gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper
> OFFLOAD_TARGET_NAMES=nvptx-none
> OFFLOAD_TARGET_DEFAULT=1
> Target: x86_64-redhat-linux
> Configured with: ../configure --enable-bootstrap
> --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto
> --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info
> --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
> --enable-threads=posix --enable-checking=release --enable-multilib
> --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
> --enable-gnu-unique-object --enable-linker-build-id
> --with-gcc-major-version-only --enable-libstdcxx-backtrace
> --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
> --with-isl=/builddir/build/BUILD/gcc-12.2.1-20221121/obj-x86_64-redhat-linux/isl-install
> --enable-offload-targets=nvptx-none --without-cuda-driver
> --enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
> --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
> --with-build-config=bootstrap-lto --enable-link-serialization=1 Thread
> model: posix Supported LTO compression algorithms: zlib zstd gcc
> version 12.2.1 20221121 (Red Hat 12.2.1-4) (GCC) 
>
> I added -fPIC option in build.sh.

Ah, yes, thank you! I applied the patch.

Yuan




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 10 Jan 2023 12:24:12 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 242 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.