Tiny Core Linux

Tiny Core Extensions => TCE Corepure64 => Topic started by: flyingfishfinger on February 09, 2016, 09:58:36 PM

Title: How to build -dev extensions?
Post by: flyingfishfinger on February 09, 2016, 09:58:36 PM
Hi,
Do you guys have any pointers on how to build -dev extensions? I'm working on building qemu64 (see my other thread), and it requires the -dev files for both spice-protocol and spice-server. I've built the non-dev extensions for both, but I don't know how to do the -dev ones.
I've read up on what files need to go into the -dev versions, but I'm not sure how to get them out of the install directory / properly into their own extension.
Thanks!

Rafael
Title: Re: How to build -dev extensions?
Post by: Rich on February 09, 2016, 10:03:28 PM
Hi flyingfishfinger
When you build an extension you have the files required for a  dev  extension. The  dev  extensions contain the
header files and static libraries (.h, .a, and .la files).
Title: Re: How to build -dev extensions?
Post by: flyingfishfinger on February 09, 2016, 10:57:17 PM
What should one do if a source builds to a DESTDIR which then itself contains "home/tc/..."? Seems odd..
Title: Re: How to build -dev extensions?
Post by: Rich on February 09, 2016, 11:15:20 PM
Hi flyingfishfinger
I'm not sure I understand the question, but does this help:
http://wiki.tinycorelinux.net/wiki:creating_extensions#creating_a_tcz
Just adapt the instructions for /home/tc/
Title: Re: How to build -dev extensions?
Post by: flyingfishfinger on February 09, 2016, 11:17:52 PM
No, I follow the instructions fine, that's not the issue.
I'm wondering whether it is ok for a piece of software to tie itself to the name of the current user's profile (in this case, "tc"). Shouldn't all the files be in /usr?

R
Title: Re: How to build -dev extensions?
Post by: Rich on February 09, 2016, 11:33:14 PM
Hi flyingfishfinger
Yes, most files should wind up under /usr. Some extensions will however place config files under  /home/$USER/.
The  /usr/local/tce.installed  script is used in that case to check for the existence of those files and create them
if they are not there.
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 12:08:26 AM
Most apps will create the files/folders they need in home/$USER and /var if they are not present.

A few apps will fail to start if they files/folders they need are not present.

Maybe the best thing to do is to try the extension without the files/folders in /home/tc and see what happens - if the app fails to start, then you can add a suitable start-up script.
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 12:10:50 AM
The  dev  extensions contain the header files and static libraries (.h, .a, and .la files).

..and .m4, .pc, .vapi, .deps, etc  :)
Title: Re: How to build -dev extensions?
Post by: flyingfishfinger on February 10, 2016, 12:16:28 AM
Alright, I got them built, but the calling program still says it can't find them. The headers are definitely in /usr/local/include/___/, and I"m assuming that's a standard include path. So how can I check where the caller is looking and why it can't find them? :(
(The caller is qemu's ./configure with the --spice option)

Quote
ERROR: User requested feature spice
       configure was not able to find it.
       Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel

The relevant section of configure is:
Quote
if test "$spice" != "no" ; then
  cat > $TMPC << EOF
#include <spice.h>
int main(void) { spice_server_new(); return 0; }
EOF
  spice_cflags=$($pkg_config --cflags spice-protocol spice-server 2>/dev/null)
  spice_libs=$($pkg_config --libs spice-protocol spice-server 2>/dev/null)
  if $pkg_config --atleast-version=0.12.0 spice-server && \
     $pkg_config --atleast-version=0.12.3 spice-protocol && \
     compile_prog "$spice_cflags" "$spice_libs" ; then
    spice="yes"
    libs_softmmu="$libs_softmmu $spice_libs"
    QEMU_CFLAGS="$QEMU_CFLAGS $spice_cflags"
    spice_protocol_version=$($pkg_config --modversion spice-protocol)
    spice_server_version=$($pkg_config --modversion spice-server)
  else
    if test "$spice" = "yes" ; then
      feature_not_found "spice" \
          "Install spice-server(>=0.12.0) and spice-protocol(>=0.12.3) devel"
    fi
    spice="no"
  fi
fi

R
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 12:27:15 AM
It's looking for the pkg-config files - /usr/local/lib/pkgconfig/*.pc - did you include these in your *-dev extension?

From the output below, the files would be named spice-server.pc and spice-protocol.pc
Title: Re: How to build -dev extensions?
Post by: flyingfishfinger on February 10, 2016, 12:41:20 AM
Yes. Although it looks like spice-protocol.pc ended up in /usr/local/share/pkgconfig. I moved it to /lib/pkgconfig; they're both there now but I get the same error.

R
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 12:57:40 AM
The pkg-config extension will search both /usr/local/lib/pkgconfig and /usr/local/share/pkgconfig by default.

What do you get from this:
Code: [Select]
$ pkg-config --modversion /usr/local/lib/pkgconfig/spice-protocol.pc
$ pkg-config --modversion /usr/local/lib/pkgconfig/spice-server.pc

Edit: corrected commands above
Title: Re: How to build -dev extensions?
Post by: flyingfishfinger on February 10, 2016, 01:19:06 AM
Hm, their version numbering confuses me. According to the command, I have spice-protocol 0.12.11. According to their git, the latest tag is 0.12.10. I'll try checking out 0.12.9 instead and seeing what happens...

The server is fine at 0.13.0.something.

R
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 01:31:56 AM
If you look at config.log, it should show why the configure script doesn't like spice-protocol/spice-server
Title: Re: How to build -dev extensions?
Post by: flyingfishfinger on February 10, 2016, 01:46:28 AM
Quote
In file included from /usr/local/include/spice-server/spice.h:24:0,
                 from config-temp/qemu-conf.c:1:
/usr/local/include/spice-server/spice-core.h:27:27: fatal error: spice/qxl_dev.h: No such file or directory
 #include <spice/qxl_dev.h>
                           ^
compilation terminated.

That file exists in /usr/local/include/spice-protocol/spice/ though..

R
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 02:04:21 AM
If /usr/local/include/spice exists, symlink that file into it.

If /usr/local/include/spice doesn't exist, symlink the folder /usr/local/include/spice-protocol/spice to /usr/local/include/spice
Title: Re: How to build -dev extensions?
Post by: flyingfishfinger on February 10, 2016, 02:13:45 AM
Had a wrong directory in the extension. Fixed it, still breaks at the same place though.
Now we are here:

Quote
/usr/local/bin/ld: cannot find -lspice-server
collect2: error: ld returned 1 exit status
[/s]

IT BUILT! ....I didn't install the non-dev extension properly.

Ugh, I've got a bunch of dangling extensions with different names (how do you unload an extension properly if I updated it).

Thank you. I now know how to make -dev extensions as well as a lot of things I didn't want to know. I'll carry on in the qemu thread.

R
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 02:20:25 AM
either /usr/local/lib/spice-server.so is not present or you need to issue the command "sudo ldconfig".
Title: Re: How to build -dev extensions?
Post by: Juanito on February 10, 2016, 02:26:03 AM
how do you unload an extension properly if I updated it

You can't unload an extension, but you can overwrite it with something different - note that in most cases "sudo make install" will overwrite an existing loaded extension.

Note also, that if you place your updated extension in, for example, /mnt/sdb1/tce/optional/upgrade, it will replace your existing extension on the next reboot.