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

make fails with link error #39

Open
johnrembo opened this issue Jan 4, 2023 · 4 comments
Open

make fails with link error #39

johnrembo opened this issue Jan 4, 2023 · 4 comments

Comments

@johnrembo
Copy link

$ markdown --version                                            ↑
markdown: discount (main)2.2.7b
$ uname -a                                                      ↑
Linux xxx 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 x86_64 x86_
64 GNU/Linux
$ ./configure --with-apxs=/usr/bin/apxs --with-discount=/usr/local
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
$ make                                                          ↑
/usr/bin/apxs -c -I/usr/local/include -L/usr/local/lib -lmarkdown mod_markdown.c
/usr/share/apr-1.0/build/libtool  --mode=compile --tag=disable-static x86_64-linux-gnu-gcc -prefer-p
ic -pipe -g -O2 -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-securi
ty  -Wdate-time -D_FORTIFY_SOURCE=2   -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/include/apache2  -
I/usr/include/apr-1.0   -I/usr/include/apr-1.0 -I/usr/include -I/usr/local/include  -c -o mod_markdo
wn.lo mod_markdown.c && touch mod_markdown.slo
libtool: compile:  x86_64-linux-gnu-gcc -pipe -g -O2 -flto=auto -ffat-lto-objects -fstack-protector-
strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_
SOURCE -I/usr/include/apache2 -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -I/usr/lo
cal/include -c mod_markdown.c  -fPIC -DPIC -o .libs/mod_markdown.o
/usr/share/apr-1.0/build/libtool  --mode=link --tag=disable-static x86_64-linux-gnu-gcc -Wl,--as-nee
ded -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now    -o mod_markdown
.la  -L/usr/local/lib -lmarkdown -rpath /usr/lib/apache2/modules -module -avoid-version    mod_markd
own.lo
libtool: link: x86_64-linux-gnu-gcc -shared  -fPIC -DPIC  .libs/mod_markdown.o   -L/usr/local/lib -l
markdown  -Wl,--as-needed -Wl,-Bsymbolic-functions -flto=auto -Wl,-z -Wl,relro -Wl,-z -Wl,now   -Wl,
-soname -Wl,mod_markdown.so -o .libs/mod_markdown.so
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): warning: relocation against `extratags' in read-o
nly section `.text'
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_X86_64_PC32 against symbol `extratag
s' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
@canuckdev
Copy link

Similar problem. The initial error message indicates to recompile libmarkdown with -fPIC.

$ uname -a
Linux no2 5.15.0-1050-raspi #53-Ubuntu SMP PREEMPT Thu Mar 21 10:02:47 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux

$ markdown -V
markdown: discount 2.2.7d

$ git clone https://github.com/hamano/apache-mod-markdown.git
Cloning into 'apache-mod-markdown'...
remote: Enumerating objects: 302, done.
remote: Counting objects: 100% (47/47), done.
remote: Compressing objects: 100% (33/33), done.
remote: Total 302 (delta 25), reused 28 (delta 14), pack-reused 255
Receiving objects: 100% (302/302), 92.49 KiB | 1.54 MiB/s, done.
Resolving deltas: 100% (164/164), done.

$ cd apache-mod-markdown

apache-mod-markdown$ autoreconf -f -i
libtoolize: putting auxiliary files in '.'.
libtoolize: copying file './ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'm4'.
libtoolize: copying file 'm4/libtool.m4'
libtoolize: copying file 'm4/ltoptions.m4'
libtoolize: copying file 'm4/ltsugar.m4'
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:6: warning: 'AM_CONFIG_HEADER': this macro is obsolete.
configure.ac:6: You should use the 'AC_CONFIG_HEADERS' macro instead.
./lib/autoconf/general.m4:2434: AC_DIAGNOSE is expanded from...
aclocal.m4:745: AM_CONFIG_HEADER is expanded from...
configure.ac:6: the top level
configure.ac:10: warning: The macro `AM_PROG_LIBTOOL' is obsolete.
configure.ac:10: You should run autoupdate.
m4/libtool.m4:100: AM_PROG_LIBTOOL is expanded from...
configure.ac:10: the top level
configure.ac:38: warning: AC_OUTPUT should be used without arguments.
configure.ac:38: You should run autoupdate.
configure.ac:9: installing './compile'
configure.ac:5: installing './missing'

apache-mod-markdown$ ./configure --with-apxs=/usr/bin/apxs --with-discount=/usr/local
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... none
checking build system type... aarch64-unknown-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert aarch64-unknown-linux-gnu file names to aarch64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert aarch64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for mt... mt
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether C compiler accepts -Wall... yes
checking for apxs tool... APXS found!
checking for discount directory... DISCOUNT found!
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands

apache-mod-markdown$ make
/usr/bin/apxs -c -I/usr/local/include -L/usr/local/lib -lmarkdown mod_markdown.c
/usr/share/apr-1.0/build/libtool  --mode=compile --tag=disable-static aarch64-linux-gnu-gcc -prefer-pic -pipe -g -O2 -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security  -Wdate-time -D_FORTIFY_SOURCE=2   -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/usr/include/apache2  -I/usr/include/apr-1.0   -I/usr/include/apr-1.0 -I/usr/include -I/usr/local/include  -c -o mod_markdown.lo mod_markdown.c && touch mod_markdown.slo
libtool: compile:  aarch64-linux-gnu-gcc -pipe -g -O2 -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -DLINUX -D_REENTRANT -D_GNU_SOURCE -I/usr/include/apache2 -I/usr/include/apr-1.0 -I/usr/include/apr-1.0 -I/usr/include -I/usr/local/include -c mod_markdown.c  -fPIC -DPIC -o .libs/mod_markdown.o
/usr/share/apr-1.0/build/libtool  --mode=link --tag=disable-static aarch64-linux-gnu-gcc -Wl,--as-needed -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -Wl,-z,relro -Wl,-z,now    -o mod_markdown.la  -L/usr/local/lib -lmarkdown -rpath /usr/lib/apache2/modules -module -avoid-version    mod_markdown.lo
libtool: link: aarch64-linux-gnu-gcc -shared  -fPIC -DPIC  .libs/mod_markdown.o   -L/usr/local/lib -lmarkdown  -Wl,--as-needed -Wl,-Bsymbolic-functions -flto=auto -Wl,-z -Wl,relro -Wl,-z -Wl,now   -Wl,-soname -Wl,mod_markdown.so -o .libs/mod_markdown.so
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmarkdown.a(tags.o): in function `mkd_define_tag':
/home/jjp/tmp/discount-2.2.7d/tags.c:32:(.text+0x34): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:33:(.text+0x48): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:33:(.text+0x54): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:33:(.text+0x60): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:33:(.text+0x6c): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x78): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x84): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x98): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0xa8): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0xbc): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0xc8): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0xd8): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0xe4): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x10c): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x11c): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x128): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x144): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x150): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x15c): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:34:(.text+0x16c): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmarkdown.a(tags.o): in function `mkd_sort_tags':
/home/jjp/tmp/discount-2.2.7d/tags.c:64:(.text+0x238): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:64:(.text+0x244): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmarkdown.a(tags.o): in function `mkd_search_tags':
/home/jjp/tmp/discount-2.2.7d/tags.c:82:(.text+0x2e4): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:83:(.text+0x2f8): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:83:(.text+0x304): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libmarkdown.a(tags.o): in function `mkd_deallocate_tags':
/home/jjp/tmp/discount-2.2.7d/tags.c:94:(.text+0x36c): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:95:(.text+0x380): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:95:(.text+0x394): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:95:(.text+0x3a4): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:95:(.text+0x3b0): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:95:(.text+0x3bc): dangerous relocation: unsupported relocation
/usr/bin/ld: /usr/local/lib/libmarkdown.a(tags.o): relocation R_AARCH64_ADR_PREL_PG_HI21 against symbol `extratags' which may bind externally can not be used when making a shared object; recompile with -fPIC
/home/jjp/tmp/discount-2.2.7d/tags.c:95:(.text+0x3cc): dangerous relocation: unsupported relocation
collect2: error: ld returned 1 exit status
apxs:Error: Command failed with rc=65536
.
make: *** [Makefile:708: mod_markdown.la] Error 1

@canuckdev
Copy link

In my case the solution was to add -fPIC to CFLAGS in the discount Makefile before building.

@canuckdev
Copy link

So when building discount for aarch64 use:

CFLAGS="-g -fPIC" ./configure.sh

@canuckdev
Copy link

The -fPIC flag generates Position Independent Code suitable for use in a shared library.

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

2 participants