-
Notifications
You must be signed in to change notification settings - Fork 67
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
recompile with -fPIC #41
Comments
Thank you for this feedback.
|
you need to generate build file using the flag PIC as showed in the error.
|
Sorry but this didn't work for me:
$ make clean;
$ cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" ./; make
....
[ 15%] Linking CXX executable pdfalto
/usr/bin/ld: libs/image/png/linux/libpng.a(png.c.o): relocation R_X86_64_32
against `.rodata' can not be used when making a PIE object; recompile with
-fPIC
...
…On Fri, Jan 18, 2019 at 5:06 PM Aazhar ***@***.***> wrote:
you need to generate build file using the flag PIC as showed in the error.
So you need to run cmake this way :
cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" .
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARkHE7zrjK26RXHLeMBmwZdYhslVsPn_ks5vEfEEgaJpZM4aIKVL>
.
|
$ uname -i |
Thanks for the information,
This will generate a libpng.a file that you need to copy under Please keep me informed. |
It appears your suggestion was correct. I can't see the libpng errors
anymore but there are still many similar errors from the other libs:
[15%] Linking CXX executable pdfalto
/usr/bin/ld: libs/libxml/linux/libxml2.a(entities.o): relocation
R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE
object; recompile with -fPIC
...
I couldn't apply the same fix to the remaining libs as the other sources
aren't available.
…On Sun, Jan 20, 2019 at 7:53 PM Aazhar ***@***.***> wrote:
Thanks for the information,
I can't reproduce this error in my environment, but I think you need to
regenerate the libpng.a.
To do so you to go under libs/image/png/src and run :
cmake "-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true" ./; make
This will generate a libpng.a file that you need to copy under
libs/image/png/linux , since I understand you are using linux.
Please keep me informed.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARkHE4e71vclFC-p4JvQHr4e7_tzQ6FIks5vFLsUgaJpZM4aIKVL>
.
|
Could you update your repository and re make it. |
Back to square one I'm afraid. I compiled the libpng and libzlib with your
earlier flag suggestion. Here is the full error message.
[ 15%] Linking CXX executable pdfalto
/usr/bin/ld: libs/image/png/linux/libpng.a(png.c.o): relocation R_X86_64_32
against `.rodata' can not be used when making a PIE object; recompile with
-fPIC
/usr/bin/ld: libs/image/png/linux/libpng.a(pngerror.c.o): relocation
R_X86_64_32S against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/png/linux/libpng.a(pngmem.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/png/linux/libpng.a(pngset.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/png/linux/libpng.a(pngtrans.c.o): relocation
R_X86_64_32S against `.data' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/png/linux/libpng.a(pngwio.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/png/linux/libpng.a(pngwrite.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/png/linux/libpng.a(pngwutil.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(crc32.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(deflate.c.o): relocation
R_X86_64_32S against symbol `zcalloc' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(inflate.c.o): relocation
R_X86_64_32S against symbol `zcalloc' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(inftrees.c.o): relocation
R_X86_64_32S against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(trees.c.o): relocation
R_X86_64_32S against `.data' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(zutil.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(compress.c.o): relocation
R_X86_64_32 against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/image/zlib/linux/libzlib.a(inffast.c.o): relocation
R_X86_64_32S against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(uobject.ao): relocation R_X86_64_32S
against symbol `_ZN6icu_627UObjectD0Ev' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(cmemory.ao): relocation R_X86_64_32
against `.rodata._ZL7zeroMem' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(unistr.ao): relocation R_X86_64_32
against `.bss._ZZN6icu_6213UnicodeString16getStaticClassIDEvE7classID' can
not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(ustring.ao): relocation R_X86_64_32S
against `.rodata._ZL12UNESCAPE_MAP' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(ustrtrns.ao): relocation
R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(loadednormalizer2impl.ao):
relocation R_X86_64_32S against symbol
`_ZTVN6icu_6221LoadedNormalizer2ImplE' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(utrie2.ao): relocation R_X86_64_32
against `.text._ZL13enumSameValuePKvj' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(uinvchar.ao): relocation
R_X86_64_32S against `.rodata._ZL14invariantChars' can not be used when
making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(umutex.ao): relocation R_X86_64_32
against `.bss._ZL11globalMutex' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(ucln_cmn.ao): relocation R_X86_64_32
against `.bss._ZL20gLibCleanupFunctions' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(udata.ao): relocation R_X86_64_32
against `.bss._ZL19gCommonICUDataArray' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(ucmndata.ao): relocation
R_X86_64_32S against `.rodata._ZL9ToCPFuncs' can not be used when making a
PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(udataswp.ao): relocation R_X86_64_32
against `.rodata.str1.8' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(utrace.ao): relocation R_X86_64_32S
against `.rodata._ZZL14outputHexBytesliPcPiiE9gHexChars' can not be used
when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(uhash.ao): relocation R_X86_64_32S
against `.rodata._ZL6PRIMES' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(appendable.ao): relocation
R_X86_64_32S against symbol `_ZTVN6icu_6210AppendableE' can not be used
when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(utf_impl.ao): relocation
R_X86_64_32S against `.rodata' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(normalizer2impl.ao): relocation
R_X86_64_32 against `.text.enumLcccRange' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(normalizer2.ao): relocation
R_X86_64_32S against symbol `_ZTVN6icu_6211Normalizer2E' can not be used
when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(utrie2_builder.ao): relocation
R_X86_64_32 against `.text._ZL13copyEnumRangePKviij' can not be used when
making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(uniset.ao): relocation R_X86_64_32
against `.bss._ZZN6icu_6210UnicodeSet16getStaticClassIDEvE7classID' can not
be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(unifilt.ao): relocation R_X86_64_32
against `.bss._ZZN6icu_6213UnicodeFilter16getStaticClassIDEvE7classID' can
not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(unifunct.ao): relocation R_X86_64_32
against `.bss._ZZN6icu_6214UnicodeFunctor16getStaticClassIDEvE7classID' can
not be used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(util.ao): relocation R_X86_64_32S
against `.rodata._ZL6DIGITS' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(putil.ao): relocation R_X86_64_32
against `.rodata.str1.1' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(charstr.ao): relocation R_X86_64_32
against symbol `__gxx_personality_v0' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(ucol_swp.ao): relocation R_X86_64_32
against `.rodata.str1.8' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(uvector.ao): relocation R_X86_64_32
against `.bss._ZZN6icu_627UVector16getStaticClassIDEvE7classID' can not be
used when making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(edits.ao): relocation R_X86_64_32
against `.rodata.str2.2' can not be used when making a PIE object;
recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(patternprops.ao): relocation
R_X86_64_32S against `.rodata._ZN6icu_62L6latin1E' can not be used when
making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(utrie.ao): relocation R_X86_64_32
against `.text._ZL21defaultGetFoldedValueP8UNewTrieii' can not be used when
making a PIE object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(bmpset.ao): relocation R_X86_64_32S
against symbol `_ZTVN6icu_626BMPSetE' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: libs/icu/linux/libicuuc.a(unisetspan.ao): relocation
R_X86_64_32S against `.rodata.str1.1' can not be used when making a PIE
object; recompile with -fPIC
/usr/bin/ld: final link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/pdfalto.dir/build.make:184: pdfalto] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/pdfalto.dir/all] Error 2
make: *** [Makefile:130: all] Error 2
…On Tue, Jan 22, 2019 at 11:48 AM Aazhar ***@***.***> wrote:
Could you update your repository and re make it.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#41 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ARkHE0W04251AyhtAwZehifRc0OXWX06ks5vFuxugaJpZM4aIKVL>
.
|
Ok, it seems that your linker is old.
|
What I suggest is you checkout the last updates and you compile the dependencies following the description here : https://github.com/kermitt2/pdfalto/blob/master/Dependencies_INSTALL.md |
$ ld -v I think you'll agree that my linker is not 'old'. Thanks for writing up the 'do it yourself' instructions even though the approach is hardly ideal to solve one's software's portability issues. |
I've a bash script for installing the dependencies in one step , you can recompile all of the dependencies using this bash script https://github.com/kermitt2/pdfalto/blob/master/install_deps.sh |
Hello, |
On Arch Linux I have the same issue, to use the provided libs I used an
|
If you are encountering the same issue regarding the dependencies please refer to this section : https://github.com/kermitt2/pdfalto#dependencies |
hello @rytis-paskauskas |
Hi, Here is the relevant output on Arch: $ ./install_deps.sh $ make [rytis@pappa pdfalto] $ pacman -Ss libpaper On Debian all went well. |
Thanks for your feedback, I've corrected it, it should be ok by now. |
Hi @Aazhar I'm getting the same error actually. The script execution ends up with:
|
During the process
|
Nevermind. |
Hi, I was having the same "relocation R_X86_64_32 against" errors. I'm on Debian stretch:
I think all errors are from trying to link the libicuuc.a static library:
I did use the
And this solved my problem:-) |
set(CMAKE_EXE_LINKER_FLAGS "-no-pie") is not working for me i am getting the same error /usr/bin/ld: /usr/local/lib/libbcrypt.a(wrapper.c.o): relocation R_X86_64_PC32 against symbol `_crypt_itoa64' can not be used when making a shared object; recompile with -fPIC |
I was facing the same issue with other project
Lifesaver. I was facing the same issue with another project. |
Using a clean environment in docker I get exactly the same error. This is the sript I am executing
|
Aeh, you are downloading static libraries (usually illegal on many distros) and just linking against a libxml.a built Please link against the system libxml2 (which links against the correct system icu) or compile all sources from scratch as This applies for all other libraries too:
|
Ok, I tried to patch and package it for Archlinux, so that it builds fine with system libraries. The result is here: |
Thank you @andreasbaumann for your message In this build, we are not trying to make a linux redistribution package that will be further linked by other library (it would be another build scenario). Here we are building a standalone executable to be portable and packaged in other tools (to avoid having the users of these tools to install pdfalto on their system and deal with library compatibility). So our motivation here is not to link dynamically with the system libraries and not building something to be further linked with something else (afaik there is compiler and flag compatibility issues in this case).
Could you elaborate why it would be illegal or point to some explanations? To my understanding, there is no problem to add to a GitHub repo some static libraries built from GPL compatible sources in a GPL project.
The sources correspond to the script https://github.com/kermitt2/pdfalto/blob/master/install_deps.sh |
Well, illegal is a harsh term, sorry. :-) Statically linked libraries have been built with all kind of flags affecting the ABI (PIC, PIE, stack smashing, Static libraries might pose a security risk, imagine a vulnerabilty gets fixed in libpng, but you still link statically against The whole idea of doing packaging of software is to easy the installation for normal Linux users. But you leave the You end up in bitrot (for instance your C++ code depends on old deprecated APIs of libpng), which is not good |
@andreasbaumann So "bad practices" rather than illegal, I feel better with that :) Thanks a lot for the Archlinux package, this is great contribution! Could you maybe suggest some notes about it to be added in the readme? Or I can just point to https://aur.archlinux.org/packages/pdfalto/ ? I totally agree with you about packaging and that a statically link library is very bad distributable, sure. But this build was not intended for distributing a library, it's for building an executable that can work on a variety of outdated linux distro 64 bits and macos without any install for the end user (most would not do it). This is the scenario we needed pdfalto, which explains why we focused on it. For doing this, I don't see how we can avoid freezing the dependencies as static libraries, this is pro and cons of static vs dynamic. Would you have suggestions how to improve building a portable executable ? |
Yeah, this URL will do just fine. :-) At least I would add the sources as 3rdParty git modules, so that you know where those binaries came from |
Thank you @andreasbaumann There is actually a README on building from sources -> https://github.com/kermitt2/pdfalto/blob/master/Dependencies_INSTALL.md (although libpng & zlib are from local source :/ ) Then the problem is that the availability of these sources as git module. For instance I had to create and update a git repo for xpdf myself to be able to add it as a git module - so it is only moving the maintenance problem elsewhere... but I can try to look again when I will update the pdfalto project in the next weeks/months. |
... readme update for ArchLinux package adacaac |
Perfekt, thanks for being so patient with me. ;-) |
$ make
...
[ 15%] Linking CXX executable pdfalto
/usr/bin/ld: libs/image/png/linux/libpng.a(png.c.o): relocation R_X86_64_32 against `.rodata' can not be used when making a PIE object; recompile with -fPIC
....
$ cc -v
Using built-in specs.
COLLECT_GCC=cc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/8.2.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared --enable-threads=posix --enable-libmpx --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto
Thread model: posix
gcc version 8.2.1 20181127 (GCC)
Any ideas?
Thanks,
Rytis
The text was updated successfully, but these errors were encountered: