[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: have headers & libs, but cannot configure/make

From: Chris Roat
Subject: Re: have headers & libs, but cannot configure/make
Date: Tue, 3 Jan 2017 17:42:46 -0800

On Fri, Dec 23, 2016 at 4:22 PM, Mike Miller <address@hidden> wrote:
On Fri, Dec 23, 2016 at 15:49:42 -0800, Chris Roat wrote:
> I am cross compiling and defining CC/CPP/CXX/etc, using static libraries.
> First problem: I have the pcre headers & libs present, and use -I in
> CCFLAGS/CPPFLAGS and -L in LDFLAGS to point to them.  Configure still gives
> up the ghost.  (My workaround is to simply delete part of the PCRE section
> in 'configure' and hardcode the PCRE_LIBS.)

It would be interesting to see what the error here was. If you can
recreate this, can you paste the full compiler command line and error
message from config.log? It should be enough to search for "checking for

Yes, that's right.  It's finding the pcre header (my use of a -I in CPPFLAGS or PCRE_CFLAGS to direct it to the right place), and then tries to link in pcre:

<elided>/gcc -std=gnu11 -o conftest --sysroot=<elided> -m64  -mcld -fopenmp  -fopenmp -I<elided>/pcre -I<elided>/SuiteSparse_config --sysroot=<elided> -m64  -mcld -fopenmp -lstdc++ conftest.c -lpcre -lm 

<elided>: error: cannot find -lpcre
/tmp/cc0c03Xl.o:conftest.c:function main: error: undefined reference to 'pcre_compile'
collect2: error: ld returned 1 exit status
configure:30566: $? = 1

The build system really pushes toward shared-lib linking, so I really felt I needed to hardcode values in configure and delete part of the PCRE stanza.

> includes="-I${include_path}/pcre "
> libs="-L${lib_path}/prce"
> export CCFLAGS="--sysroot=$rt_top --m64 -mcld ${includes}"

This should be "CFLAGS", not "CCFLAGS". And you might also want to set

> export CPPFLAGS="--sysroot=$rt_top -m64 -mcld ${includes}"

The CPPFLAGS variable should contain preprocessor options, so typically
only -D and -I options. And these options are cumulative with the other

> export LDFLAGS="--sysroot=$rt_top -m64 -mcld -lstdc++ -fopenmp ${libs}"

The -fopenmp option should be given at both the compile and link stages.
And I'm not sure that you need to force -lstdc++, even with cross
compiling. The build system ensures that anything linked with a C++
object file will use g++ as the linker, which DTRT.

I would recommend something like this

  options="--sysroot=$rt_top -m64 -mcld -fopenmp"
  export CPPFLAGS="${includes}"
  export CFLAGS="${options}"
  export CXXFLAGS="${options}"
  export FFLAGS="${options}"
  export LDFLAGS="${options} ${libs}"

Thanks - this got me going down the right path. I did need -lstdc++ or even the initial check on the blas library dies due to operator new.  After enabling the all-dependencies linking (your solution below), I've ended up with something fairly small.  But I haven't solved all problems (see below).

options="--sysroot=$rt_top -m64  -mcld -fopenmp"
export CPPFLAGS="-I${pcre_h} -I${suite_sparse}/SuiteSparse_config"
export CFLAGS="${options}"
export FFLAGS="${options}"
export LDFLAGS="<path>/libglpk.a <path>/libfreetype_xxx.a <path>/libpng.a -lstdc++"

> Secondly, once I get configure to work by passing in all the include
> directories and libraries (using lots and lots of --with-xxx flags), I
> still seem need to the libraries all again in LDFLAGS.    For example, the
> octave-cli target is made without referencing any library I passed into
> configure's flags.
> I feel like I missed some basic instruction, flag, or other step.  Thanks
> in advance for any tips.
> ./configure \
>   --enable-option-checking \
>   --disable-silent-rules \
>   --disable-dl \
>   --disable-shared \
>   --enable-static \
>   --disable-readline \
>   --disable-docs \
>   --disable-java \
>   --without-qt \
>   --without-fltk \
>   --without-opengl \
>   --without-OSMesa \
>   --without-portaudio \
>   --without-sndfile \
>   --without-x \
>   --with-blas=...(lots more of these)

Most users do not build Octave statically, so you may be testing a
configuration that hasn't been used in a while. But there is a configure
option, --enable-link-all-dependencies, which I think is intended for
this purpose. Try it and let us know if it helps.

Ah, I didn't understand what that flag did.  That helps.  Using that, I could then whittle things down a bit (beyond my hacks for pcre above).  I discovered I needed this change to configure to pick up the CXSPARSE flags I passed in via the --with-cxsparse flags:


And I found I just needed to add two libraries on the final link step of the octave-cli.  See my LDFLAGS above.
- glpk (this didn't get used, even though I had --with-glpk="/<path>/libglpk.a"
- freetype (it needed to be after fontconfig, which I suppose means I can add it to FONTCONFIG_LIBS)


Also, which version (or hg revision) are you trying to build?

Sorry - I'm using version 4.2.0.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]