You are not logged in.

#1 2012-06-25 18:18:37

Eithrial
Member
Registered: 2012-06-22
Posts: 22

kate compilation error

I was trying to compile kate via abs and got error. Build log can be seen there:
http://pastebin.com/sGWJWNAH


I focused on these part:

relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.1/../../../../lib/libm.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status

But I have no idea how to change buildflags and add "-fPIC". I tried putting it in different ways in PKGBUILD, patch Makefile or even change global makeflags and end up always with same error. Any ideas how to change this?

Offline

#2 2012-06-25 18:23:31

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,045
Website

Re: kate compilation error

When you patched the Makefile, did you do that *after* the line(s) that run configure?  And how did you attempt to do so?

Last edited by Trilby (2012-06-25 18:24:02)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#3 2012-06-25 18:33:55

Eithrial
Member
Registered: 2012-06-22
Posts: 22

Re: kate compilation error

I don't know how it should be done. Makefile was created after running cmake, so I created patch new.patch and put it this way in PKGBUILD

build() {
  cd "${srcdir}"/kate-${pkgver}
  patch -p1 -i "${srcdir}"/pkgbuild-syntax-highlight.patch

  cd "${srcdir}"
  mkdir build
  cd build

  cmake ../kate-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr
   
patch -p1 -i "${srcdir}"/new.patch
  make
}

patch looks like this:

*** build/Makefile~    2012-06-25 17:59:36.891657822 +0200
--- build/Makefile    2012-06-25 17:58:32.000000000 +0200
***************
*** 5,10 ****
--- 5,13 ----
  default_target: all
  .PHONY : default_target
 
+ CFLAGS="-fPIC"
+ CXXFLAGS="-fPIC"
+
  #=============================================================================
  # Special targets provided by cmake.

I used several versions of it changing "" and making other minor changes. However Im total noob so I understand risk that these changes could have changed nothing.

Last edited by Eithrial (2012-06-25 19:57:40)

Offline

#4 2012-06-25 19:55:42

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,045
Website

Re: kate compilation error

It looks like you did it pretty much right.  You do not need quotes.  I don't know if they do any harm, I doubt it, but to be on the safe side, I'd leave them off.

Can you post the top of the Makefile before patching?  Perhaps it doesn't use CFLAGS.  It's better to hijack one of the existing variables and tack the -fPIC onto the end.  This would also avoid resetting the variable or risk it getting reset after you set it.

In other words, if there is already a line defining CFLAGS in the makefile, and it does not use a "+=" syntax, then your setting will just get knocked out if your patch puts it in before that setting.

Perhaps a better 'fix' would be to put fPIC into the cmake inputs.  I don't use cmake though, so I'm not sure which input file should be added to.

Also, for something like this I'd usually use a sed command in the PKGBUILD rather than a patch - but this may be a matter of personal preference.

Last edited by Trilby (2012-06-25 19:56:37)


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

#5 2012-06-25 20:21:08

Eithrial
Member
Registered: 2012-06-22
Posts: 22

Re: kate compilation error

My another try. Using patch to add

SET(CMAKE_CXX_FLAGS_RELEASE "-fPIC")
SET(CMAKE_C_FLAGS_RELEASE "-fPIC")

to CMakeLists.txt(in src directory) before executing cmake, Nothing changed.

In default Makefile there is nothing mentioned about any buildflags.

Changed again to:

SET(CMAKE_BUILD_TYPE distribution) 
SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-fPIC")
SET(CMAKE_C_FLAGS_DISTRIBUTION "-fPIC")

Last try tonight failed. This time I put this to CMakelists.txt:

SET(CMAKE_CXX_FLAGS "-fPIC")


And disable patches and edit PKGBUILD around cmake like this

CXXFLAGS="$CXXFLAGS-fPIC" cmake ../kate-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr

Nothing helps.

Last edited by Eithrial (2012-06-25 21:09:21)

Offline

#6 2012-06-25 23:54:31

Eithrial
Member
Registered: 2012-06-22
Posts: 22

Re: kate compilation error

Ok, now I know it's not problem connected with source code, but problem caused by not proper gcc libs compilation. Tommorow I'll try to take care of it.

Offline

#7 2012-06-26 17:08:01

Eithrial
Member
Registered: 2012-06-22
Posts: 22

Re: kate compilation error

Im not sure what solved the problem, but I renamed libm.so to libm.a then successfully compiled kate, then renamed it to original version and compilation still works...

Offline

#8 2012-06-28 15:23:39

ilpianista
Fellow developer
From: Lecce, Italy
Registered: 2007-10-06
Posts: 567
Website

Re: kate compilation error

Cannot reproduce. It builds here.

Anyway, you just have to use:

-DCMAKE_CXX_FLAGS="${CXXFLAGS} -fPIC"

Offline

#9 2012-06-28 15:48:27

sitquietly
Member
From: Moscow, Tennessee
Registered: 2010-07-12
Posts: 216

Re: kate compilation error

Eithrial wrote:

Im not sure what solved the problem, but I renamed libm.so to libm.a then successfully compiled kate, then renamed it to original version and compilation still works...

I don't think you want to do that sad

Maybe it will help to read the Gentoo article on Howto Fix -fPIC Errors.

Offline

Board footer

Powered by FluxBB