Does not compile on some Linux distro
Closed this issue · 0 comments
cacharle commented
Worked with
$ gcc --version
clang version 9.0.0-2~ubuntu18.04.2 (tags/RELEASE_900/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
But not with:
$ uname -a
Linux manjaro 5.4.67-1-MANJARO #1 SMP PREEMPT Wed Sep 23 14:20:18 UTC 2020 x86_64 GNU/Linux
$ gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Output:
gcc -I. -Wall -Wextra -Wno-nonnull -c -o main.o main.c
gcc -I. -Wall -Wextra -Wno-nonnull -c -o helper.o helper.c
gcc -I. -Wall -Wextra -Wno-nonnull -c -o test/ft_strlen_test.o test/ft_strlen_test.c
gcc -I. -Wall -Wextra -Wno-nonnull -c -o test/ft_strcpy_test.o test/ft_strcpy_test.c
gcc -I. -Wall -Wextra -Wno-nonnull -c -o test/ft_strcmp_test.o test/ft_strcmp_test.c
gcc -I. -Wall -Wextra -Wno-nonnull -c -o test/ft_write_test.o test/ft_write_test.c
gcc -I. -Wall -Wextra -Wno-nonnull -c -o test/ft_read_test.o test/ft_read_test.c
gcc -I. -Wall -Wextra -Wno-nonnull -c -o test/ft_strdup_test.o test/ft_strdup_test.c
gcc -o runtest main.o helper.o test/ft_strlen_test.o test/ft_strcpy_test.o test/ft_strcmp_test.o test/ft_write_test.o test/ft_read_test.o test/ft_strdup_test.o -L../pg -lasm
/usr/bin/ld: ../libasm/libasm.a(ft_read.o): warning: relocation against `__errno_location@@GLIBC_2.2.5' in read-only section `.text'
/usr/bin/ld: ../libasm/libasm.a(ft_write.o): relocation R_X86_64_PC32 against symbol `__errno_location@@GLIBC_2.2.5' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
Recompiling with -fPIC
, -fPIE
or making a shared library did not work.