Re: "undefined reference" in .o files
Malcolm Perrior <[email protected]>
| Newsgroups | gmane.comp.lang.4gl.aubit.general |
|---|---|
| Message-ID | <A338ECC4DD46BC4B8B313F6AACEEC1E3020256F5@ukhqexchange1.Foresters.co.uk> |
Hmmm. This issue is cropping up in our libraries. The general setup is that we have several libraries, each consisting of several 4gl files, each library in its own path under a parent …/functions/ path; so for example we have functions/base_lib, functions/print_lib, functions/workflow_lib and so on. Each path has several 4gls in it and we compile these down to a single .a file in each function path; thus we have: <base_path>/functions/base_lib/base_lib.a <base_path>/functions/print_lib/print_lib.a <base_path>/functions/workflow_lib/workflow_lib.a … and so on. Most of these 4gl library source files don’t have their own globals files but there is a single project globals file in ../../globals.4gl which each separate library 4gl references at compile time (i.e. they mostly have “GLOBALS ../../globals.4gl” as their first line). We compile the libraries down to their own “.a” first and then for each project executable (which similarly reside in their own paths elsewhere) we compile its own 4gls and link in the library .a files What I’ve found is that each library 4gl that calls ../../globals.4gl has the unresolved call, where the odd few that don’t are ok… The ../../globals.4gl file is not compiled (we don’t do it on our current HP-UX system and it’s never caused a problem!) So, if I’ve got this right, the 4gls are individually compiling and are happy with the globals include line but I need to link in a ‘globals.o’ built from the ../../globals.4gl as well? (To confirm, I just did a 4glpc –c of this globals file and it does indeed have the correct hash number in the resultant .o). From: [email protected] [mailto:[email protected]] On Behalf Of Mike Aubury Sent: 03 February 2015 17:07 To: Malcolm Perrior Cc: [email protected] Subject: Re: [Aubit4gl-discuss] "undefined reference" in .o files Its normally because you're not linking in something you should be... Maybe you have an empty GLOBALS file which you have in the GLOBALS section - but isnt on being linked in ? The hex stuff is just a hash meant to check that the module and globals are in line - so there should be a "globals.4gl" (the bit before the hex - but after the init_global_variables) which defines the init_global_variables_globals_<hex>. If the globals.c has a "init_global_variables_globals_..." - but its different hex hash - then the "hashing" is different between the two - perhaps globals.4gl was compiled at a different time - and has had something change ? (The hashing is based on the variables defined) On 3 February 2015 at 16:54, Malcolm Perrior <[email protected]<mailto:[email protected]>> wrote: Well, testbedding of the Windows binary continues apace! How about this one: compilation of 4gl code seems to create a call to a function with a name of the format void init_global_variables_globals_<hex_number>(void) It places this line in the top of the .c compiled from the .4gl amongst the A4GL_FUNCTION definitions for the functions in the 4gl file, and calls it in the c function A4GL_INTERNAL_FUNCTION static void init_module_variables(void); there is a comment line immediately above it saying “/// Initialise any other global variables” So when we compile and link all our output object files together we get an error complaining about an undefined reference… The <hex number> seems arbitrary. Any clues on this one? (Sorry to continue being a pain. Oh and also apologies for the extended disclaimer in my company email, can’t fix that, sorry!) ********************************************************************** The information contained in this email is intended only for the individual or entity to whom it is addressed. It may contain privileged and confidential information and if you are not an intended recipient you must not copy, distribute or take any action in reliance on it. If you have received this email in error, please notify us immediately by telephone on (020) 8628 3456. Please also destroy and delete the message from your computer. Any opinions expressed in this message are those of the sender only and do not necessarily represent the views of Foresters. The sender may not be authorised to give financial advice and nothing in this message should be construed as offering such advice or entering into any contract on behalf of any Foresters Company. Forester Life Limited is authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and Prudential Regulation Authority. Forester Fund Management Limited is authorised and regulated by the Financial Conduct Authority. The Children’s Mutual is a trading name of Forester Fund Management Ltd. Companies within the Foresters UK Group are registered in England as follows: Forester Life Limited 2997655, Forester Fund Management Limited 4315370 and Forester Holdings (Europe) Limited 3013082. Registered Offices for all companies within the Foresters UK Group: Foresters House, 2 Cromwell Avenue, Bromley, BR2 9BF. T 020 8628 3400. F 020 8628 3500. E [email protected]<mailto:[email protected]> foresters.com<http://foresters.com> ********************************************************************** ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Aubit4gl-discuss mailing list [email protected]<mailto:[email protected]> https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss ________________________________________________________________________ This e-mail has been scanned for all viruses by Claranet. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.claranet.co.uk ________________________________________________________________________ ********************************************************************** The information contained in this email is intended only for the individual or entity to whom it is addressed. It may contain privileged and confidential information and if you are not an intended recipient you must not copy, distribute or take any action in reliance on it. If you have received this email in error, please notify us immediately by telephone on (020) 8628 3456. Please also destroy and delete the message from your computer. Any opinions expressed in this message are those of the sender only and do not necessarily represent the views of Foresters. The sender may not be authorised to give financial advice and nothing in this message should be construed as offering such advice or entering into any contract on behalf of any Foresters Company. Forester Life Limited is authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and Prudential Regulation Authority. Forester Fund Management Limited is authorised and regulated by the Financial Conduct Authority. The Children’s Mutual is a trading name of Forester Fund Management Ltd. Companies within the Foresters UK Group are registered in England as follows: Forester Life Limited 2997655, Forester Fund Management Limited 4315370 and Forester Holdings (Europe) Limited 3013082. Registered Offices for all companies within the Foresters UK Group: Foresters House, 2 Cromwell Avenue, Bromley, BR2 9BF. T 020 8628 3400. F 020 8628 3500. E [email protected] foresters.com ********************************************************************** ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Aubit4gl-discuss mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/aubit4gl-discuss