helpCOBOL For GCC - Support: sr #109186, GNU Cobol linking archive library

 
 

sr #109186: GNU Cobol linking archive library

Submitted by:  Paul Mitchell <pmitch1865>
Submitted on:  Tue 15 Nov 2016 12:00:24 PM UTC  
 
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenOperating System: GNU/Linux

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 13 Jan 2017 06:29:33 PM UTC, comment #4:

Here's a link to the board: https://sourceforge.net/p/open-cobol/discussion/.

Edward Hart <edwardhart>
Fri 13 Jan 2017 06:28:55 PM UTC, comment #3:

Hi Paul,

This is the support page for the defunct COBOL for GCC project, not the new GnuCOBOL. (I'll raise the name clash with Simon Sobisch.)

Regrettably, I don't know much about how GnuCOBOL links stuff so I can't help here. For prompt help, register an account on SourceForge and ask on the GnuCOBOL discussion board there.

Edward Hart <edwardhart>
Thu 17 Nov 2016 04:04:00 PM UTC, comment #2:

In order to further assist with this i have created a test scenario.

This issue appears to be that no matter what i do to link a dynamically loadable module held within an archive library will allow that module to be dynamically located.

I always end up with the following error.

libcob: cannot find module

i have uploaded two files, TEST_CALL.cob (executable module) and TEST_SUB.cob (loadable module).

If you follow the process below to compile and run under a Linux environment you should receive the same result. If however you extract the TEST_SUB.so file from the library and and link directly to the file it will work.

TEST_SUB eg
------------
cobc -foptional-file -freserved=COMMAND-LINE -std=mf -m TEST_SUB.cob
ar -qv /stage/pmtest/libpmtst.a ./TEST_SUB.so
export LD_LIBRARY_PATH=/stage/pmtest
export COB_LIBRARY_PATH=/stage/pmtest
rm ./TEST_SUB.so

TEST_CALL eg
------------
cobc -v -x -foptional-file -std=mf -freserved=COMMAND-LINE -o TEST_CALL TEST_CALL.cob -L /stage/pmtest -lpmtst

env |grep pmtest
COB_LIBRARY_PATH=/stage/pmtest
LD_LIBRARY_PATH=/stage/pmtest

./TEST_CALL
libcob: cannot find module 'TEST_SUB'

We need to be able to use an archive library due to its flexibility of control.

Paul Mitchell <pmitch1865>
Tue 15 Nov 2016 01:29:45 PM UTC, comment #1:

Additionally.

It should be noted that the object code testobj.o would have been compiled to .o level using GNU Cobol and inserted into the archive library using Linux ar.

Paul Mitchell <pmitch1865>
Tue 15 Nov 2016 12:00:24 PM UTC, original submission:

We have compiled many binary object files and placed them into an archive library.

We have also compiled an executable module and as part of that compilation have attempted to link the previously mentioned archive library.

However on execution the executable module is not able to find a required binary object file located in the archive library.

It would appear that the archive library library is not in fact linked to the executable.

Could you provide guidance on how this is achieved within GNU Cobol.

Example would be

executable = TESTPROG
ar library = testlib.a
bin object = testobj.o

TESTPROG needs to call testobj.o and therefore testlib.a needs to be linked to TESTPROG.

Thanks.

Paul.

Paul Mitchell <pmitch1865>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #39004:  TEST_CALL.cob added by pmitch1865 (546B - application/octet-stream - test files.)
file #39005:  TEST_SUB.cob added by pmitch1865 (408B - application/octet-stream - test files.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by edwardhart (Posted a comment)
  • -unavailable- added by pmitch1865 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 17 Nov 2016 04:05:10 PM UTCpmitch1865Attached File-=>Added TEST_CALL.cob, #39004
      Attached File-=>Added TEST_SUB.cob, #39005

    Back to the top


    Powered by Savane 3.1-cleanup1