Problem R_X86_64_PC32 lazarus / 66-Unix ---------------------------------------------------------------------- krab22 · 2015-03-06 05:33 Good afternoon! Fedora 21 64 Workstation Memory: 8Gb Not compiled fpc64. Error build with the text: "relocation truncated to fit: R_X86_64_PC32 against" What should be done to solve the problem? ---------------------------------------------------------------------- marcov · 2015-03-06 06:03 What do you exactly do? Try to create a dynamic library? ---------------------------------------------------------------------- krab22 · 2015-03-06 06:54 compiled FPC ---------------------------------------------------------------------- Jonas Maebe · 2015-03-06 07:09 How are you compiling FPC? ---------------------------------------------------------------------- krab22 · 2015-03-06 09:06 Build script Code: [Select]# ============================================================= #                CodeTyphon Studio #      Copyright (c) PilotLogic Software House. #               All rights reserved. # ============================================================= dothejob() { echo "   " echo "==============================================================" echo "            Build FreePascal $vBits for $vHostOSRealName" echo "==============================================================" echo "   " if [ ! -f $vFpcSrcDir/Makefile.fpc ] ; then        echo "[INFO]: FPC$vBits Source files not exists, extracting..."     ./ln_FPC0_Extract_Source_From_ZipFile.sh fi if [ ! -f $vFpcExeDir/$vFpcExeFile ] ; then          echo "[INFO]: FPC$vBits Binary files not exists, extracting..."     ./ln_FPC0_Install_Bin_Files.sh 64 fi if [ -d $vFpcDir/newfpc ] ; then        echo "[INFO]: Remove OLD FreePascal temporary build folder..."     sudo rm -rf $vFpcDir/newfpc fi cd $vCTDir/fpcsrc echo "------------------------------------------------" echo "        Clean FreePascal $vBits" echo "------------------------------------------------" sudo $vMake clean PP=$vFpcExeDir/$vFpcExeFile echo "------------------------------------------------" echo "            Build FreePascal $vBits" echo "------------------------------------------------" #sleep 100 echo 'пути '$vFpcExeDir/$vFpcExeFile case $vOSName in solaris)    sudo $vMake all OPT="-Xn" PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove  ;; linux)    sudo $vMake all PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove  ;; freebsd)    sudo $vMake all OPT="-Fl/usr/local/lib" PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove  ;; openbsd)    sudo $vMake all OPT="-Fl/usr/local/lib" PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove  ;; netbsd)    sudo $vMake all OPT="-Fl/usr/local/lib" PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove  ;; dragonfly)    sudo $vMake all OPT="-Fl/usr/local/lib" PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove  ;; darwin)     sudo $vMake all PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove     ;; *)    sudo $vMake all PP=$vFpcExeDir/$vFpcExeFile PPUMOVE=/usr/lib/codetyphon/fpcsrc/compiler/utils/ppumove  ;; esac # ======================================================= if [ -f $vCTDir/Settings/CT_FPC_Stop_Before_Install.ctsw ] ; then   echo "   "   echo "[INFO]: Switch, FPC Stop Before Install Procedure, is ON."   echo "        FPC Build procedure STOP.."   echo "   "   exit fi # ===================================================== echo "   " echo "------------------------------------------------" echo "        Install FreePascal $vBits" echo "------------------------------------------------" sudo $vMake install PP=$vFpcExeDir/$vFpcExeFile INSTALL_PREFIX=/usr/lib/codetyphon/fpc/newfpc echo "   " echo "------------------------------------------------" echo "        Clean FreePascal $vBits" echo "------------------------------------------------" sudo $vMake clean PP=$vFpcExeDir/$vFpcExeFile # ===================================================== echo "   " echo "------------------------------------------------" echo "        Copy FreePascal $vBits" echo "------------------------------------------------" if [ ! -d $vFpcBitsDir/ ] ; then    sudo mkdir $vFpcBitsDir fi sudo chmod -R 777 $vFpcDir/ sudo cp -f $vFpcDir/newfpc/bin/* $vFpcExeDir/ sudo cp -fr $vFpcDir/newfpc/share/* $vFpcBitsDir/ sudo cp -fr $vFpcDir/newfpc/lib/fpc/$vFpcVer/* $vFpcBitsDir/ sudo rm -fr $vFpcDir/newfpc/lib/fpc/$vFpcVer sudo cp -fr $vFpcDir/newfpc/lib/fpc/* $vFpcBitsDir/ sudo rm -fr $vFpcDir/newfpc sudo mv -f $vFpcBitsDir/$vFpcExeFile $vFpcExeDir/ sudo chmod -R 777 $vFpcBinDir sudo chmod -R 777 $vFpcDir #========================================= sudo rm -f $vOSBinDir/$vFpcExeFile sudo rm -f $vOSBinDir/fpc$vBits sudo ln -f -s $vFpcExeDir/$vFpcExeFile $vOSBinDir/$vFpcExeFile sudo ln -f -s $vFpcExeDir/$vFpcExeFile $vOSBinDir/fpc$vBits #========================================= echo "   " echo "[FINAL INFO]: FreePascal $vBits Building, finish..." echo "================================================================ =====" } # =================== MAIN ============================= . $PWD/ln_All_Functions.sh getvalues if [ $vBits = 64 ] ; then  dothejob fi Log Code: [Select]/bin/mkdir -p x86_64/units/x86_64-linux /usr/lib/codetyphon/fpc/fpc64/bin/x86_64-linux/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/usr/lib/codetyphon/fpcsrc/rtl/units/x86_64-linux -Fix86_64 -FE. -FUx86_64/units/x86_64-linux -Cg -dRELEASE -fPIC   -dx86_64 -dGDB -dBROWSERLOG -Fux86 -Sew pp.pas /bin/ld: warning: ./link.res contains output sections; did you forget -T? /usr/lib/codetyphon/fpcsrc/rtl/units/x86_64-linux/sysutils.o: In function `SYSUTILS_$$_EXPANDFILENAMECASE$RAWBYTESTRING$TFILENAMECASEMA TCH$$RAWBYTESTRING': sysutils.pp:(.text.n_sysutils_$$_expandfilenamecase$rawbytestring$tfil enamecasematch$$rawbytestring+0x22b): relocation truncated to fit: R_X86_64_PLT32 against symbol `fpc_ansistr_assign' defined in .text.n_fpc_ansistr_assign section in /usr/lib/codetyphon/fpcsrc/rtl/units/x86_64-linux/system.o pp.pas(247,1) Error: Error while linking pp.pas(247,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted Makefile:3925: ошибка выполнения рецепта для цели «ppcx64» make[5]: *** [ppcx64] Ошибка 1 make[5]: выход из каталога «/usr/lib/codetyphon/fpcsrc/compiler» Makefile:3967: ошибка выполнения рецепта для цели «next» make[4]: *** [next] Ошибка 2 make[4]: выход из каталога «/usr/lib/codetyphon/fpcsrc/compiler» Makefile:3972: ошибка выполнения рецепта для цели «ppc1» make[3]: *** [ppc1] Ошибка 2 make[3]: выход из каталога «/usr/lib/codetyphon/fpcsrc/compiler» Makefile:3984: ошибка выполнения рецепта для цели «cycle» make[2]: *** [cycle] Ошибка 2 make[2]: выход из каталога «/usr/lib/codetyphon/fpcsrc/compiler» Makefile:2779: ошибка выполнения рецепта для цели «compiler_cycle» make[1]: *** [compiler_cycle] Ошибка 2 make[1]: выход из каталога «/usr/lib/codetyphon/fpcsrc» Makefile:2804: ошибка выполнения рецепта для цели «build-stamp.x86_64-linux» make: *** [build-stamp.x86_64-linux] Ошибка 2   [INFO]: Switch, FPC Stop Before Install Procedure, is ON.         FPC Build procedure STOP..   _______________________________________________________________ Terminate Action at 6-3-15 12:09:07 Total time: 00:00:19.331 ExitCode : 0                                                                              ---------------------------------------------------------------------- Jonas Maebe · 2015-03-06 09:12 Which revision of the FPC source code (from which branch) are you compiling? And what is the version number of your starting compiler? Also, what is the version of your binutils? Normally, the error you get should only occur if the total size of your code (+ possibly static data) is over 4GB, but that's definitely not the case for the compiler binary. ---------------------------------------------------------------------- krab22 · 2015-03-06 09:36 (GNU Binutils) version 2.24 Version in the attached file. ---------------------------------------------------------------------- krab22 · 2015-03-09 05:57 In yet found https://software.intel.com/en-us/articles/avoiding- relocation-errors-when-building-applications-with-large-global-or- static-data-on-intel64/ Only where this parameter (-mcmodel = medium) exhibit. ---------------------------------------------------------------------- krab22 · 2015-03-10 02:46 Removed 4GB memory - everything compiled fine! ---------------------------------------------------------------------- krab22 · 2015-03-10 08:38 The question is not removed! ---------------------------------------------------------------------- Jonas Maebe · 2015-03-10 12:09 Quote from: krab22 on March 10, 2015, 09:38:06 amThe question is not removed! You're absolutely correct: I have absolutely no idea why that helped, except if the memory that your removed is faulty. ---------------------------------------------------------------------- krab22 · 2015-03-10 16:19 Memory tested by using memtest. It's okay. ---------------------------------------------------------------------- krab22 · 2015-03-10 16:20 What do you think about the message https://software.intel.com/en- us/articles/avoiding-relocation-errors-when-building-applications- with-large-global-or-static-data-on-intel64/? ---------------------------------------------------------------------- Jonas Maebe · 2015-03-10 16:30 That says exactly the same as what I said before: "Normally, the error you get should only occur if the total size of your code (+ possibly static data) is over 4GB, but that's definitely not the case for the compiler binary." Whether you have 500MB or 128GB of ram in your computer should not, and normally cannot, affect that error message you are getting from the linker. The behaviour you are seeing simply does not make any sense. ---------------------------------------------------------------------- krab22 · 2015-03-11 02:56 Modules must be compiled for a specific memory model. If you do not, an error occurs linker. How does this win when compiling FPC? ---------------------------------------------------------------------- Jonas Maebe · 2015-03-11 09:24 FPC only supports the small memory model on x86-64. That is fine as long as you don't have more 2GB of data, which is the case for the compiler. ---------------------------------------------------------------------- krab22 · 2015-03-12 03:10 Quote from: Jonas Maebe on March 11, 2015, 10:24:13 amFPC only supports the small memory model on x86-64. That is fine as long as you don't have more 2GB of data, which is the case for the compiler. It's all good! But why is not going to the compiler? ---------------------------------------------------------------------- Jonas Maebe · 2015-03-12 09:02 I don't know why it fails. As mentioned before, the only thing I can think of that explains the symptoms you've described is a hardware problem. It could also be a bug in the binutils version you are using, but the fact that removing memory from your computer fixed the problem makes this very unlikely. ---------------------------------------------------------------------- marcov · 2015-03-12 12:30 (Removed, problem seems to be code size, not datasize) ---------------------------------------------------------------------- Jonas Maebe · 2015-03-12 12:34 The problem happens while compiling the compiler itself in his case. The compiler does not have a combined code+data size of more than 2GB (a reference to code from data can also be out of range if only the data section is >= 2GB). ---------------------------------------------------------------------- krab22 · 2015-03-13 02:18 Quote from: Jonas Maebe on March 12, 2015, 01:34:37 pmThe problem happens while compiling the compiler itself in his case. The compiler does not have a combined code+data size of more than 2GB (a reference to code from data can also be out of range if only the data section is >= 2GB). From your statements problem persists ... ---------------------------------------------------------------------- krab22 · 2015-03-13 02:20 Quote from: marcov on March 12, 2015, 01:30:14 pmRemoved, problem seems to be code size, not datasize I think so too ---------------------------------------------------------------------- Cyrax · 2015-03-13 02:22 Please try to build FPC via standard way, not using CodeTyphon files and their build scripts. ---------------------------------------------------------------------- krab22 · 2015-03-13 10:52 Quote from: Cyrax on March 13, 2015, 03:22:56 amPlease try to build FPC via standard way, not using CodeTyphon files and their build scripts. Tried to collect the resulting repository tag 2_6_4. The same situation. ---------------------------------------------------------------------- engkin · 2015-03-13 16:19 What compiler/binutils did you use this time to compile 2.6.4? ---------------------------------------------------------------------- krab22 · 2015-03-16 03:06 Quote from: engkin on March 13, 2015, 05:19:28 pmWhat compiler/binutils did you use this time to compile 2.6.4? http://forum.lazarus.freepascal.org/index.php/topic,27615.msg170846.ht ml#msg170846 ---------------------------------------------------------------------- engkin · 2015-03-16 03:35 Quote from: krab22 on March 16, 2015, 04:06:42 amQuote from: engkin on March 13, 2015, 05:19:28 pmWhat compiler/binutils did you use this time to compile 2.6.4? http://forum.lazarus.freepascal.org/index.php/topic,27615.msg170846.ht ml#msg170846 I suspected that you did use CodeTyphon, again, while Cyrax advised: Quote from: Cyrax on March 13, 2015, 03:22:56 amPlease try to build FPC via standard way, not using CodeTyphon files and their build scripts. ---------------------------------------------------------------------- krab22 · 2015-03-18 10:39 "I suspected that you did use CodeTyphon, again, while Cyrax advised:" The link is provided to clarify the compilers. When assembling FPC_2.6.4 standard methods the same error occurs. ---------------------------------------------------------------------- Jonas Maebe · 2015-03-24 19:03 Could you try with an older or a newer version of binutils?