kubernetes-client / c

Official C client library for Kubernetes
Apache License 2.0
144 stars 46 forks source link

Windows adaptations and installation configuration #80

Closed ahmedyarub closed 2 years ago

ahmedyarub commented 2 years ago

Should be merged after https://github.com/OpenAPITools/openapi-generator/pull/10326 Includes fixes for Windows and installation configuration.

k8s-ci-robot commented 2 years ago

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
ahmedyarub commented 2 years ago

I signed it

ahmedalnuaimi commented 2 years ago

I signed it

ahmedyarub commented 2 years ago

All requested changes are made @ityuhui

ityuhui commented 2 years ago

The build of libkubernetes.so will fail:

/usr/bin/ld: /usr/local/lib/libyaml.a(api.c.o): relocation R_X86_64_PC32 against symbol `yaml_realloc' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/kubernetes.dir/build.make:19861: recipe for target 'libkubernetes.so' failed
make[2]: *** [libkubernetes.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/kubernetes.dir/all' failed
make[1]: *** [CMakeFiles/kubernetes.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

After I rebuilt and installed libyaml to a shared library:

user@machine:~/libyaml/build# cmake .. -DBUILD_SHARED_LIBS=1
sudo make install

The libkubernetes.so can be built successfully.

ahmedyarub commented 2 years ago

The build of libkubernetes.so will fail:

/usr/bin/ld: /usr/local/lib/libyaml.a(api.c.o): relocation R_X86_64_PC32 against symbol `yaml_realloc' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
collect2: error: ld returned 1 exit status
CMakeFiles/kubernetes.dir/build.make:19861: recipe for target 'libkubernetes.so' failed
make[2]: *** [libkubernetes.so] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/kubernetes.dir/all' failed
make[1]: *** [CMakeFiles/kubernetes.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

After I rebuilt and installed libyaml to a shared library:

user@machine:~/libyaml/build# cmake .. -DBUILD_SHARED_LIBS=1
sudo make install

The libkubernetes.so can be built successfully.

Do you propose making a change here?

ityuhui commented 2 years ago

Yes. I suggest updating the readme and actions/workflow to build libyaml as a shared library.

cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=1 .. 
ahmedyarub commented 2 years ago
 -DBUILD_SHARED_LIBS=

Done

ahmedyarub commented 2 years ago

Next I'll make some adaptations for Android, iOS, MacOS and possibly WASM!

ityuhui commented 2 years ago

/lgtm /approve

k8s-ci-robot commented 2 years ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ahmedyarub, ityuhui

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-client/c/blob/master/OWNERS)~~ [ityuhui] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
ityuhui commented 2 years ago

@ahmedyarub Thanks to your contribution now the C client library supports Windows !

ahmedyarub commented 2 years ago

@ahmedyarub Thanks to your contribution now the C client library supports Windows !

Next I'll work on adaptations for Android, MacOS, iOS, and Emscripten

ityuhui commented 2 years ago

Hi @ahmedyarub