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

protobuf fPIC #5822

Closed
wants to merge 2 commits into from
Closed

protobuf fPIC #5822

wants to merge 2 commits into from

Conversation

maximegmd
Copy link
Contributor

Fixes linker errors on linux when linking the library in a shared object.

@SirLynix
Copy link
Member

this is already the default behavior of xmake when configuring cmake:
https://github.com/xmake-io/xmake/blob/6227615261ce6c2109c0c8324a83b582b25bd337/xmake/modules/package/tools/cmake.lua#L424-L426

maybe you disabled the pic config by mistake, or are having a particular configuration causing a bug?

@maximegmd
Copy link
Contributor Author

maximegmd commented Nov 24, 2024

It's just the standard setup on a github CI and there is nothing that explicitly disables PIC anywhere.

See without explicit add_cxflags("-fPIC"), it fails linking our own libs:
https://github.com/tiltedphoques/CyberpunkMP/actions/runs/12000382045/job/33449425345?pr=14

and with explicit flag, it fails linking packages:
https://github.com/tiltedphoques/CyberpunkMP/actions/runs/12000254963/job/33449129682

@maximegmd
Copy link
Contributor Author

maximegmd commented Nov 24, 2024

The flag is indeed not passed ( https://github.com/tiltedphoques/CyberpunkMP/actions/runs/12000526483/job/33449746246?pr=14 )

/usr/local/bin/cmake -DSNAPPY_BUILD_TESTS=OFF -DSNAPPY_BUILD_BENCHMARKS=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DSNAPPY_REQUIRE_AVX=OFF -DSNAPPY_REQUIRE_AVX2=OFF -DSNAPPY_HAVE_BMI2=OFF -DCMAKE_INSTALL_PREFIX=/home/runner/.xmake/packages/s/snappy/1.1.10/badf6f1831764ca3b0e09f448f638f17 -DCMAKE_INSTALL_LIBDIR:PATH=lib -G "Unix Makefiles" -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=0 -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH -DCMAKE_RANLIB=/usr/bin/ranlib -DCMAKE_STATIC_LINKER_FLAGS= -DCMAKE_C_FLAGS=-m64 -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH -DCMAKE_FIND_USE_INSTALL_PREFIX=0 -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH -DHAVE_FLAG_SEARCH_PATHS_FIRST=0 -DCMAKE_OSX_SYSROOT= -DCMAKE_EXE_LINKER_FLAGS=-m64 -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_ASM_COMPILER=/usr/bin/gcc -DCMAKE_CXX_FLAGS=-m64 -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCMAKE_ASM_FLAGS=-m64 -DCMAKE_AR=/usr/bin/ar -DCMAKE_SHARED_LINKER_FLAGS=-m64 "-DCMAKE_CXX_LINK_EXECUTABLE=/usr/bin/g++

@star-hengxing
Copy link
Contributor

see xmake-io/xmake#5817

@maximegmd
Copy link
Contributor Author

xmake-io/xmake#5881

@maximegmd maximegmd closed this Nov 25, 2024
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.

3 participants