all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#59967: Fix missing -fPIC parameter when compiling tree-sitter module
@ 2022-12-11 15:35 lux
  2022-12-12 22:42 ` Yuan Fu
  0 siblings, 1 reply; 2+ messages in thread
From: lux @ 2022-12-11 15:35 UTC (permalink / raw)
  To: 59967

[-- Attachment #1: Type: text/plain, Size: 1781 bytes --]

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.


[-- Attachment #2: 0001-admin-notes-tree-sitter-build-module-build.sh-Add-fP.patch --]
[-- Type: text/x-patch, Size: 726 bytes --]

From 188f05e4f8fb7834ee6f43dd00bc59cfe39fc55b Mon Sep 17 00:00:00 2001
From: lu4nx <lx@shellcodes.org>
Date: Sun, 11 Dec 2022 23:33:33 +0800
Subject: [PATCH] ; * admin/notes/tree-sitter/build-module/build.sh: Add -fPIC

---
 admin/notes/tree-sitter/build-module/build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/admin/notes/tree-sitter/build-module/build.sh b/admin/notes/tree-sitter/build-module/build.sh
index cc31e3f6f0..c1e81f93ed 100755
--- a/admin/notes/tree-sitter/build-module/build.sh
+++ b/admin/notes/tree-sitter/build-module/build.sh
@@ -43,7 +43,7 @@ grammardir=
 
 ### Build
 
-cc -c -I. parser.c
+cc -fPIC -c -I. parser.c
 # Compile scanner.c.
 if test -f scanner.c
 then
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#59967: Fix missing -fPIC parameter when compiling tree-sitter module
  2022-12-11 15:35 bug#59967: Fix missing -fPIC parameter when compiling tree-sitter module lux
@ 2022-12-12 22:42 ` Yuan Fu
  0 siblings, 0 replies; 2+ messages in thread
From: Yuan Fu @ 2022-12-12 22:42 UTC (permalink / raw)
  To: lx; +Cc: 59967-done


lux <lx@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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-12-12 22:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-11 15:35 bug#59967: Fix missing -fPIC parameter when compiling tree-sitter module lux
2022-12-12 22:42 ` Yuan Fu

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.