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

CMakeLists.txt: boost_python.so requires libpython.*.so on FreeBSD #12763

Merged
merged 1 commit into from Jan 5, 2017

Conversation

Projects
None yet
2 participants
@wjwithagen
Contributor

wjwithagen commented Jan 3, 2017

  • Otherwise losts of unresolved errors will result.

Signed-off-by: Willem Jan Withagen wjw@digiware.nl

@tchaikov

This comment has been minimized.

Contributor

tchaikov commented Jan 3, 2017

@wjwithagen we have

set(BOOST_COMPONENTS
	thread system regex random program_options date_time iostreams)
if(WITH_MGR)
	list(APPEND BOOST_COMPONENTS python)
endif()

# require minimally the bundled version
find_package(Boost 1.61 COMPONENTS ${BOOST_COMPONENTS} REQUIRED)

in CMakeLists.txt, so if your FindBoost.cmake works as expected, it should be able to set the Boost_PYTHON_FOUND if boost-python is found, and it should fail if any component is missing.

so could you check your FindBoost.cmake again?

@tchaikov tchaikov added the build/ops label Jan 3, 2017

@wjwithagen

This comment has been minimized.

Contributor

wjwithagen commented Jan 4, 2017

@tchaikov
I'll test it.
I think I followed this part of the code, but started working on it in my WIP because I ended up with weird python bindings not being resolved in ceph-mon/osd/....
Doing my own python stuff here helped. :)
But perhaps that is why the WITH_MGR is (now) there.

@wjwithagen

This comment has been minimized.

Contributor

wjwithagen commented Jan 4, 2017

@tchaikov
Right, if I go back to the original code, I get:

[ 13%] Linking CXX executable ../bin/librados-config
cd /usr/srcs/Ceph/work/ceph/build/src && /usr/local/bin/cmake -E cmake_link_script CMakeFiles/librados-config.dir/link.txt --verbose=1
ccache /usr/bin/CC    -Wall -Wtype-limits -Wignored-qualifiers -Winit-self -Wpointer-arith -Werror=format-security -fno-strict-aliasing -fsigned-char -Wno-unused-function -Wno-unused-local-typedef -Wno-varargs -Wno-gnu-designator -Wno-missing-braces -Wno-parentheses -Wno-deprecated-register  -ftemplate-depth-1024 -Wno-invalid-offsetof -Wnon-virtual-dtor -Wno-inconsistent-missing-override -Wno-mismatched-tags -Wno-unused-private-field -fdiagnostics-color=auto -I/usr/local/include/nss/nss -I/usr/local/include/nspr -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -Wno-null-dereference -O0 -g  -Wl,-export-dynamic CMakeFiles/librados-config.dir/librados-config.cc.o  -o ../bin/librados-config  -L/usr/local/lib ../lib/librados.so.2.0.0 ../lib/libglobal.a ../lib/libcommon.a ../lib/libjson_spirit.a ../lib/libcommon_utf8.a ../lib/liberasure_code.a /usr/local/lib/libboost_thread.so /usr/local/lib/libboost_system.so /usr/local/lib/libboost_regex.so /usr/local/lib/libboost_random.so /usr/local/lib/libboost_program_options.so /usr/local/lib/libboost_date_time.so /usr/local/lib/libboost_iostreams.so /usr/local/lib/libboost_python.so /usr/local/lib/libboost_chrono.so /usr/local/lib/libboost_atomic.so -lexecinfo /usr/local/lib/nss/libssl3.so /usr/local/lib/nss/libsmime3.so /usr/local/lib/nss/libnss3.so /usr/local/lib/nss/libnssutil3.so /usr/local/lib/libplds4.so /usr/local/lib/libplc4.so /usr/local/lib/libnspr4.so -lpthread -lrt /usr/local/lib/libatomic_ops.a -Wl,-rpath,/usr/local/lib:/usr/srcs/Ceph/work/ceph/build/lib:/usr/local/lib/nss:
/usr/local/lib/libboost_python.so: undefined reference to `PySequence_GetSlice'
/usr/local/lib/libboost_python.so: undefined reference to `PyExc_ValueError'
/usr/local/lib/libboost_python.so: undefined reference to `PyString_Size'
/usr/local/lib/libboost_python.so: undefined reference to `PyBool_Type'
/usr/local/lib/libboost_python.so: undefined reference to `PyObject_GetAttr'
/usr/local/lib/libboost_python.so: undefined reference to `PyDict_GetItemString'
/usr/local/lib/libboost_python.so: undefined reference to `PyNumber_And'
/usr/local/lib/libboost_python.so: undefined reference to `PyExc_IndexError'
.....

Which is due to 'hard' linking with /usr/local/lib/libboost_python.so, and it will also need libpython to resolve that. (which is already done specially for MGR)
And that is again due to makeing it of the generic boost_includes., and it then ends up in ALL boost linksets.

Not sure how all the Boost libs get onto the cmdline for link librados-config.
Trying to figure that out, but I guess that they are bulk-added to one of the LINK_flags..

So that is why I take boot_python separate. But I see that I have not yet submitted that PR.
Now the question is: How do I sample python with find_package, without getting in the generic common BOOST_vars.

Other solution would be something like:
./CMakeLists.txt:480: LIST(APPEND Boost_LIBRARIES "-lz")
and always link with python. But then that is always lugged around, even if it is not needed.

@wjwithagen

This comment has been minimized.

Contributor

wjwithagen commented Jan 4, 2017

@tchaikov
It looks like
LIST(APPEND Boost_LIBRARIES ${PYTHON_LIBRARIES})
is going to fix it for FreeBSD/Clang.

@wjwithagen wjwithagen changed the title from src/CMakeLists.txt: On FreeBSD boost_python.so is not found by FindCmake to CMakeLists.txt/FreeBSD: boost_python.so requires libpython.*.so while linking Jan 4, 2017

@tchaikov tchaikov self-assigned this Jan 4, 2017

@@ -479,6 +479,11 @@ include_directories(SYSTEM ${PROJECT_BINARY_DIR}/include)
if (NOT WITH_SYSTEM_BOOST)
LIST(APPEND Boost_LIBRARIES "-lz")
else()

This comment has been minimized.

@tchaikov

tchaikov Jan 4, 2017

Contributor

could you adjust the if block a little bit so if looks like

if (WITH_SYSTEM_BOOST)
  if (FREEBSD)
    # if boost_python is used then also link with libpython*
    LIST(APPEND Boost_LIBRARIES ${PYTHON_LIBRARIES})
  endif()
else()
  LIST(APPEND Boost_LIBRARIES "-lz")
endif()

because the positive logic is easier to understand.

This comment has been minimized.

@wjwithagen

wjwithagen Jan 4, 2017

Contributor

@tchaikov
Sure.

As for your other remark: I guess boost libs are used quite a lot.
But the Python part of it, only in ceph-mgr I think, since I ran into it when enabling WITH_MGR.

@tchaikov

This comment has been minimized.

Contributor

tchaikov commented Jan 4, 2017

@wjwithagen thanks for exploring the alternative fixes. i think we are heading in the right direction. but before adding ${PYTHON_LIBRARIES} to Boost_LIBRARIES. i think we do not need to link libcommon against the wholesale of${Boost_LIBRARIES}. in another PR. i will try to extract the Boost_PYTHON_LIBRARIES out of it, and only link against it if when necessary.

@tchaikov

This comment has been minimized.

Contributor

tchaikov commented Jan 4, 2017

@wjwithagen could you squash these two commits into a single one?

CMakeLists.txt/FreeBSD: Boost_python needs explicit linking with libp…
…ython*.so

 - Otherwise losts of unresolved errors will result.

Signed-off-by: Willem Jan Withagen <wjw@digiware.nl>
@wjwithagen

This comment has been minimized.

Contributor

wjwithagen commented Jan 4, 2017

@tchaikov
I thought I already had squashed ....
But now it is!

@tchaikov tchaikov changed the title from CMakeLists.txt/FreeBSD: boost_python.so requires libpython.*.so while linking to CMakeLists.txt: boost_python.so requires libpython.*.so on FreeBSD Jan 5, 2017

@tchaikov tchaikov merged commit d58dcba into ceph:master Jan 5, 2017

3 checks passed

Signed-off-by all commits in this PR are signed
Details
Unmodifed Submodules submodules for project are unmodified
Details
default Build finished.
Details

@wjwithagen wjwithagen deleted the wjwithagen:wip-wjw-freebsd-boostpython branch Apr 28, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment