#95 ✓resolved
codykrieger

Issue building libcss

Reported by codykrieger | December 26th, 2010 @ 07:49 AM | in 0.0.3

What I did:

  • check out latest source from github
  • check out the submodules
  • build node (deps/node-build.sh)
  • check out libcss deps (deps/libcss/checkout-deps.sh)
  • install pkg-config with homebrew
  • attempt to build libcss (deps/libcss/build.sh)

What I expected to happen:
libcss to build successfully.

What actually happened:
libwapcaplet and libparserutils compile successfully, but libcss does not. At first I kept getting pkg-config issues - that led me to add the following line to the top of build.sh:

export PKG_CONFIG_PATH="$(pwd)/libparserutils:$(pwd)/libwapcaplet:$PKG_CONFIG_PATH"

After doing this to stop pkg-config from complaining:

cp deps/libcss/libparserutils/libparserutils.pc.in deps/libcss/libparserutils/libparserutils.pc
cp deps/libcss/libwapcaplet/libwapcaplet.pc.in deps/libcss/libwapcaplet/libwapcaplet.pc

Now, the output is:

------------------- libcss -------------------
 COMPILE: src/libcss.c
cc1: warnings being treated as errors
src/libcss.c: In function ‘css_initialise’:
src/libcss.c:31: warning: implicit declaration of function ‘parserutils_initialise’
src/libcss.c:31: warning: nested extern declaration of ‘parserutils_initialise’
src/libcss.c: In function ‘css_finalise’:
src/libcss.c:47: warning: implicit declaration of function ‘parserutils_finalise’
src/libcss.c:47: warning: nested extern declaration of ‘parserutils_finalise’
make: *** [build-Darwin-i386-release-lib-static/src_libcss.o] Error 1

There's some discussion about this going on here as well: http://groups.google.com/group/kod-app/browse_thread/thread/25ea121...

Comments and changes to this ticket

  • Aku Kotkavuo

    Aku Kotkavuo December 26th, 2010 @ 09:45 AM

    I can confirm this. The gist https://gist.github.com/755113 mentioned in the Google group discussion describes exactly what I'm seeing.

  • rsms

    rsms December 26th, 2010 @ 10:37 AM

    • Milestone set to 0.0.3
    • State changed from “new” to “open”
    • Milestone order changed from “66” to “0”

    It appears as the following line has no effect for you:

    CFLAGS="$CFLAGS -I../libparserutils/include -I../libwapcaplet/include -L.." make...
    

    This line is constructed in the function makeuniversal and instructs the compiler to look for header files in libparserutils/include and libwapcaplet/include, but also instructs the linker to look for libraries in lib.

    Could you please try to dump the CFLAGS passed in env by changing the makeuniversal function to:

    function makeuniversal {
      origd="$(pwd)"
      cd $1
      echo CFLAGS "$CFLAGS -arch x86_64 $3"
      CFLAGS="$CFLAGS -arch i386 $3" make TARGET=i386 || exit $?
      CFLAGS="$CFLAGS -arch x86_64 $3" make TARGET=x86_64 || exit $?
      rm -f ../lib/$2
      lipo build-*i386*/$2 build-*x86_64*/$2 -output ../lib/$2 -create
      cd "$origd"
    }
    

    (The only addition is a new line echo CFLAGS "$CFLAGS -arch x86_64 $3")

    A few questions:

    1. What's the result (output) from the above change (i.e. the value of CFLAGS)?

    2. What compiler are you using? (try cc -v)

    This is the output I'm getting for (1):

    CFLAGS  -arch x86_64 -I../libparserutils/include -I../libwapcaplet/include -L..
    

    Compiler version for (2) (I've added linebreaks):

    $ cc -v
    Using built-in specs.
    Target: i686-apple-darwin10
    Configured with: /var/tmp/gcc/gcc-5664~105/src/configure
      --disable-checking
      --enable-werror
      --prefix=/usr
      --mandir=/share/man
      --enable-languages=c,objc,c++,obj-c++
      --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
      --with-slibdir=/usr/lib
      --build=i686-apple-darwin10
      --program-prefix=i686-apple-darwin10-
      --host=x86_64-apple-darwin10
      --target=i686-apple-darwin10
      --with-gxx-include-dir=/include/c++/4.2.1
    Thread model: posix
    gcc version 4.2.1 (Apple Inc. build 5664)
    
  • lehni

    lehni December 26th, 2010 @ 10:48 AM

    I have the same problem and just added the echo line. I get the exact same output for (1) and (2) as you.

  • lehni

    lehni December 26th, 2010 @ 10:50 AM

    Just found a tiny difference, I have this in the cc -v output:

    Configured with: /var/tmp/gcc/gcc-5664~89/src/configure

    As opposed to:

    Configured with: /var/tmp/gcc/gcc-5664~105/src/configure

    Don't think it's relevant though...

  • codykrieger

    codykrieger December 26th, 2010 @ 11:16 AM

    Yep, dumping the CFLAGS yields the same result:

    CFLAGS  -arch x86_64 -I../libparserutils/include -I../libwapcaplet/include -L..
    

    I've tried the args to full paths instead of relative (e.g. /Users/codykrieger/projects/kod/deps/libcss/libparserutils/include), but the effect was the same.

  • Aku Kotkavuo

    Aku Kotkavuo December 26th, 2010 @ 11:44 AM

    I also get exactly the same output for (1) and (2) as you, except for the tmpdir mentioned earlier.

    Could it be that libcss's Makefile is overwriting CFLAGS? It has a section like this:

    # Parserutils & wapcaplet
    ifneq ($(PKGCONFIG),)
      CFLAGS := $(CFLAGS) $(shell $(PKGCONFIG) libparserutils libwapcaplet --cflags)
      LDFLAGS := $(LDFLAGS) $(shell $(PKGCONFIG) libparserutils libwapcaplet --libs)
    else
      CFLAGS := $(CFLAGS) -I$(PREFIX)/include
      LDFLAGS := $(LDFLAGS) -lparserutils -lwapcaplet
    endif
    

    I have pkgconfig installed via Homebrew, but it shouldn't interfere with building this.

  • codykrieger

    codykrieger December 26th, 2010 @ 12:59 PM

    I have pkg-config installed via homebrew as well. I did some Makefile debugging - I'm 99% sure the CFLAGS var is intact throughout the duration of the building process, it just doesn't seem to matter for some reason.

  • codykrieger

    codykrieger December 26th, 2010 @ 01:12 PM

    Regarding (2), have the same output minus the slightly different tmp directory, as Aku stated as well.

  • sivel

    sivel December 26th, 2010 @ 07:39 PM

    I've removed pkg-config as installed by homebrew and tried using pkgconfig from MacPorts, but no luck there either.

  • Ryan

    Ryan December 26th, 2010 @ 10:28 PM

    Where exactly is parserutils_initialise defined? grep isn't giving me anything.

  • Swizec

    Swizec December 26th, 2010 @ 10:57 PM

    Think I've gotten a little further with building libcss.

    Changing the two CFLAGS lines in makeuniversal to:

      CFLAGS="$CFLAGS -arch i386 $3" make TARGET=i386
      CFLAGS="$CFLAGS -arch x86_64 $3" make TARGET=x86_64
    

    (removing || exit $?)

    Yielded this output:

    Swizec$ ./build.sh 
    ------------------- libwapcaplet -------------------
    Architectures in the fat file: lib/libwapcaplet.a are: i386 x86_64 
    ------------------- libparserutils -------------------
    Architectures in the fat file: lib/libparserutils.a are: i386 x86_64 
    ------------------- libcss -------------------
     COMPILE: src/libcss.c
    cc1: warnings being treated as errors
    src/libcss.c: In function ‘css_initialise’:
    src/libcss.c:31: warning: implicit declaration of function ‘parserutils_initialise’
    src/libcss.c:31: warning: nested extern declaration of ‘parserutils_initialise’
    src/libcss.c: In function ‘css_finalise’:
    src/libcss.c:47: warning: implicit declaration of function ‘parserutils_finalise’
    src/libcss.c:47: warning: nested extern declaration of ‘parserutils_finalise’
    make: *** [build-Darwin-i386-release-lib-static/src_libcss.o] Error 1
     COMPILE: src/libcss.c
    cc1: warnings being treated as errors
    src/libcss.c: In function ‘css_initialise’:
    src/libcss.c:31: warning: implicit declaration of function ‘parserutils_initialise’
    src/libcss.c:31: warning: nested extern declaration of ‘parserutils_initialise’
    src/libcss.c: In function ‘css_finalise’:
    src/libcss.c:47: warning: implicit declaration of function ‘parserutils_finalise’
    src/libcss.c:47: warning: nested extern declaration of ‘parserutils_finalise’
    make: *** [build-Darwin-x86_64-release-lib-static/src_libcss.o] Error 1
    
    lipo: can't open input file: build-*i386*/libcss.a (No such file or directory)
    lipo: can't open input file: lib/libcss.a (No such file or directory)
    ------------------- headers -------------------
    libcss/include/libcss -> include/libcss
    libcss/include/libcss/computed.h -> include/libcss/computed.h
    libcss/include/libcss/errors.h -> include/libcss/errors.h
    libcss/include/libcss/fpmath.h -> include/libcss/fpmath.h
    libcss/include/libcss/functypes.h -> include/libcss/functypes.h
    libcss/include/libcss/hint.h -> include/libcss/hint.h
    libcss/include/libcss/libcss.h -> include/libcss/libcss.h
    libcss/include/libcss/properties.h -> include/libcss/properties.h
    libcss/include/libcss/select.h -> include/libcss/select.h
    libcss/include/libcss/stylesheet.h -> include/libcss/stylesheet.h
    libcss/include/libcss/types.h -> include/libcss/types.h
    ------------------- example1 -------------------
    example1.c: In function ‘main’:
    example1.c:131: warning: implicit declaration of function ‘lwc_initialise’
    ld: library not found for -lcss
    collect2: ld returned 1 exit status
    ./build.sh: line 60: ./example1: No such file or directory
    ------------------- CSS.framework -------------------
    ** BUILD FAILED **
    
    
    The following build commands failed:
    CSS:
        Ld /Users/Swizec/Documents/opensauce/kod/deps/libcss/cocoa-framework/build/CSS.build/Release/CSS.build/Objects-normal/x86_64/CSS normal x86_64
        Ld /Users/Swizec/Documents/opensauce/kod/deps/libcss/cocoa-framework/build/CSS.build/Release/CSS.build/Objects-normal/i386/CSS normal i386
    (2 failures)
    
  • David

    David December 27th, 2010 @ 01:15 AM

    Similarly to @Swizec: If you pull the -Werror out of the libcss Makefile (just to check), the build process is almost exactly the same as removing

    "|| exit $?"

    from the CFLAGS defs.

  • ronin-130346 (at lighthouseapp)

    ronin-130346 (at lighthouseapp) December 27th, 2010 @ 07:24 AM

    For what is worth, I was running into the same situation mentioned above. I was able to get libcss to build using the tag 0.0.2 versions of libparerutils and libwapcaplet.

    Just updated by deps/libcss/checkout-deps.sh file to look like this:

    #!/bin/bash
    cd "$(dirname "$0")"
    if [ ! -d libparserutils ]; then
      svn co svn://svn.netsurf-browser.org/tags/libparserutils/0.0.2/ libparserutils
    fi
    if [ ! -d libwapcaplet ]; then
      svn co svn://svn.netsurf-browser.org/tags/libwapcaplet/0.0.2/ libwapcaplet
    fi
    

    I noticed a change to libparserutils/include/parserutils/parserutils.h that seems suspect. But, I have no idea if that is at all related to the warnings showing up in the compilation of under the trunk of those dependencies.

    Thoughts?

  • codykrieger

    codykrieger December 27th, 2010 @ 08:00 AM

    That diff says everything, good catch - both the initialise and finalise methods are gone from the header now, which is why libcss fails to build.

    I can confirm that checking out tag 0.0.2 for both of them definitely allows libcss to compile properly, provided you do this again after you've checked out the proper versions:

    cp deps/libcss/libparserutils/libparserutils.pc.in deps/libcss/libparserutils/libparserutils.pc
    cp deps/libcss/libwapcaplet/libwapcaplet.pc.in deps/libcss/libwapcaplet/libwapcaplet.pc
    

    Provided the 0.0.2 tags aren't too old and decrepit to use with libcss and Kod, I think we're good here.

  • Ryan Spaulding

    Ryan Spaulding December 27th, 2010 @ 09:02 AM

    I was able to get libcss to to complete a build (have no idea if it is fully functional) with checking out the '0.0.2' tags and doing the two cp statements. Below are the errors I am getting now:

    Package libparserutils was not found in the pkg-config search path.
    Perhaps you should add the directory containing libparserutils.pc'<br/> to the PKG_CONFIG_PATH environment variable<br/> No package 'libparserutils' found<br/> Package libwapcaplet was not found in the pkg-config search path.<br/> Perhaps you should add the directory containinglibwapcaplet.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libwapcaplet' found
    Package libparserutils was not found in the pkg-config search path.
    Perhaps you should add the directory containing libparserutils.pc'<br/> to the PKG_CONFIG_PATH environment variable<br/> No package 'libparserutils' found<br/> Package libwapcaplet was not found in the pkg-config search path.<br/> Perhaps you should add the directory containinglibwapcaplet.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libwapcaplet' found

    I have tired a number of ways (in the build.sh and on the command line) to set the PKG_CONFIG_PATH variable.

  • codykrieger

    codykrieger December 27th, 2010 @ 09:08 AM

    You added the following to the top of your build.sh:

    export PKG_CONFIG_PATH="$(pwd)/libparserutils:$(pwd)/libwapcaplet:$PKG_CONFIG_PATH"
    

    Right? If not, try that. Worked fine for me after copying the .pc.in files.

  • Ryan Spaulding

    Ryan Spaulding December 27th, 2010 @ 09:16 AM

    nope, but adding that in did the trick. Should these changes be added in, or is using the 2.0.0 tag a hack? Sorry for the crappy formatting from my last response.

  • Swizec

    Swizec December 27th, 2010 @ 11:13 AM

    Yep, I can confirm. Doing it with 0.0.2 worked for me as well.

  • codykrieger

    codykrieger December 27th, 2010 @ 11:26 AM

    @Ryan: I defer to Rasmus on that one, not sure if there is any functionality or behavior that is required of either library past v0.0.2 or not.

  • alexkli

    alexkli December 27th, 2010 @ 02:20 PM

    I can confirm that using the 0.0.2 tag (changing checkout-deps.sh as described above) plus adapting build.sh as in this comment worked!

  • Deleted User

    Deleted User December 27th, 2010 @ 05:55 PM

    I think this is worthy of a patch :D

  • rsms

    rsms December 27th, 2010 @ 06:59 PM

    • State changed from “open” to “resolved”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

A text editor for Mac OS X

Referenced by

Pages