Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 386377

Summary: Native launcher not built during first build
Product: [Eclipse Project] Equinox Reporter: Krzysztof Daniel <krzysztof.daniel>
Component: LauncherAssignee: Mat Booth <mat.booth>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: akurtakov, cdtbog, gheorghe, igor, krzysztof.daniel, mat.booth, Silenio_Quarti, thanh.ha
Version: unspecifiedFlags: thanh.ha: review+
Target Milestone: 4.9 M2   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/123178
https://git.eclipse.org/c/equinox/rt.equinox.framework.git/commit/?id=6276787184cca0e010e08f14e24d646ca184a1e6
Whiteboard:
Attachments:
Description Flags
No refactoring patch
none
mylyn/context/zip none

Description Krzysztof Daniel CLA 2012-08-01 06:38:49 EDT
I have been preparing Fedora CBI build, removed all *.so files (and bunch of other precompiled libs) and my build produced Eclipse installation without launcher libs. After some debugging, I have found out that launchers native build happens after launchers plugins build, because native launcher sources are located (and build) in a parent feature org.eclipse.equinox.executable.

I tried to find a way to build that properly during first run, but the best effect I got was circular dependency problem.

I think the best way would be to move the library folder from org.eclipse.equinox.executable to org.eclipse.equinox.launcher.
Comment 1 Krzysztof Daniel CLA 2012-08-03 04:12:28 EDT
Also, org.eclipse.equinox.executable is in bundles, not in features.
Comment 2 Krzysztof Daniel CLA 2012-08-28 02:56:24 EDT
In addition, to all that, it is necessary to adjust native launchers version in pom.xml after each change. Currently, in Fedora, I do it in a very ugly way:

sed -i -e "s/1407/1503/" rt.equinox.framework/launcher-binary-parent/pom.xml
sed -i -e "s/1500/1503/" rt.equinox.framework/bundles/org.eclipse.equinox.launcher.gtk.linux.${ARCH}/pom.xml
Comment 3 Krzysztof Daniel CLA 2013-07-23 10:33:17 EDT
Following my recent discussions on eclipse-dev, I'm moving this bug from cbi to where it should belong to (equinox launchers).

I'd like to find a good way to contribute it - majority of changes will be about moving existing code between bundles.
Comment 4 Krzysztof Daniel CLA 2013-07-23 13:33:45 EDT
Bogdan,

I'd like to work on this. It's a lot of moving (native parts need to be moved out of the feature) and a few script tweaks.

How would you see the cooperation here? I think attaching/reviewing patches for such a change will be a nightmare...
Comment 5 Krzysztof Daniel CLA 2013-07-30 12:15:36 EDT
Created attachment 233950 [details]
No refactoring patch

instead of refactoring and moving native bits out of the feature I've changed a place of build.xml invocation - now native libraries are built when a fragment is built, not as previously together with a feature.
Comment 6 Krzysztof Daniel CLA 2013-07-30 12:15:41 EDT
Created attachment 233951 [details]
mylyn/context/zip
Comment 7 Krzysztof Daniel CLA 2013-07-30 12:18:39 EDT
Thanh,
could you double-check my work?

The patch has absolutely no effect unless building native libraries - the build script is invoked from fragments, not from the feature (because feature is built last after all required plugins are build).
Comment 8 Thanh Ha CLA 2013-07-30 12:59:07 EDT
(In reply to comment #7)
> Thanh,
> could you double-check my work?
> 
> The patch has absolutely no effect unless building native libraries - the
> build script is invoked from fragments, not from the feature (because
> feature is built last after all required plugins are build).

Sure I'll take a look this afternoon.
Comment 9 Thanh Ha CLA 2013-07-30 14:33:56 EDT
I don't have access to a Windows box with capabilities to build source code unfortunately so I can't test that part.

However I just tested building Linux x86 and x86_64 and it appears to work. I can see it compiling things and the build succeeds.

I will try building on Mac soon.


Interestingly I thought I'd try building the Windows and Mac natives while still on Linux and found that the Windows ones fail with permission denied (can't run bat file) but the Mac one successfully builds despite compile error.


build_eclipse:
     [exec] cc: error: i386: No such file or directory
     [exec] cc: error: ppc: No such file or directory
     [exec] cc: error: unrecognized command line optionbuild x86 and ppc
     [exec] cc -O -s -mmacosx-version-min=10.3 -Wall -arch i386 -arch ppc -DMACOSX -DDEFAULT_OS="\"macosx\"" -DDEFAULT_OS_ARCH="\"x86\"" -DDEFAULT_WS="\"carbon\"" -I.. -I../motif -I/System/Library/Frameworks/JavaVM.framework/Headers -c eclipseMain.c -o eclipseMain.o
     [exec]  ‘-mmacosx-version-min=10.3’
     [exec] cc: error: unrecognized command line option ‘-arch’
     [exec] cc: error: unrecognized command line option ‘-arch’
     [exec] make: *** [eclipseMain.o] Error 1
     [exec] Result: 2
Comment 10 Thanh Ha CLA 2013-07-30 15:49:56 EDT
Actually I forgot to clear my ~/.m2/repository before running the build previously. I just ran it again with a cleaned repo and clean "~/.m2/repository" and ran into this error:


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (natives) on project org.eclipse.swt.gtk.linux.x86_64: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /buildroot/eclipse.platform.releng.aggregator/eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml:932: The following error occurred while executing this line:
[ERROR] /buildroot/eclipse.platform.releng.aggregator/eclipse.platform.swt/bundles/org.eclipse.swt/buildSWT.xml:1010: exec returned: 2
[ERROR] around Ant part ...<ant antfile="build.xml" target="build_libraries"/>... @ 4:54 in /buildroot/eclipse.platform.releng.aggregator/eclipse.platform.swt.binaries/bundles/org.eclipse.swt.gtk.linux.x86_64/target/antrun/build-main.xml
[ERROR] -> [Help 1]
Comment 11 Thanh Ha CLA 2013-07-30 18:11:56 EDT
(In reply to comment #10)
> Actually I forgot to clear my ~/.m2/repository before running the build
> previously. I just ran it again with a cleaned repo and clean
> "~/.m2/repository" and ran into this error:
> 

Looks like it's failing on org.eclipse.swt.gtk.linux.x86_64 and my build hasn't reached the point yet where the launchers are built.
Comment 12 Thanh Ha CLA 2013-07-30 18:17:50 EDT
(In reply to comment #11)
> (In reply to comment #10)
> > Actually I forgot to clear my ~/.m2/repository before running the build
> > previously. I just ran it again with a cleaned repo and clean
> > "~/.m2/repository" and ran into this error:
> > 
> 
> Looks like it's failing on org.eclipse.swt.gtk.linux.x86_64 and my build
> hasn't reached the point yet where the launchers are built.

Oh I remember this issue now. Have to remove make_xulrunner, make_mozilla and make_xpcominit from the build.xml in order to build natives because the patches to remove these were not accepted when we submitted the CBI patches.

I'm restarting my build now with the changes.
Comment 13 Thanh Ha CLA 2013-07-31 11:35:30 EDT
Sorry for the delay. I successfully built using these patches so I think the patches are ok. I can launch Eclipse that is produced as well.

Built on Mac OSX and Linux.



Unfortunately the targets in SWT for make_xulrunner, make_mozilla and make_xpcominit still get in the way of the build though so someone who didn't patch that won't be able to build.
Comment 14 Alexander Kurtakov CLA 2013-07-31 11:39:39 EDT
(In reply to comment #13)
> Sorry for the delay. I successfully built using these patches so I think the
> patches are ok. I can launch Eclipse that is produced as well.
> 
> Built on Mac OSX and Linux.
> 
> 
> 
> Unfortunately the targets in SWT for make_xulrunner, make_mozilla and
> make_xpcominit still get in the way of the build though so someone who
> didn't patch that won't be able to build.

I feel the problem too, but I don't see an easy way to fix it as neither whitelist nor blacklist approach can work as mozilla changes their api constantly and swt can build only with a limited number of versions and one doesn't know whether if it builds with x.y.z.1 it will build with x.y.z.2.
Comment 15 Krzysztof Daniel CLA 2013-07-31 11:46:04 EDT
(In reply to comment #13)
> I can launch Eclipse that is produced as well.

That's the most important sign :). I am afraid I did not emphasized it - but have you removed *.so before running the build?
Comment 16 Thanh Ha CLA 2013-07-31 11:48:45 EDT
(In reply to comment #15)
> (In reply to comment #13)
> > I can launch Eclipse that is produced as well.
> 
> That's the most important sign :). I am afraid I did not emphasized it - but
> have you removed *.so before running the build?

In which directory?

I ensured that the ones in for example: rt.equinox.framework/bundles/org.eclipse.equinox.launcher.gtk.linux.x86_64

were removed but should I have removed them from somewhere else in addition to the platform specific launcher bundles?
Comment 17 Krzysztof Daniel CLA 2013-07-31 12:09:42 EDT
(In reply to comment #16)
> (In reply to comment #15)
> > (In reply to comment #13)
> > > I can launch Eclipse that is produced as well.
> > 
> > That's the most important sign :). I am afraid I did not emphasized it - but
> > have you removed *.so before running the build?
> 
> In which directory?
> 
> I ensured that the ones in for example:
> rt.equinox.framework/bundles/org.eclipse.equinox.launcher.gtk.linux.x86_64
> 
> were removed but should I have removed them from somewhere else in addition
> to the platform specific launcher bundles?

That's enough, as I was concerned only about launchers :) Thanks!
Comment 18 Krzysztof Daniel CLA 2013-08-16 02:43:33 EDT
What's the status of it? Who should I ping to get this released?
Comment 19 Eclipse Genie CLA 2018-05-23 10:08:33 EDT
New Gerrit change created: https://git.eclipse.org/r/123178
Comment 20 Mat Booth CLA 2018-05-23 10:27:49 EDT
I am restarting the effort to get this problem fixed, since we still carry this patch in Fedora. Here's the latest iteration:

A quick summary of the problem I am trying to solve...

For downstream integrators like me who have to build everything from source there is an ordering problem.

Because the maven reactor orders the fragments *before* the feature, it means that the native parts are not built in time to be included in the fragments and the fragments are missing the *.so/*.dll files entirely.

For example, when I do this:

find ../rt.equinox.binaries/org.eclipse.equinox.executable/* -type f -delete
find ../rt.equinox.binaries/org.eclipse.equinox.launcher.* -name *.so -delete
mvn clean package -Pbuild-individual-bundles \
  -DskipTests -Dnative=gtk.linux.x86_64

Then the resulting gtk.linux.x86_64 fragment is missing the *.so file:

$ unzip -l bundles/org.eclipse.equinox.launcher.gtk.linux.x86_64/target/org.eclipse.equinox.launcher.gtk.linux.x86_64-1.1.700-SNAPSHOT.jar                                                                                                                                          
Archive:  bundles/org.eclipse.equinox.launcher.gtk.linux.x86_64/target/org.eclipse.equinox.launcher.gtk.linux.x86_64-1.1.700-SNAPSHOT.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
      780  05-23-2018 15:22   META-INF/MANIFEST.MF
        0  05-23-2018 15:22   META-INF/
      620  04-27-2018 16:09   launcher.gtk.linux.x86_64.properties
     1445  04-27-2018 16:09   about.html
---------                     -------
     2845                     4 files

With the patch applied that I submitted to gerrit in comment #19, the build now does the Right Thing™ and the fragment correctly contains the *.so file:

$ unzip -l bundles/org.eclipse.equinox.launcher.gtk.linux.x86_64/target/org.eclipse.equinox.launcher.gtk.linux.x86_64-1.1.700-SNAPSHOT.jar                                                                                                                                          
Archive:  bundles/org.eclipse.equinox.launcher.gtk.linux.x86_64/target/org.eclipse.equinox.launcher.gtk.linux.x86_64-1.1.700-SNAPSHOT.jar
  Length      Date    Time    Name
---------  ---------- -----   ----
      756  05-23-2018 15:25   META-INF/MANIFEST.MF
        0  05-23-2018 15:25   META-INF/
   204200  05-23-2018 15:25   eclipse_1705.so
      620  04-27-2018 16:09   launcher.gtk.linux.x86_64.properties
     1445  04-27-2018 16:09   about.html
---------                     -------
   207021                     5 files