Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[XForms] Why does gcc not find the forms library?

4 views
Skip to first unread message

Peter Rowat

unread,
Oct 12, 2015, 3:32:51 PM10/12/15
to xforms-de...@nongnu.org
On OS X, I’ve installed XForms and compiled the demos and they all work.
But trying to compile the simplest program directly, e.g.

gcc -o pshme pshme.c -lforms

fails with "ld: library not found for -lforms”
Same happens if I tell gcc where to look:

gcc -o pshme pshme.c -L/….../xforms-1.2.4/lib -lforms

ls lib/*forms*
lib/forms.c lib/forms.lo lib/forms.o lib/libforms.la lib/xforms.5 lib/xforms.man

No doubt it is something very trivial, but I’ve spent a long time trying to fix this.

Peter R

Bill Unruh

unread,
Oct 12, 2015, 4:21:19 PM10/12/15
to Development with and of XForms


William G. Unruh | Canadian Institute for| Tel: +1(604)822-3273
Physics&Astronomy | Advanced Research | Fax: +1(604)822-5324
UBC, Vancouver,BC | Program in Cosmology | un...@physics.ubc.ca
Canada V6T 1Z1 | and Gravity | www.theory.physics.ubc.ca/

On Mon, 12 Oct 2015, Peter Rowat wrote:

> On OS X, I’ve installed XForms and compiled the demos and they all work. But trying to compile the
> simplest program directly, e.g.
>
> gcc -o pshme pshme.c -lforms 
>
> fails with "ld: library not found for -lforms”
> Same happens if I tell gcc where to look:
>
> gcc -o pshme pshme.c -L/….../xforms-1.2.4/lib -lforms

Where IS your forms library. It is certainly not what -L says above.
Try putting in the full path name instead of a relative path name.

the library is called libforms.so and that is what the -lforms looks for.
Where is your libforms.so ?

>
> ls lib/*forms*
> lib/forms.c lib/forms.lo lib/forms.o lib/libforms.la lib/xforms.5 lib/xforms.man

Nope none of those.
Maybe you do not have the libforms library istalled?

Jens Thoms Toerring

unread,
Oct 12, 2015, 4:30:29 PM10/12/15
to Development with and of XForms, Peter Rowat
Hi Peter,

On Mon, Oct 12, 2015 at 12:32:35PM -0700, Peter Rowat wrote:
> On OS X, I’ve installed XForms and compiled the demos and they all work.
> But trying to compile the simplest program directly, e.g.
>
> gcc -o pshme pshme.c -lforms

> fails with "ld: library not found for -lforms”

Did you install it (i.e. did you run "make install")? And if you
did, did it get installed in a path the linker checks for per
default? The default for the installation is '/usr/local/lib'.
And even then you may have to make the runtime linker aware of
newly installed libraries.

I have no experience with OS X, but on Linux you need to run
'ldconfig' (as root) before it gets found after installing it
for the very first time. And the runtime linker can be made
to include '/usr/local/lib' into the default search path by
editing /etc/ld.so.conf' or, on newer systems, creating a file
with in 'etc/ld.so.conf.d'. Perhaps it's handled in a similar
way under OS X?

> Same happens if I tell gcc where to look:
>
> gcc -o pshme pshme.c -L/….../xforms-1.2.4/lib -lforms
>
> ls lib/*forms*
> lib/forms.c lib/forms.lo lib/forms.o lib/libforms.la lib/xforms.5 lib/xforms.man

The finished library is in 'lib/.lib', not in the 'lib'
directory itself. So it should work with

> gcc -o pshme pshme.c -L/….../xforms-1.2.4/lib/.lib -lforms

Best regards, Jens
--
\ Jens Thoms Toerring ________ j...@toerring.de
\_______________________________ http://toerring.de

jon

unread,
Oct 12, 2015, 4:34:27 PM10/12/15
to Development with and of XForms
It has been a year since I did this last but I seem to recall MacosX
doing some odd stuff. Digging into some old projects I see things like
this:
gcc -O3 -I/usr/local/include -I/opt/X11/include -L/usr/local/lib -l forms mycode.c


If the above does not help then you may need to dig through BSDisms like
this, good luck!
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/update_dyld_shared_cache.1.html


Cheers,
Jon







jon

unread,
Oct 12, 2015, 4:46:32 PM10/12/15
to Development with and of XForms
On Mon, 2015-10-12 at 12:32 -0700, Peter Rowat wrote:
> On OS X, I’ve installed XForms and compiled the demos and they all
> work.
> But trying to compile the simplest program directly, e.g.
>
>
> gcc -o pshme pshme.c -lforms
>
>
> fails with "ld: library not found for -lforms”
> Same happens if I tell gcc where to look:
>
>
> gcc -o pshme pshme.c -L/….../xforms-1.2.4/lib -lforms
PS I seem to remember a quirk with real GCC where -L must be absolute, I
am not sure if this is still true but it was at one point.

I have some bash scripts with code like this:

P=`pwd'/lib/mylib
gcc blabla -L$P





Peter Rowat

unread,
Oct 12, 2015, 7:15:50 PM10/12/15
to Development with and of XForms
Thank you all for your suggestions. I had already used the -I option to locate header files, and I used absolute not relative path for -L. I will try them out tomorrow, as I had minor fall off my bike on way home for lunch! (May have injured shoulder). The guide states that the Xpm library is named libforms??
Best,

Peter R

Jens Thoms Toerring

unread,
Oct 13, 2015, 5:12:21 AM10/13/15
to Development with and of XForms
Hi Peter,

On Mon, Oct 12, 2015 at 04:15:31PM -0700, Peter Rowat wrote:

> Thank you all for your suggestions. I had already used the -I option to
> locate header files, and I used absolute not relative path for -L. I will
> try them out tomorrow, as I had minor fall off my bike on way home for
> lunch! (May have injured shoulder). The guide states that the Xpm library is
> named libforms??

Which guide states that where? If some XForms related documentation
claims that it's definitely a bug I would like to get rid off!

Hope you shoulder is ok, Jens

Denniston, Todd A CIV NAVSURFWARCENDIV Crane

unread,
Oct 15, 2015, 2:22:00 PM10/15/15
to Development with and of XForms
Which version of OS X has the OP been using?
Was the xforms lib installed before or after the last OS upgrade?

I have been reading in some other mailing lists[2] that some features of the new System Integrity Protection [1] (AKA rootless) has been causing issues with packages that want to install links in / or /usr, also there is an issue with boost [3] that might be similar.
Food for thought? Places to ask what their related solutions were?

[1] https://en.wikipedia.org/wiki/OS_X_El_Capitan#System_Integrity_Protection

[2] http://article.gmane.org/gmane.comp.tex.macosx/47074
http://sourceforge.net/p/gimp-print/mailman/message/34523439/
http://sourceforge.net/p/gimp-print/mailman/message/34515229/
http://sourceforge.net/p/gimp-print/mailman/message/34520522/

[3] http://stackoverflow.com/questions/32898887/boost-no-longer-works-with-homebrew-on-mac-el-capitan

Even when this disclaimer is not here:
I am not a contracting officer. I do not have authority to make or modify the terms of any contract.


Peter Rowat

unread,
Oct 15, 2015, 3:28:11 PM10/15/15
to Development with and of XForms
The forms library is in /usr/local/lib.

I had wrongly assumed that since I was installing XForms in my own directory the forms library would be there too.
The object files (*.o) but not the library (forms.a) are in xforms-1.2.4/lib/.lib.

> On Oct 15, 2015, at 11:20 AM, Denniston, Todd A CIV NAVSURFWARCENDIV Crane <todd.de...@navy.mil> wrote:
>
>> -----Original Message-----
>> From: On Behalf Of Jens Thoms Toerring
>> Sent: Monday, October 12, 2015 4:30 PM
>> To: Development with and of XForms; Peter Rowat
>> Subject: Re: [XForms] Why does gcc not find the forms library?
>>
>> Hi Peter,
>>
>> On Mon, Oct 12, 2015 at 12:32:35PM -0700, Peter Rowat wrote:
>>> On OS X, I’ve installed XForms and compiled the demos and they all work.
>>> But trying to compile the simplest program directly, e.g.
>>>
>>> gcc -o pshme pshme.c -lforms
>>
>>> fails with "ld: library not found for -lforms”
>>
>> Did you install it (i.e. did you run "make install")? ** Yes** And if you
>> did, did it get installed in a path the linker checks for per
>> default? **No!** The default for the installation is '/usr/local/lib'.
>> And even then you may have to make the runtime linker aware of
>> newly installed libraries.
>>
>> I have no experience with OS X, but on Linux you need to run
>> 'ldconfig' (as root) before it gets found after installing it
>> for the very first time. And the runtime linker can be made
>> to include '/usr/local/lib' into the default search path by
>> editing /etc/ld.so.conf' or, on newer systems, creating a file
>> with in 'etc/ld.so.conf.d'. Perhaps it's handled in a similar
>> way under OS X?
>>
>>> Same happens if I tell gcc where to look:
>>>
>>> gcc -o pshme pshme.c -L/….../xforms-1.2.4/lib -lforms
>>>
>>> ls lib/*forms*
>>> lib/forms.c lib/forms.lo lib/forms.o lib/libforms.la lib/xforms.5 lib/xforms.man
>>
>> The finished library is in 'lib/.lib', not in the 'lib'
>> directory itself. So it should work with
>>
>>> gcc -o pshme pshme.c -L/….../xforms-1.2.4/lib/.lib -lforms
>>
>
> Which version of OS X has the OP been using? **10.11**
> Was the xforms lib installed before or after the last OS upgrade? **After**
>
> I have been reading in some other mailing lists[2] that some features of the new System Integrity Protection [1] (AKA rootless) has been causing issues with packages that want to install links in / or /usr, also there is an issue with boost [3] that might be similar.
> Food for thought? Places to ask what their related solutions were?
>
> [1] https://en.wikipedia.org/wiki/OS_X_El_Capitan#System_Integrity_Protection <https://en.wikipedia.org/wiki/OS_X_El_Capitan#System_Integrity_Protection>
>
> [2] http://article.gmane.org/gmane.comp.tex.macosx/47074 <http://article.gmane.org/gmane.comp.tex.macosx/47074>
> http://sourceforge.net/p/gimp-print/mailman/message/34523439/ <http://sourceforge.net/p/gimp-print/mailman/message/34523439/>
> http://sourceforge.net/p/gimp-print/mailman/message/34515229/ <http://sourceforge.net/p/gimp-print/mailman/message/34515229/>
> http://sourceforge.net/p/gimp-print/mailman/message/34520522/ <http://sourceforge.net/p/gimp-print/mailman/message/34520522/>
>
> [3] http://stackoverflow.com/questions/32898887/boost-no-longer-works-with-homebrew-on-mac-el-capitan <http://stackoverflow.com/questions/32898887/boost-no-longer-works-with-homebrew-on-mac-el-capitan>

Peter Rowat

unread,
Oct 15, 2015, 4:07:52 PM10/15/15
to j...@toerring.de, Development with and of XForms

> On Oct 13, 2015, at 2:11 AM, Jens Thoms Toerring <j...@toerring.de> wrote:
>
> Hi Peter,
>
> On Mon, Oct 12, 2015 at 04:15:31PM -0700, Peter Rowat wrote:
>
>> Thank you all for your suggestions. I had already used the -I option to
>> locate header files, and I used absolute not relative path for -L. I will
>> try them out tomorrow, as I had minor fall off my bike on way home for
>> lunch! (May have injured shoulder). The guide states that the Xpm library is
>> named libforms??
>
> Which guide states that where? If some XForms related documentation
> claims that it's definitely a bug I would like to get rid off!

My error. No XForms guide states that. (Some closely related site that I looked at on Monday morning (before falling off my bike!) made that statement and the difficulties it caused in connection with a different system.)
>
> Hope you shoulder is ok, Jens
It’s healing, slowly. Thank you, and thank you for the wonderful world of Forms.
> --
> \ Jens Thoms Toerring ________ j...@toerring.de
> \_______________________________ http://toerring.de
>

Peter Rowat
pro...@ucsd.edu



Denniston, Todd A CIV NAVSURFWARCENDIV Crane

unread,
Oct 15, 2015, 5:04:29 PM10/15/15
to Development with and of XForms
> -----Original Message-----
> From: On Behalf Of Peter Rowat
> Sent: Thursday, October 15, 2015 3:27 PM
> To: Development with and of XForms
> Subject: Re: [XForms] Why does gcc not find the forms library?
>
> The forms library is in /usr/local/lib.
>
> I had wrongly assumed that since I was installing XForms in my own directory the forms library would be there too.
> The object files (*.o) but not the library (forms.a) are in xforms-1.2.4/lib/.lib.
>
>

Thanks for clarifying.
0 new messages