Skip to content

Conversation

@eolivelli
Copy link
Contributor

Fix the pom of the zookeeeper-c-client in order to comply to the standard maven workflow:
Build without tests:
mvn clean install -DskipTests
Build and test
mvn clean install -DskipTests

More details here:
https://issues.apache.org/jira/browse/ZOOKEEPER-3436

Copy link
Contributor

@anmolnar anmolnar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 Flawless on Centos 7.

@phunt
Copy link
Contributor

phunt commented Jun 21, 2019

Fails for me with

mvn clean install -DskipTests -Pfull-build

"ant clean compile compile-native" works fine with the same codebase.

Here's the error I see with the mvn build attempt:

 [exec] libtool: link: gcc -dynamiclib  -o .libs/libzookeeper_st.2.dylib   -Wl,-force_load,./.libs/libzkst.a -Wl,-force_load,./.libs/libhashtable.a  -lm -lgcov  -fprofile-arcs -g -O2   -install_name  /Users/phunt/dev/zookeeper-trunk/zookeeper-client/zookeeper-client-c/target/c/lib/libzookeeper_st.2.dylib -compatibility_version 3 -current_version 3.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libzookeeper_st-symbols.expsym
 [exec] ld: library not found for -lgcov
 [exec] clang: error: linker command failed with exit code 1 (use -v to see invocation)
 [exec] make: *** [libzookeeper_st.la] Error 1

Copy link
Contributor

@phunt phunt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be failing with maven and not ant.

@eolivelli
Copy link
Contributor Author

It is failing for me as well in another env.
I guess it is releated to garbage files.
We have a lot of stuff in .gitignore

I am cleaning up

@eolivelli
Copy link
Contributor Author

eolivelli commented Jun 21, 2019

@phunt I solved my problem by cleaning up all stuff generated by previous build with ant (mostly like these ones, and all .so, .o....) :

        Makefile.in
	aclocal.m4
	autom4te.cache/
	compile
	config.guess
	config.h.in
	config.sub
	configure
	depcomp
	install-sh
	ltmain.sh
	missing

@eolivelli
Copy link
Contributor Author

I could add in a "clean" phase some sort of purge task that clean every artifact produced by "make" (with a static list)

@eolivelli
Copy link
Contributor Author

I have committed a more maven-friendly .gitignore for zookeeper-c-client directory

@phunt @anmolnar You should see the file to be deleted with "git status" as files produced by a direct execution of commands on the zookeeper-c-client directory

@eolivelli
Copy link
Contributor Author

C client tests passed on ASF Jenkins
https://builds.apache.org/job/PreCommit-ZOOKEEPER-github-pr-build-maven/845/org.apache.zookeeper$zookeeper-client-c/console

They run on my Fedora laptop as well

Copy link
Contributor

@nkalmar nkalmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 from my side, tested after git clean -fdx and ant clean, with multiple runs including
mvn clean install -DskipTests -Pfull-build

Ubuntu 16.04.6 LTS (Xenial Xerus)

Let's wait and see if the second commit solves for Patrick as well.

@anmolnar
Copy link
Contributor

anmolnar commented Jun 21, 2019

ant clean / mvn clean has never completely cleaned configure/make leftovers, I always had to git clean -fxd before testing (like Norbert did). So it's not a regression for me, however it'd nice to fix this too.

@eolivelli
Copy link
Contributor Author

@phunt shall we merge this patch as it is or would you prefer that I enhance the 'clean' task?

@eolivelli
Copy link
Contributor Author

@phunt ping

@eolivelli
Copy link
Contributor Author

@phunt can we merge this patch ?

cc @anmolnar @nkalmar

@anmolnar
Copy link
Contributor

anmolnar commented Aug 2, 2019

Cannot be merged until @phunt removes the -1.

@eolivelli
Copy link
Contributor Author

@phunt PTAL

@eolivelli
Copy link
Contributor Author

@phunt I see you are online, please take a look.

@eolivelli eolivelli changed the title Enhance Mavenized Make C client ZOOKEEPER-3436 Enhance Mavenized Make C client Sep 2, 2019
@phunt
Copy link
Contributor

phunt commented Sep 3, 2019

Afraid I'm still seeing the same issue with mvn while ant works fine, this is mvn:

 [exec] libtool: link: gcc -dynamiclib  -o .libs/libzookeeper_st.2.dylib   -Wl,-force_load,./.libs/libzkst.a -Wl,-force_load,./.libs/libhashtable.a  -lm -lgcov  -fprofile-arcs -g -O2   -install_name  /Users/phunt/dev/zookeeper-trunk/zookeeper-client/zookeeper-client-c/target/c/lib/libzookeeper_st.2.dylib -compatibility_version 3 -current_version 3.0 -Wl,-single_module -Wl,-exported_symbols_list,.libs/libzookeeper_st-symbols.expsym
 [exec] ld: library not found for -lgcov
 [exec] clang: error: linker command failed with exit code 1 (use -v to see invocation)
 [exec] make: *** [libzookeeper_st.la] Error 1

I did a "git clean -xdf" but that had/has no effect.

@eolivelli
Copy link
Contributor Author

Thank you @phunt for checking again.
I don't know it, but gcov is a code coverage library.
I will try to check for it in the ant script.

@nkalmar @symat I appreciate very much if you have cycles to help me, this C part is very far from my usual work.

@eolivelli eolivelli force-pushed the fix/ZOOKEEPER-3436-c-client branch from 29384f2 to 44f6ba5 Compare September 3, 2019 07:05
@symat
Copy link
Contributor

symat commented Sep 3, 2019

we found the problem with @nkalmar:

the gcov library is used only when the --enable-gcov parameter is passed to the configure call. This parameter was used in the ant file only for the target c_coverage_report but not during the normal test / build targets. Currently in maven it is hardcoded to be always passed to the configure script. And most probably the gcov library is not present on Patrick's machine.

(https://github.com/eolivelli/zookeeper/blob/44f6ba5d2530d3376e469524df0b946b77a69fcb/zookeeper-client/zookeeper-client-c/pom.xml#L74)

It would be nice to introduce an optional maven parameter and not using gcov by default. (It doesn't make much sense to measure test coverage all the time when we want to build the client).

<execution>
<id>configure</id>
<phase>test-compile</phase>
<phase>process-sources</phase>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where --enable-gcov is passed, the phase which this runs probably surfaced the problem for Patrick? If someone doesn't have the library it will always fail, with ant only if they run a c-coverege report.
Thanks @symat for finding this!

@nkalmar
Copy link
Contributor

nkalmar commented Sep 3, 2019

Sorry @eolivelli , this is my bad, during the migration I didn't pay attention gcov should only be passed if we run code-coverage.

(As I had the library installed it never failed for me)

@eolivelli
Copy link
Contributor Author

Can you pick up this branch?

@symat
Copy link
Contributor

symat commented Sep 3, 2019

Can you pick up this branch?

do you suggest to create a new Jira about adding a new maven parameter for --enable-gcov ?
I am happy to do that, and I think this PR could be merged then.

@eolivelli
Copy link
Contributor Author

@symat I think you can do it within this JIRA, it is about "Enhance the Maven build".
You can continue from this branch.
Feel free to open a new JIRA if you are able to split the two activities.
To me the important goal is that is is easy to work on the C client without ant.
The overall goal is to drop the ant based support and this problem is a real showstopper.

I will review your patch as soon as it is ready

Thanks

@symat
Copy link
Contributor

symat commented Sep 4, 2019

I created a new PR (#1078), please take a look.

@eolivelli
Copy link
Contributor Author

closing this one, thank you @symat

@eolivelli eolivelli closed this Sep 4, 2019
asfgit pushed a commit that referenced this pull request Oct 10, 2019
Based on eolivelli 's [previous pull request](#993) we enhanced now the maven C client build:

- we can compile now the C-client without tests (using the -DskipTests option)
- we can optionally enable the test coverage calculation for the C-client (-Pc-test-coverage)
- we also package the C-client into the binary tarball (when -Pfull-build is used)
- I also updated the README_packaging.md file to make user's life easier (happier? :) )

I tested the build on ubuntu 16.04.

Author: Mate Szalay-Beko <mszalay@cloudera.com>
Author: Enrico Olivelli <eolivelli@apache.org>

Reviewers: nkalmar@apache.org, eolivelli@apache.org, andor@apache.org

Closes #1078 from symat/ZOOKEEPER-3436 and squashes the following commits:

18250df [Mate Szalay-Beko] ZOOKEEPER-3436 remove the C binaries from the binary tarball; update the readme files
57b7cd6 [Mate Szalay-Beko] ZOOKEEPER-3436 fixing file permissions of usr/bin/* in binary tarball
a2ac025 [Mate Szalay-Beko] ZOOKEEPER-3436 enhance / format README_packaging.md
30eea5e [Mate Szalay-Beko] ZOOKEEPER-3436 exclude README_packaging.md from license check
936550e [Mate Szalay-Beko] ZOOKEEPER-3436 fixing README_packaging.md
f010295 [Mate Szalay-Beko] ZOOKEEPER-3436 Enhance Mavenized Make C client
44f6ba5 [Enrico Olivelli] Better .gitignore
2046037 [Enrico Olivelli] Enhance Mavenized Make C client
stickyhipp pushed a commit to stickyhipp/zookeeper that referenced this pull request Aug 19, 2020
Based on eolivelli 's [previous pull request](apache#993) we enhanced now the maven C client build:

- we can compile now the C-client without tests (using the -DskipTests option)
- we can optionally enable the test coverage calculation for the C-client (-Pc-test-coverage)
- we also package the C-client into the binary tarball (when -Pfull-build is used)
- I also updated the README_packaging.md file to make user's life easier (happier? :) )

I tested the build on ubuntu 16.04.

Author: Mate Szalay-Beko <mszalay@cloudera.com>
Author: Enrico Olivelli <eolivelli@apache.org>

Reviewers: nkalmar@apache.org, eolivelli@apache.org, andor@apache.org

Closes apache#1078 from symat/ZOOKEEPER-3436 and squashes the following commits:

18250df [Mate Szalay-Beko] ZOOKEEPER-3436 remove the C binaries from the binary tarball; update the readme files
57b7cd6 [Mate Szalay-Beko] ZOOKEEPER-3436 fixing file permissions of usr/bin/* in binary tarball
a2ac025 [Mate Szalay-Beko] ZOOKEEPER-3436 enhance / format README_packaging.md
30eea5e [Mate Szalay-Beko] ZOOKEEPER-3436 exclude README_packaging.md from license check
936550e [Mate Szalay-Beko] ZOOKEEPER-3436 fixing README_packaging.md
f010295 [Mate Szalay-Beko] ZOOKEEPER-3436 Enhance Mavenized Make C client
44f6ba5 [Enrico Olivelli] Better .gitignore
2046037 [Enrico Olivelli] Enhance Mavenized Make C client
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Aug 31, 2022
Based on eolivelli 's [previous pull request](apache#993) we enhanced now the maven C client build:

- we can compile now the C-client without tests (using the -DskipTests option)
- we can optionally enable the test coverage calculation for the C-client (-Pc-test-coverage)
- we also package the C-client into the binary tarball (when -Pfull-build is used)
- I also updated the README_packaging.md file to make user's life easier (happier? :) )

I tested the build on ubuntu 16.04.

Author: Mate Szalay-Beko <mszalay@cloudera.com>
Author: Enrico Olivelli <eolivelli@apache.org>

Reviewers: nkalmar@apache.org, eolivelli@apache.org, andor@apache.org

Closes apache#1078 from symat/ZOOKEEPER-3436 and squashes the following commits:

18250df [Mate Szalay-Beko] ZOOKEEPER-3436 remove the C binaries from the binary tarball; update the readme files
57b7cd6 [Mate Szalay-Beko] ZOOKEEPER-3436 fixing file permissions of usr/bin/* in binary tarball
a2ac025 [Mate Szalay-Beko] ZOOKEEPER-3436 enhance / format README_packaging.md
30eea5e [Mate Szalay-Beko] ZOOKEEPER-3436 exclude README_packaging.md from license check
936550e [Mate Szalay-Beko] ZOOKEEPER-3436 fixing README_packaging.md
f010295 [Mate Szalay-Beko] ZOOKEEPER-3436 Enhance Mavenized Make C client
44f6ba5 [Enrico Olivelli] Better .gitignore
2046037 [Enrico Olivelli] Enhance Mavenized Make C client
RokLenarcic pushed a commit to RokLenarcic/zookeeper that referenced this pull request Sep 3, 2022
Based on eolivelli 's [previous pull request](apache#993) we enhanced now the maven C client build:

- we can compile now the C-client without tests (using the -DskipTests option)
- we can optionally enable the test coverage calculation for the C-client (-Pc-test-coverage)
- we also package the C-client into the binary tarball (when -Pfull-build is used)
- I also updated the README_packaging.md file to make user's life easier (happier? :) )

I tested the build on ubuntu 16.04.

Author: Mate Szalay-Beko <mszalay@cloudera.com>
Author: Enrico Olivelli <eolivelli@apache.org>

Reviewers: nkalmar@apache.org, eolivelli@apache.org, andor@apache.org

Closes apache#1078 from symat/ZOOKEEPER-3436 and squashes the following commits:

18250df [Mate Szalay-Beko] ZOOKEEPER-3436 remove the C binaries from the binary tarball; update the readme files
57b7cd6 [Mate Szalay-Beko] ZOOKEEPER-3436 fixing file permissions of usr/bin/* in binary tarball
a2ac025 [Mate Szalay-Beko] ZOOKEEPER-3436 enhance / format README_packaging.md
30eea5e [Mate Szalay-Beko] ZOOKEEPER-3436 exclude README_packaging.md from license check
936550e [Mate Szalay-Beko] ZOOKEEPER-3436 fixing README_packaging.md
f010295 [Mate Szalay-Beko] ZOOKEEPER-3436 Enhance Mavenized Make C client
44f6ba5 [Enrico Olivelli] Better .gitignore
2046037 [Enrico Olivelli] Enhance Mavenized Make C client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants