Recent

Author Topic: Problem R_X86_64_PC32  (Read 14142 times)

krab22

  • New Member
  • *
  • Posts: 16
Problem R_X86_64_PC32
« on: March 06, 2015, 06:33:06 am »
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

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7495
Re: Problem R_X86_64_PC32
« Reply #1 on: March 06, 2015, 07:03:23 am »
What do you exactly do? Try to create a dynamic library?

krab22

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #2 on: March 06, 2015, 07:54:03 am »
compiled FPC

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 669
Re: Problem R_X86_64_PC32
« Reply #3 on: March 06, 2015, 08:09:50 am »
How are you compiling FPC?

krab22

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #4 on: March 06, 2015, 10:06:26 am »
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$TFILENAMECASEMATCH$$RAWBYTESTRING':
sysutils.pp:(.text.n_sysutils_$$_expandfilenamecase$rawbytestring$tfilenamecasematch$$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

  • Hero Member
  • *****
  • Posts: 669
Re: Problem R_X86_64_PC32
« Reply #5 on: March 06, 2015, 10:12:00 am »
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

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #6 on: March 06, 2015, 10:36:54 am »
(GNU Binutils) version 2.24
Version in the attached file.

krab22

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #7 on: March 09, 2015, 06:57:37 am »

krab22

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #8 on: March 10, 2015, 03:46:29 am »
Removed 4GB memory - everything compiled fine!

krab22

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #9 on: March 10, 2015, 09:38:06 am »
The question is not removed!

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 669
Re: Problem R_X86_64_PC32
« Reply #10 on: March 10, 2015, 01:09:07 pm »
The 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

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #11 on: March 10, 2015, 05:19:06 pm »
Memory tested by using memtest.
It's okay.

krab22

  • New Member
  • *
  • Posts: 16

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 669
Re: Problem R_X86_64_PC32
« Reply #13 on: March 10, 2015, 05:30:42 pm »
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

  • New Member
  • *
  • Posts: 16
Re: Problem R_X86_64_PC32
« Reply #14 on: March 11, 2015, 03:56:08 am »
Modules must be compiled for a specific memory model. If you do not, an error occurs linker. How does this win when compiling FPC?