Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed unnecessary inclusion of iostream in several files #4707

Merged
merged 1 commit into from Jun 10, 2015

Conversation

stiopaa1
Copy link
Contributor

Signed-off-by: Michal Jarzabek stiopa@gmail.com

@ghost
Copy link

ghost commented May 17, 2015

CXXLD    ceph_test_rados_striper_api_striping
/usr/bin/ld: ./.libs/libcommon.a(Crypto.o): undefined reference to symbol 'PK11_GetBestSlot@@NSS_3.2'
/usr/bin/ld: note: 'PK11_GetBestSlot@@NSS_3.2' is defined in DSO /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libnss3.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libnss3.so: could not read symbols: Invalid operation

You should be able to reproduce this error on CentOS 7. If you have docker you can setup an environment with:

cd src ; test/docker-test.sh --os-type centos --os-version 7 --shell

@ghost ghost added cleanup core labels May 17, 2015
@stiopaa1
Copy link
Contributor Author

@dachary

cd src ; test/docker-test.sh --os-type centos --os-version 7 --shell

This still seem to build fine on my machine (assuming that I've done it correctly).

@ghost
Copy link

ghost commented May 17, 2015

@stiopaa1 would you mind doing git commit --amend (just for the purpose of changing the hash of your last commit) followed by a git push --force (just for the sake of running the bot again). If the bot shows the exact same error, it will be helpful if you can upload the output of your run.

Just to avoid any misunderstanding, when you run cd src ; test/docker-test.sh --os-type centos --os-version 7 --shell it just gives you a shell on a centos machine, with your latest commit, in the ceph tree. From there it's up to you to ./run-make-check.sh. Is it what you did ?

@stiopaa1
Copy link
Contributor Author

@dachary after running cd src ; test/docker-test.sh --os-type centos --os-version 7 --shell, I did(in ceph-centos-7-stiopa directory):
./autogen.sh
./configure
make -j 8
make check

I'll give it another go with ./run-make-check.sh

@ghost
Copy link

ghost commented May 17, 2015

@stiopaa1 the ./run-make-check.sh script is run by the bot and does not use the same compilation flag. It's likely you will run into the same problem.

@ghost
Copy link

ghost commented May 17, 2015

http://jenkins.ceph.dachary.org/job/ceph/LABELS=centos-7&&x86_64/5292/console

  CXXLD    ceph_test_rados_api_c_read_operations
/usr/bin/ld: ./.libs/libcommon.a(Crypto.o): undefined reference to symbol 'PK11_GetBestSlot@@NSS_3.2'
/usr/bin/ld: note: 'PK11_GetBestSlot@@NSS_3.2' is defined in DSO /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libnss3.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libnss3.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

@stiopaa1
Copy link
Contributor Author

@dachary
so after running ./run-make-check.sh i'm getting:
configure: error: C compiler cannot create executables

here is the full log:
http://hastebin.com/qapojepuqu.coffee

@smithfarm
Copy link
Contributor

Just noticed in the pasted log:

    Installed /tmp/easy_install-uQ8jd5/linecache2-1.0.0/pbr-0.11.0-py2.7.egg
      File "build/bdist.linux-x86_64/egg/linecache2/tests/inspect_fodder2.py", line 102
        def keyworded(*arg1, arg2=1):
                                ^
    SyntaxError: invalid syntax

      File "/home/stiopa/development/cephStiopa/ceph-centos-7-stiopa/install-deps-python2.7/build/unittest2/linecache2-1.0.0-py2.7.egg/linecache2/tests/inspect_fodder2.py", line 102
        def keyworded(*arg1, arg2=1):
                                ^
    SyntaxError: invalid syntax

@ghost
Copy link

ghost commented May 17, 2015

http://hastebin.com/qapojepuqu.coffee

the config.log file should have more information about why it failed.

@stiopaa1
Copy link
Contributor Author

@dachary, thanks I managed to reproduce it locally - hopefully will work now:)

@ghost
Copy link

ghost commented May 20, 2015

@stiopaa1 that's great. It makes me worried there could problems with other compilation flags. What was the problem ?

@stiopaa1
Copy link
Contributor Author

@dachary

It makes me worried there could problems with other compilation flags

The flag that made it fail was --with-debug - without it the file(src/test/cls_rbd/test_cls_rbd.cc) causing the problem wasn't being compiled.

What was the problem ?

I think(!) that following happened:
The problem was being caused by moving the inline functions from buffer.h to buffer.cc.

The following line was causing the error:
/bin/bash ../libtool --tag=CXX --mode=link g++ -I/usr/include/nss -I/usr/include/nspr -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -rdynamic -ftemplate-depth-1024 -Wnon-virtual-dtor -Wno-invalid-offsetof -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -Wstrict-null-sentinel -I../src/gmock/include -I../src/gmock/include -I../src/gmock/gtest/include -I../src/gmock/gtest/include -g -O2 -Wl,--as-needed -latomic_ops -o ceph_test_cls_rbd test/cls_rbd/ceph_test_cls_rbd-test_cls_rbd.o librados.la libcls_rbd_client.la libcls_lock_client.la libcommon.la ../src/gmock/lib/libgmock_main.la ../src/gmock/lib/libgmock.la ../src/gmock/gtest/lib/libgtest.la -lpthread libradostest.la -lboost_system

Before the inline functions were moved to buffer.cc, the above didnt't require libcommon library and even though the library is listed it wasn't being linked against. When we move inline functions to buffer.cc(and remove inline) the libcommon is linked against, but is then missing libnss3 library(in Crypto.o), hence the error:

/usr/bin/ld: ./.libs/libcommon.a(Crypto.o): undefined reference to symbol 'PK11_GetBestSlot@@NSS_3.2'
/usr/bin/ld: note: 'PK11_GetBestSlot@@NSS_3.2' is defined in DSO /usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libnss3.so so try adding it to the linker command line
/usr/lib/gcc/x86_64-redhat-linux/4.8.3/../../../../lib64/libnss3.so: could not read symbols: Invalid operation
collect2: error: ld returned 1 exit status

@ghost
Copy link

ghost commented May 25, 2015

that makes sense. It also deserves explaining in the commit message. Also the main commit does not just remove unused iostream. It deserves a detailed explanation of why it is a good thing. Why moving functions from buffer.h to buffer.cc is beneficial ?

@ghost
Copy link

ghost commented May 25, 2015

And the two commits can be squashed together I think. Apart from the commit message the change looks great.

@ghost ghost self-assigned this May 25, 2015
@ghost
Copy link

ghost commented May 25, 2015

I think the most important thing to explain is why performances won't be negatively affected by having the functions not inline anymore.

@stiopaa1
Copy link
Contributor Author

@dachary
Hope that's enough:)

@ghost
Copy link

ghost commented May 25, 2015

@stiopaa1 buffer.cc being used extensively throughout the code base, there needs to be certainty that it won't affect performances. Can you make an extra effort to verify and explain ? I think you're right and it would probably not matter as much if it was not in such a central place.

@ghost
Copy link

ghost commented May 25, 2015

@stiopaa1 the rest of the explaining is good enough. I even think you should merge the two commits together because the first won't even link without the second.

@tchaikov tchaikov reopened this Jun 3, 2015
@gregsfortytwo
Copy link
Member

Okay, you can shepherd it if that's an issue. :)

@stiopaa1
Copy link
Contributor Author

stiopaa1 commented Jun 3, 2015

@stiopaa1 probably we can add $(CRYPTO_LIBS) and $(EXTRALIBS) instead of$(CEPH_GLOBAL). but i am also fine if you want to stick with the later, as you may already noticed, some other tests are also linking agaist it

@tchaikov I have replaced CEPH_GLOBAL with CRYPTO_LIBS and EXTRALIBS as suggested.

@stiopaa1 stiopaa1 force-pushed the IosFwdNew branch 3 times, most recently from a213f5e to 68c3ac2 Compare June 6, 2015 19:13
@tchaikov
Copy link
Contributor

tchaikov commented Jun 8, 2015

@stiopaa1 thank you Michal! i am pushing your changes to ceph.git/wip-4707. once it is confirmed by the builders, will merge it.

@tchaikov
Copy link
Contributor

tchaikov commented Jun 8, 2015

@stiopaa1 , the build failed at http://gitbuilder.sepia.ceph.com/gitbuilder-ceph-rpm-centos6-5-amd64-basic/log.cgi?log=68c3ac2bef13214263bf7b47567978e8ceb52249

CXX test/osd/Object.o
CXX test/osd/RadosModel.o
test/osd/Object.cc: In member function 'bool ObjectDesc::check(ceph::bufferlist&)':
error: test/osd/Object.cc:169: 'cout' is not a member of 'std'
error: test/osd/Object.cc:173: 'cout' is not a member of 'std'
error: test/osd/Object.cc:180: 'cout' is not a member of 'std'

Michal, could you also #include <iostream> in test/osd/Object.cc to fix this also? thanks =)

In several files the iostream wasn't being used, so it got removed.
In other files the iostream inclusion was replaced by including iosfwd
(for forward declarations), which is much smaller header than iostream,
  so in theory should reduce compilation time.
To make this work some of the functions must have been moved from .h to .cc file.
3 functions also needed to have inline removed - this shouldn't affect
performance in any way: two of them are
probably too long to have been inlined anyway and the third one is for
error reporting, so probably won't be called too often.

test/Makefile-client.am: added linker libs

This was required to avoid linker error when linking
src/test/cls_rbd/test_cls_rbd.cc file. Makefile was specyfing
libcommon.a as a part of a linker command even though this wasn't
required and wasn't being linked against. When inline functions from
buffer.h were moved to buffer.cc(and inline was removed) the
libcommon.a library became necessary. This wouldn't link without also
including additional libraries(CRYPTO_LIBS and EXTRA_LIBS)

Signed-off-by: Michal Jarzabek <stiopa@gmail.com>
@stiopaa1
Copy link
Contributor Author

stiopaa1 commented Jun 9, 2015

@tchaikov
I've included iostream in Object.cc

Any idea why the build first failed and then succeeded?

@ghost
Copy link

ghost commented Jun 9, 2015

@tchaikov @stiopaa1 you can ignore #4707 (comment) this is a false negative

tchaikov added a commit that referenced this pull request Jun 10, 2015
Removed unnecessary inclusion of iostream in several files

Reviewed-by: Kefu Chai <kchai@redhat.com>
@tchaikov tchaikov merged commit 5a5dc5f into ceph:master Jun 10, 2015
vuhuong pushed a commit to vuhuong/ceph-upstream that referenced this pull request Jun 12, 2015
fix xio to work with the merge of pull request
" Removed unnecessary inclusion of iostream in several files ceph#4707"

Signed-off-by: Vu Pham <vu@mellanox.com>
@vuhuong vuhuong mentioned this pull request Jun 23, 2015
tchaikov pushed a commit that referenced this pull request Jun 24, 2015
fix xio to work with the merge of pull request
" Removed unnecessary inclusion of iostream in several files #4707"

Signed-off-by: Vu Pham <vu@mellanox.com>
cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request Jun 26, 2015
fix xio to work with the merge of pull request
" Removed unnecessary inclusion of iostream in several files ceph#4707"

Signed-off-by: Vu Pham <vu@mellanox.com>
@ghost ghost mentioned this pull request Jun 27, 2015
cxwshawn pushed a commit to cxwshawn/ceph that referenced this pull request Jul 4, 2015
fix xio to work with the merge of pull request
" Removed unnecessary inclusion of iostream in several files ceph#4707"

Signed-off-by: Vu Pham <vu@mellanox.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants