Bug #661

Fix 'all shared' build on Posix

Added by Massimo Del Fedele over 10 years ago. Updated over 10 years ago.

Status:ApprovedStart date:01/22/2014
Priority:NormalDue date:
Assignee:Massimo Del Fedele% Done:

100%

Category:IDESpent time:-
Target version:-

Description

Actually, using all shared build (SO flag on main package) on linux has following caveats:

- generated .so names don't have the 'lib' prefix, which should be there
- generated .so files hard-encode their path. Thay can't be moved
- generated .so files don't have the posix version naming schema.
- generated .so files don't define a 'soname'
- symbolic links should be generated along library file

So, a generated 'Package_SubPackage.so' file should be named 'libPackage_SubPackage.so.1.2.3', have the
'soname' internally defined as 'libPackage_SubPackage.so.1', and there should be 2 symbolic links named
'libPackage_SubPackage.so' and 'libPackage_SubPackage.so.1' pointing to the shared object.
The object should also be moveable inside filesystem.

I'm almost ready with a patch that fixes all that problems.
Mirek, do you agree if I finish and post to svn ?

History

#1 Updated by Miroslav Fidler over 10 years ago

  • Status changed from New to In Progress
  • Assignee changed from Miroslav Fidler to Massimo Del Fedele

Proposed changes are correct, please go on fixing it (post a patch here and switch the task to me as Patch Ready afterwards please).

#2 Updated by Massimo Del Fedele over 10 years ago

  • Status changed from In Progress to Ready for CR
  • Assignee changed from Massimo Del Fedele to Miroslav Fidler
  • % Done changed from 0 to 100

#3 Updated by Miroslav Fidler over 10 years ago

  • Status changed from Ready for CR to Ready for QA
  • Assignee changed from Miroslav Fidler to Massimo Del Fedele

Not sure how have you tested, but it was impossible to build any U++ project (mostly because of problems in legacy U++ code).

Fixed: now I am able to build theide in SO mode.

However, there is one problem: support for .icpp stays weird, as those have to be linked as .o files, outside .so....

#4 Updated by Massimo Del Fedele over 10 years ago

  • Status changed from Ready for QA to In Progress
  • Assignee changed from Massimo Del Fedele to Miroslav Fidler

Tested with UWord, it works BUT it requires manual build of all packages in correct order, otherwise it gives error on linking.
I've no idea on how to correct this, as I don't know the exact mechanics or your builders.
I think that your build system first compile stuffs in random order and then links the whole stuff. In .so mode a package using another one need its .so present in order to build, so the order is mandatory.

A little OT... I don't get notifications from Redmine. I double checked e-mail and settings, but still no emails.

#5 Updated by Miroslav Fidler over 10 years ago

  • Status changed from In Progress to Ready for QA
  • Assignee changed from Miroslav Fidler to Massimo Del Fedele

Massimo Del Fedele wrote:

Tested with UWord, it works BUT it requires manual build of all packages in correct order, otherwise it gives error on linking.
I've no idea on how to correct this, as I don't know the exact mechanics or your builders.
I think that your build system first compile stuffs in random order and then links the whole stuff. In .so mode a package using another one need its .so present in order to build, so the order is mandatory.

A little OT... I don't get notifications from Redmine. I double checked e-mail and settings, but still no emails.

As I said, I have fixed all that.. :)

Actually, the mechanism was always there, but there was stupid problem with unix/win slashes that lead to missidentification of packages during sorting the compilation order.

Another problem was that WHEN flag in uses was ignored, causing problems with plugin/z.

But all is fine now. Except that .icpp are linked as .o, but that is beyond this task IMO...

Please check, test and then, if all OK, approve the task.

#6 Updated by Massimo Del Fedele over 10 years ago

  • Status changed from Ready for QA to In Progress
  • Assignee changed from Massimo Del Fedele to Miroslav Fidler

Nope, it doesn't work; doing a "rebuild all" on UWord, the result is :

CtrlLib: 56 file(s) built in (0:00.67), 11 msecs / file, duration = 26996 msecs, parallelization 100%
Creating library...
g++: error: /home/massimo/sources/upp-svn/out/examples/GCC.Debug.Debug_Full.Gui.Noblitz.Shared.So/libCtrlCore.so.1.0: File o directory non esistente
g++: error: /home/massimo/sources/upp-svn/out/examples/GCC.Debug.Debug_Full.Gui.Noblitz.Shared.So/libPdfDraw.so.1.0: File o directory non esistente
g++: error: /home/massimo/sources/upp-svn/out/examples/GCC.Debug.Debug_Full.Gui.Noblitz.Shared.So/libDraw.so.1.0: File o directory non esistente
g++: error: /home/massimo/sources/upp-svn/out/examples/GCC.Debug.Debug_Full.Gui.Noblitz.Shared.So/libplugin_bmp.so.1.0: File o directory non esistente
g++: error: /home/massimo/sources/upp-svn/out/examples/GCC.Debug.Debug_Full.Gui.Noblitz.Shared.So/libRichText.so.1.0: File o directory non esistente
g++: error: /home/massimo/sources/upp-svn/out/examples/GCC.Debug.Debug_Full.Gui.Noblitz.Shared.So/libCore.so.1.0: File o directory non esistente
g++: error: /home/massimo/sources/upp-svn/out/examples/GCC.Debug.Debug_Full.Gui.Noblitz.Shared.So/libplugin_png.so.1.0: File o directory non esistente

I can build it, but I've got to select manually each package.
Maybe did you forget to upload latest changes ?

#7 Updated by Massimo Del Fedele over 10 years ago

I've seen that package order is selected by this code in Builder.cpp, line 422, on which I forced here the dependency-order :

/*
if(GetTargetMode().linkmode != 2) {
for(int i = 1; i < wspc.GetCount(); i++)
build_order.Add(i);
}
else {
*/
Index<int> remaining;
for(int i = 1; i < wspc.GetCount(); i++)
remaining.Add(i);
while(!remaining.IsEmpty()) {
int t;
for(t = 0; t < remaining.GetCount(); t++) {
const Package& pk = wspc.package[remaining[t]];
bool delay = false;
for(int u = 0; u < pk.uses.GetCount(); u++) {
if(remaining.Find(wspc.package.Find(UnixPath(pk.uses[u].text))) >= 0) {
delay = true;
break;
}
}
if(!delay)
break;
}
if(t >= remaining.GetCount()) // Progress even if circular references present
t = 0;
build_order.Add(remaining[t]);
remaining.Remove(t);
}
/*
}
*/

Doing so, it works, uncommenting the commented code it doesn't.
I suppose that GetTargetMode().linkmode should return 2 for SO build, but it returns 1, don't know why, I didn't dig too much inside code.
Anyways, I guess that forcing correct build order always (as commenting code above do...) has a quite small time footprint.

It's ok for you to apply this workaround, or do you prefere to fix the GetTargetMode().linkmode bad value ?

#8 Updated by Massimo Del Fedele over 10 years ago

just a small precisation : I'm using the SO flag in main package configuration, NOT the 'all shared' mode in builder.
Maybe the GetTargetMode().linkmode fetches just the builder mode and not the SO flag in main package.....

#9 Updated by Miroslav Fidler over 10 years ago

  • Status changed from In Progress to Ready for QA
  • Assignee changed from Miroslav Fidler to Massimo Del Fedele

Ah, yeah, that is it. Fixed

#10 Updated by Miroslav Fidler over 10 years ago

Can you check&close, please?

#11 Updated by Miroslav Fidler over 10 years ago

  • Status changed from Ready for QA to Approved

Also available in: Atom PDF