google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.32k stars 308 forks source link

error during 'make && make install' #193

Open omcwang opened 3 years ago

omcwang commented 3 years ago

hi, I want to work with s2 as python lib. OS: Centos7.9, python3.8.5 I ran: cd /opt git clone https://github.com/google/s2geometry.git cd s2geometry mkdir build && cd build cmake -DWITH_PYTHON=ON ..

all is ok, but when I ran 'make && make install', there is following error.

... [ 96%] Built target term_index Scanning dependencies of target point_index [ 97%] Building CXX object examples/CMakeFiles/point_index.dir/point_index.cc.o [ 98%] Linking CXX executable point_index [ 98%] Built target point_index Scanning dependencies of target pywraps2_swig_compilation [ 99%] Swig source /opt/s2geometry/src/s2/s2region.h:45: Warning 362: operator= ignored /opt/s2geometry/src/s2/s2region_term_indexer.h:226: Warning 325: Nested class not currently supported (Options ignored) /opt/s2geometry/src/s2/s2region_term_indexer.h:236: Error: Syntax error in input(3). make[2]: [python/CMakeFiles/_pywraps2.dir/s2PYTHON.stamp] Error 1 make[2]: Deleting file `python/CMakeFiles/_pywraps2.dir/s2PYTHON.stamp' make[1]: [python/CMakeFiles/pywraps2_swig_compilation.dir/all] Error 2 make: [all] Error 2

could you give some idea how to solve it?

jmr commented 3 years ago

That's https://github.com/google/s2geometry/blob/20ea540d81f4575a3fc0aea585aac611bcd03ede/src/s2/s2region_term_indexer.h#L236

What version of swig do you have? Maybe something old that doesn't understand = delete?

There should be a "Found SWIG" line in the output.

https://travis-ci.org/github/google/s2geometry/jobs/771984563#L319

It seems to work fine with 3.0.12.

https://travis-ci.org/github/google/s2geometry/jobs/771984563#L862

omcwang commented 3 years ago

I removed swig 2 and installed swig 3.0.12. new error:

... [ 94%] Built target s2 Scanning dependencies of target term_index [ 95%] Building CXX object examples/CMakeFiles/term_index.dir/term_index.cc.o [ 96%] Linking CXX executable term_index [ 96%] Built target term_index Scanning dependencies of target point_index [ 97%] Building CXX object examples/CMakeFiles/point_index.dir/point_index.cc.o [ 98%] Linking CXX executable point_index [ 98%] Built target point_index Scanning dependencies of target pywraps2_swig_compilation [ 99%] Swig source /opt/s2geometry/src/s2/s2region.h:45: Warning 362: operator= ignored /opt/s2geometry/src/s2/s2region_coverer.h:252: Warning 350: operator new ignored /opt/s2geometry/src/s2/s2region_coverer.h:256: Warning 351: operator delete ignored /opt/s2geometry/src/s2/s2region_term_indexer.h:239: Warning 362: operator= ignored /opt/s2geometry/src/s2/s2cell_union.h:73: Warning 509: Overloaded method S2CellUnion::S2CellUnion(std::vector< uint64,std::allocator< uint64 > > const &) effectively ignored, /opt/s2geometry/src/s2/s2cell_union.h:69: Warning 509: as it is shadowed by S2CellUnion::S2CellUnion(std::vector< S2CellId,std::allocator< S2CellId > >). [ 99%] Built target pywraps2_swig_compilation Scanning dependencies of target _pywraps2 [ 99%] Building CXX object python/CMakeFiles/_pywraps2.dir/CMakeFiles/_pywraps2.dir/s2PYTHON_wrap.cxx.o [100%] Linking CXX shared module _pywraps2.so /usr/bin/ld: /usr/local/lib/libpython3.8.a(abstract.o): relocation R_X86_64_32S against symbol _Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(boolobject.o): relocation R_X86_64_32S against symbol_Py_FalseStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(bytearrayobject.o): relocation R_X86_64_32 against symbol _PyByteArray_empty_string' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(bytesobject.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(call.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(capsule.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(classobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(exceptions.o): relocation R_X86_64_32S against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(floatobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(frameobject.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(iterobject.o): relocation R_X86_64_32 against symbol _Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(listobject.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(longobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(dictobject.o): relocation R_X86_64_32S against.text.hot' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(memoryobject.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(methodobject.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(moduleobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(object.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(obmalloc.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(picklebufobject.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(rangeobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(setobject.o): relocation R_X86_64_32S against.data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(sliceobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(structseq.o): relocation R_X86_64_32 against.data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(tupleobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(typeobject.o): relocation R_X86_64_32 against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(unicodeobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(unicodectype.o): relocation R_X86_64_32S against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(weakrefobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_warnings.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(ceval.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(codecs.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(compile.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(errors.o): relocation R_X86_64_32S against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(future.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getargs.o): relocation R_X86_64_32S against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(import.o): relocation R_X86_64_32S against symbol _PyImport_DynLoadFiletab' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(importdl.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(initconfig.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(marshal.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(modsupport.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pathconfig.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(peephole.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(preconfig.o): relocation R_X86_64_32S against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pyhash.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pylifecycle.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pystate.o): relocation R_X86_64_32 against symbol _Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pythonrun.o): relocation R_X86_64_32 against.data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pytime.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(bootstrap_hash.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(symtable.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(sysmodule.o): relocation R_X86_64_32 against.bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(thread.o): relocation R_X86_64_32 against .bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(traceback.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getopt.o): relocation R_X86_64_32S against .rodata.str4.4' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pystrtod.o): relocation R_X86_64_32S against symbol_Py_ctype_tolower' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pystrhex.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(dtoa.o): relocation R_X86_64_32S against.bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(formatter_unicode.o): relocation R_X86_64_32S against symbol _Py_ctype_table' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(fileutils.o): relocation R_X86_64_32S against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(dynload_shlib.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getpath.o): relocation R_X86_64_32S against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(gcmodule.o): relocation R_X86_64_32 against symbol _Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(posixmodule.o): relocation R_X86_64_32S against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(errnomodule.o): relocation R_X86_64_32 against .data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(pwdmodule.o): relocation R_X86_64_32 against.bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_sre.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_codecsmodule.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_weakref.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_functoolsmodule.o): relocation R_X86_64_32 against.data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_operator.o): relocation R_X86_64_32 against .data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_collectionsmodule.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_abc.o): relocation R_X86_64_32 against .data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(itertoolsmodule.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(atexitmodule.o): relocation R_X86_64_32 against .text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(signalmodule.o): relocation R_X86_64_32 against symbol_PyRuntime' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_stat.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(timemodule.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_threadmodule.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_localemodule.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_iomodule.o): relocation R_X86_64_32 against .data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(iobase.o): relocation R_X86_64_32 against symbol_Py_FalseStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(fileio.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(bytesio.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(bufferedio.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(textio.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(stringio.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(faulthandler.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(_tracemalloc.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(hashtable.o): relocation R_X86_64_32 against symbolPyMem_RawFree' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(symtablemodule.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(xxsubtype.o): relocation R_X86_64_32 against.data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getbuildinfo.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(acceler.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(grammar1.o): relocation R_X86_64_32S against symbol _PyParser_TokenNames' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(token.o): relocation R_X86_64_32S against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(parsetok.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(tokenizer.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(accu.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(bytes_methods.o): relocation R_X86_64_32S against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(cellobject.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(codeobject.o): relocation R_X86_64_32S against symbolPyUnicode_Type' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(complexobject.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(descrobject.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(enumobject.o): relocation R_X86_64_32 against .data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(genobject.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(fileobject.o): relocation R_X86_64_32 against symbol _Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(funcobject.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(interpreteridobject.o): relocation R_X86_64_32 against .text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(odictobject.o): relocation R_X86_64_32 against symbolPyODictItems_Type' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(namespaceobject.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(Python-ast.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(ast.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(ast_opt.o): relocation R_X86_64_32S against symbolPyFrozenSet_Type' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(ast_unparse.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(bltinmodule.o): relocation R_X86_64_32S against symbolPyFilter_Type' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(context.o): relocation R_X86_64_32 against symbol PyContext_Type' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getcopyright.o): relocation R_X86_64_32 against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getplatform.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getversion.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(hamt.o): relocation R_X86_64_32S against symbol _PyHamt_BitmapNode_Type' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(mystrtoul.o): relocation R_X86_64_32S against symbol_Py_ctype_table' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(structmember.o): relocation R_X86_64_32S against .rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(parser.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(myreadline.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(getcompiler.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output collect2: error: ld returned 1 exit status make[2]: [python/_pywraps2.so] Error 1 make[1]: [python/CMakeFiles/_pywraps2.dir/all] Error 2 make: *** [all] Error 2

jmr commented 3 years ago

/usr/bin/ld: /usr/local/lib/libpython3.8.a(abstract.o): relocation R_X86_64_32S against symbol _Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.8.a(boolobject.o): relocation R_X86_64_32S against symbol _Py_FalseStruct' can not be used when making a shared object; recompile with -fPIC

It looks like this is finding a static rather than a shared library. Do you have a libpython3.8.so?

topazus commented 1 year ago

@jmr The similar error occured with me.

❯ git log
commit 7773d518b1f29caa1c2045eb66ec519e025be108 (grafted, HEAD -> master, origin/master, origin/HEAD)

❯ cmake . -B build   -GNinja   -DCMAKE_BUILD_TYPE=Release -DWITH_PYTHON=ON -DCMAKE_CXX_STANDARD=17
-- The C compiler identification is GNU 13.1.1
-- The CXX compiler identification is GNU 13.1.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib64/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/lib64/ccache/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The following features have been enabled:

 * SHARED_LIBS, builds shared libraries instead of static.
 * PYTHON, provides python interface to S2

-- The following features have been disabled:

 * S2_USE_SYSTEM_INCLUDES, Silence warnings in s2 headers by marking them as SYSTEM includes.

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "3.0.8")  
-- Found SWIG: /usr/bin/swig (found suitable version "4.1.1", minimum required is "4.0")  
-- Found Python3: /usr/bin/python3.11 (found version "3.11.4") found components: Interpreter Development Development.Module Development.Embed 
GOOGLETEST_ROOT: 
-- Configuring done (1.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/ruby/test/s2geometry/build

ruby in 🌐 fedora in s2geometry on  master [?] is 📦 v0.11.0.dev1 via △ v3.27.0-rc3 via 🐍 v3.11.4 
❯ cmake --build build/ -j6
[101/103] Swig compile s2.i for python
FAILED: python/CMakeFiles/s2geometry.dir/s2PYTHON_wrap.cxx python/s2.py /home/ruby/test/s2geometry/build/python/CMakeFiles/s2geometry.dir/s2PYTHON_wrap.cxx /home/ruby/test/s2geometry/build/python/s2.py 
cd /home/ruby/test/s2geometry/build/python && /usr/bin/cmake -E make_directory /home/ruby/test/s2geometry/build/python/CMakeFiles/s2geometry.dir /home/ruby/test/s2geometry/build/python /home/ruby/test/s2geometry/build/python/CMakeFiles/s2geometry.dir && /usr/bin/cmake -E env SWIG_LIB=/usr/share/swig/4.1.1 /usr/bin/swig -python -module s2geometry -outdir /home/ruby/test/s2geometry/build/python -c++ -interface _s2geometry -I/usr/include -I/usr/include/python3.11 -I/home/ruby/test/s2geometry/src -o /home/ruby/test/s2geometry/build/python/CMakeFiles/s2geometry.dir/s2PYTHON_wrap.cxx /home/ruby/test/s2geometry/src/python/s2.i
/usr/include/s2/util/coding/coder.h:53: Warning 362: operator= ignored
/usr/include/s2/s2boolean_operation.h:452: Warning 362: operator= ignored
/usr/include/s2/s2buffer_operation.h:203: Warning 362: operator= ignored
/usr/include/s2/s2buffer_operation.h:213: Warning 325: Nested class not currently supported (Options ignored)
/usr/include/s2/s2buffer_operation.h:220: Error: Syntax error in input(3).
ninja: build stopped: subcommand failed.