how to create a shared library

View: New views
17 Messages — Rating Filter:   Alert me  

how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ok, so i am no noob but I am kinda having a tough time trying to create
a shared library. I am using Anjuta 2.26.0.0.

My goal is to create a nautilus extension which is a .so file. I was
trying code::Blocks, but I am somehow not liking its build and project
structure.

Since Anjuta uses a standard auto-tools kinda system, I am very
interested in having the best of both worlds.

I searched a lot on the net for this ... but I am not sure if there is a
  straightforward way to do it.

Also, in a  lot of places, there is a mention of a "Settings" menu. Why
do I not see it in my IDE?

- Bewildered


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sébastien Granjoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sunil,

Sunil Negi a écrit :
> I searched a lot on the net for this ... but I am not sure if there is a
>   straightforward way to do it.

I'm afraid that it could be improved. I think there is no project wizard
template for creating a shared library.

I think you have to write yourself a configure.ac and Makefile.am for
your shared library. Then Anjuta should be able to load it and you can
compile it, add/remove source and so on.

> Also, in a  lot of places, there is a mention of a "Settings" menu. Why
> do I not see it in my IDE?

It's possible that this was existing in the old version of Anjuta 1.2
which does not use auto tools and was looking more like other IDE.

Regards,

Sébastien

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sébastien Granjoux wrote:
> Hi Sunil,
>
> Sunil Negi a écrit :
> I'm afraid that it could be improved. I think there is no project wizard
> template for creating a shared library.
I can write one and send a patch. Is there any information on how to  do
that?

> I think you have to write yourself a configure.ac and Makefile.am for
> your shared library. Then Anjuta should be able to load it and you can
> compile it, add/remove source and so on.
The whole reason why I want to use Anjuta is to not to modify those
files :) I come from a world full of windows... So not really inclined
to work with the gnu tool chain.

> Regards,
>
> Sébastien
>


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sébastien Granjoux wrote:
 > Hi Sunil,
 >
 > Sunil Negi a écrit :
 > I'm afraid that it could be improved. I think there is no project wizard
 > template for creating a shared library.

I can write one and send a patch. Is there any information on how to  do
that?

 > I think you have to write yourself a configure.ac and Makefile.am for
 > your shared library. Then Anjuta should be able to load it and you can
 > compile it, add/remove source and so on.

The whole reason why I want to use Anjuta is to not to modify those
files :) I come from a world full of windows... So not really inclined
to work with the gnu tool chain.

 > Regards,
 >
 > Sébastien
 >



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Johannes Schmid-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

> I can write one and send a patch. Is there any information on how to  do
> that?
>

There is developer documentation available on anjuta.org and you can
attach patches to bugs in bugzilla.

>  > I think you have to write yourself a configure.ac and Makefile.am for
>  > your shared library. Then Anjuta should be able to load it and you can
>  > compile it, add/remove source and so on.

I have not tested, if it really works, but you can already add a "Shared
library" target when you choose "Add Target" in the Project menu (you
will have to create a default project though - and delete it's default
target which is an application). Afterwards you should be able to add
files to the shared library target as usual.

Regards,
Johannes


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

signature.asc (204 bytes) Download Attachment

Re: how to create a shared library

by Sébastien Granjoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sunil,

Sunil Negi a écrit :
> I can write one and send a patch. Is there any information on how to  do
> that?

Sure, here
http://library.gnome.org/devel/libanjuta/stable/project-wizard-format.html

So you have to write a xml file with .wiz extension that described every
property of your project and the needed files.

You have to write template for these files too and in particular
configure.ac and one or two Makefile.am.

You can look at other project templates installed is share/anjuta/project

> The whole reason why I want to use Anjuta is to not to modify those
> files :) I come from a world full of windows... So not really inclined
> to work with the gnu tool chain.

It's possible only if you stay in the limits of supported things, and
currently shared libraries are not included.

It's interesting to learn how is working the GNU tool chain but indeed
it takes some time. Anyway you can ask any question.

Regards,

Sébastien

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johannes Schmid wrote:

> Hi!
>
>> I can write one and send a patch. Is there any information on how to  do
>> that?
>>
>
> There is developer documentation available on anjuta.org and you can
> attach patches to bugs in bugzilla.
>
>>  > I think you have to write yourself a configure.ac and Makefile.am for
>>  > your shared library. Then Anjuta should be able to load it and you can
>>  > compile it, add/remove source and so on.
>
> I have not tested, if it really works, but you can already add a "Shared
> library" target when you choose "Add Target" in the Project menu (you
> will have to create a default project though - and delete it's default
> target which is an application). Afterwards you should be able to add
> files to the shared library target as usual.
>
> Regards,
> Johannes
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Anjuta-list mailing list
> Anjuta-list@...
> https://lists.sourceforge.net/lists/listinfo/anjuta-list
Either I am missing something or there is  a bug but its not working for
  me. Besides, adding a library as a target does not work unless I give
the name libxxxx.la.
My library is supposed to be a .so file.

This is turning out to be far tougher then one would think it should be.
But I will continue with my wizard now.

thanks for your inputs.

Sunil


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Johannes Schmid wrote:
> Hi!
>

> I have not tested, if it really works, but you can already add a "Shared
> library" target when you choose "Add Target" in the Project menu (you
> will have to create a default project though - and delete it's default
> target which is an application). Afterwards you should be able to add
> files to the shared library target as usual.
>
> Regards,
> Johannes

Either I am missing something or there is  a bug but its not working for
  me. Besides, adding a library as a target does not work unless I give
the name libxxxx.la.
My library is supposed to be a .so file.

This is turning out to be far tougher then one would think it should be.
But I will continue with my wizard now.

thanks for your inputs.

Sunil


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sébastien Granjoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sunil,

Sunil Negi a écrit :
> Either I am missing something or there is  a bug but its not working for
>   me. Besides, adding a library as a target does not work unless I give
> the name libxxxx.la.
> My library is supposed to be a .so file.

I don't know exactly how it's working exactly. But libanjuta is a shared
library and is named libanjuta.la in the Makefile.am. So I think you can
(and probably should) use the .la extension even if it's a shared library.

In Makefile.am, shared libraries are defined with a variable name
dir_LTLIBRARIES while static libraries are defined using dir_LIBRARIES.

> This is turning out to be far tougher then one would think it should be.
> But I will continue with my wizard now.

I don't know exactly how it should be done. But I think you should be
able to do it, ask more questions if you need.

Regards,

Sébastien

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Sébastien Granjoux wrote:
> I don't know exactly how it's working exactly. But libanjuta is a shared
> library and is named libanjuta.la in the Makefile.am. So I think you can
> (and probably should) use the .la extension even if it's a shared library.
You are right. the extension .la is just a pseudo extension used by
libtools.


> In Makefile.am, shared libraries are defined with a variable name
> dir_LTLIBRARIES while static libraries are defined using dir_LIBRARIES.
Yup, I will check it out too... thanks for pointing it out.
>
> Regards,
>
> Sébastien
>
Regards,
Sunil


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Its frustrating to get this thing running .... For 9 days now, I have
not even touched the project that I had thought I could develop in anjuta.

I am still struggling to get a "HelloWorld.so" generated.

So what god-damned macro will get me rid of this error:

configure.ac:18: required file `./ltmain.sh' not found

Pardon my language, but I have never faced anything like this on windows
- so maybe my threshold of frustration is lower... Things just work in
visual studio..

And I am yet to even start on the project that I had started out to do...


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sébastien Granjoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sunil,

Sunil Negi a écrit :
> So what god-damned macro will get me rid of this error:
> configure.ac:18: required file `./ltmain.sh' not found

Apparently, this ltmain.sh is for libtool and is created by a program
named libtoolize. Your are supposed to run it from your autogen.sh or
just by running autoreconf.

Anjuta uses the gnome-autogen.sh (a common autogen script for GNOME
program), I think it is run from here.

> Pardon my language, but I have never faced anything like this on windows
> - so maybe my threshold of frustration is lower... Things just work in
> visual studio..

I think it's easier to start programming on Windows. Anjuta is trying to
fill this gap but it's not done yet and it's a bit more difficult
because we don't decide everything.

autotools is probably one of the biggest hurdle when starting a new
project. Then, when you know it, it's not so difficult to use.

> And I am yet to even start on the project that I had started out to do...

Regards,

Sébastien

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sébastien Granjoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sunil,

I have tried here to compile a small shared library. I have done a few
trials but it's working now.


1. The shared library project

1.1 Create a minimal anjuta project

1.2 In configure.ac, to enable libtool support, add the line
AM_PROG_LIBTOOL just after
   AC_ISC_POSIX
   AC_PROG_CC
   AM_PROG_CC_STDC
   AC_HEADER_STDC

1.3 In Makefile.am replace
   bin_PROGRAMS = foobar_sample by lib_LTLIBRARIES = libfoobar_sample.la
The prefix lib is standard and the right extension is .la, then
   foobar_sample_SOURCES = main.c by libfoobar_sample_la_SOURCES = main.c

That's all. The autogen.sh script created with the project already check
for AM_PROG_LIBTOOL in the configure.ac script and run libtoolize as needed.

So you just need to run autogen (to create ltmain.sh) then make && make
install.



2. The program using the shared library

I think you don't need this if you just want to create an extension for
nautilus, but I have done it to check that my shared library is working.

1.1 Create a minimal anjuta project

1.2 In configure.ac, you need to add libtool support if it's not done. I
have used an old project where it was not defined, so I have added the
line AM_PROG_LIBTOOL like in the first program.

1.3 In Makefile.am add the line
   foobar_sample_LDADD = -L/usr/local/lib -lfoobar_sample
You need to define both the library name (without the lib prefix) and
the directory where it can be found.


Regards,

Sébastien

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks for the detailed information Sebastien. I have actually already
tried the steps that you mentioned. They work IF the minimal project is
set to use shared library support.

As I had promised earlier, I have already written a wizard (its attached
to this mail). Its not really working though.

I have to fix it...

file:///home/sunil/clib.tar.gz


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

clib.tar.gz (9K) Download Attachment

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

ok ... I decided to set "Shared  library support" switched on by
default. So to whom should I send my new wizard?
I think a lot of people will benefit by it...

thanks,
Sunil


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sébastien Granjoux :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Sunil,

Sunil Negi a écrit :
> ok ... I decided to set "Shared  library support" switched on by
> default. So to whom should I send my new wizard?
> I think a lot of people will benefit by it...

You add a bug on bugzilla here
http://bugzilla.gnome.org/enter_bug.cgi?product=anjuta
and put your patch as attachment.

Or just send it to me and I will commit it.

Regards,

Sébastien

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list

Re: how to create a shared library

by Sunil Negi-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Thanks, I added the bug and the patch.


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Anjuta-list mailing list
Anjuta-list@...
https://lists.sourceforge.net/lists/listinfo/anjuta-list