incubator-devlake icon indicating copy to clipboard operation
incubator-devlake copied to clipboard

[Question][devlake] Setting up a development environment on macOS Sonoma 14.2

Open hsol opened this issue 9 months ago • 5 comments

Question

  1. About mysqlclient module compatibility(ISO C99 and later do not support implicit function declarations) The problem of mysqlclient not being installed during installation of fakeplugin due to a version issue was resolved by using 2.2.x instead of 2.1.1.

  2. Occur panic on go run server/main.go

panic: plugin.Open("bin/plugins/gitextractor/gitextractor.so"): dlopen(/Users/admin/PycharmProjects/incubator-devlake/backend/bin/plugins/gitextractor/gitextractor.so, 0x000A): Library not loaded: @rpath/libgit2.1.3.dylib
  |   Referenced from: <65ABAC48-5208-388B-845A-10DFA9ADD47F> /Users/admin/PycharmProjects/incubator-devlake/backend/bin/plugins/gitextractor/gitextractor.so
  |   Reason: no LC_RPATH's found
Wraps: (2) plugin.Open("bin/plugins/gitextractor/gitextractor.so"): dlopen(/Users/admin/PycharmProjects/incubator-devlake/backend/bin/plugins/gitextractor/gitextractor.so, 0x000A): Library not loaded: @rpath/libgit2.1.3.dylib
  |   Referenced from: <65ABAC48-5208-388B-845A-10DFA9ADD47F> /Users/admin/PycharmProjects/incubator-devlake/backend/bin/plugins/gitextractor/gitextractor.so
  |   Reason: no LC_RPATH's found
Error types: (1) *hintdetail.withDetail (2) *errors.errorString

goroutine 1 [running]:
github.com/apache/incubator-devlake/core/errors.Must(...)
        /Users/admin/PycharmProjects/incubator-devlake/backend/core/errors/util.go:34
github.com/apache/incubator-devlake/server/services.Init()
        /Users/admin/PycharmProjects/incubator-devlake/backend/server/services/init.go:96 +0x38b
github.com/apache/incubator-devlake/server/api.Init(...)
        /Users/admin/PycharmProjects/incubator-devlake/backend/server/api/api.go:58
github.com/apache/incubator-devlake/server/api.CreateAndRunApiServer()
        /Users/admin/PycharmProjects/incubator-devlake/backend/server/api/api.go:70 +0x14
main.main()
        /Users/admin/PycharmProjects/incubator-devlake/backend/server/main.go:33 +0x30
exit status 2
make[1]: *** [run] Error 1
make: *** [dev] Error 2

Screenshots

If applicable, add screenshots to help explain.

Additional context

Add any other context here. image

Only by resolving this issue will the environment be ready to contribute to devlake. I will work hard to solve it in my own way. If you can help solve the problem, please comment.

Here's what I did it:

  • Custom install libgit2 correct version on devlake
  • Added LC_RPATH by install_name_tool

hsol avatar Apr 28 '24 15:04 hsol

install_name_tool -add_rpath /$path/libgit2/libgit2/build /$path/incubator-devlake/backend/bin/plugins/gitextractor/gitextractor.so

then, go run server/main.go

abeizn avatar Apr 29 '24 02:04 abeizn

Hi, I don't understand the 1st problem, and I don't use mac. But for the libgit2, you may clone the repo https://github.com/libgit2/libgit2, check out the v1.3.2 tag and build the library by following the README.md https://github.com/libgit2/libgit2/tree/v1.3.2?tab=readme-ov-file#building-libgit2---using-cmake

klesh avatar Apr 29 '24 02:04 klesh

I had many issues installing it in macOS that I personally gave up. I went the Docker Compose route using the recently added watch command. I also added a layer to the Dockerfile to execute the tests.

The test database is created with docker compose -f docker-compose-dev.yml up mysql_test and tests can be run with docker build --target test -f backend/Dockerfile ./backend --progress=plain --network=host. For developing, docker compose -f docker-compose-dev.yml watch devlake re-builds as it changes.

The changes files are in this commit and might be outdated.

This might seem a lot of work, but I do not have to install anything on my machine or deal with any incompatibilities.

@klesh @abeizn I recall reading about an item in the roadmap about making it simpler to set up the local environment. Is any work being done in this direction, or are there any ideas?

gustavobini avatar Apr 29 '24 17:04 gustavobini

Thanks. I will comment after trying you suggested.

hsol avatar May 01 '24 04:05 hsol

@gustavobini Not sure, maybe it was about making it simpler for Users? I don't recall any milestone to make Developers' life easier.

However, we did try replacing libgit2 to make things easier for developers with Macs #6615, but it was not very successful due to #7202.

klesh avatar May 06 '24 03:05 klesh

This issue has been automatically marked as stale because it has been inactive for 60 days. It will be closed in next 7 days if no further activity occurs.

github-actions[bot] avatar Jul 06 '24 00:07 github-actions[bot]

This issue has been closed because it has been inactive for a long time. You can reopen it if you encounter the similar problem in the future.

github-actions[bot] avatar Jul 13 '24 00:07 github-actions[bot]

Just adding the LC_RPATH by install_name_tool didn't worked for me 😞 Has anyone using macOS managed to solve this problem?

caioq avatar Sep 24 '24 13:09 caioq

@caioq We managed to get it working by modifying the following in the backend/Makefile file:

run:
-	go run server/main.go
+	go run -exec "env DYLD_LIBRARY_PATH=/usr/local/lib" server/main.go

https://github.com/apache/incubator-devlake/blob/9251c42a7599d3b20aae1d0868a25024b3d7bb33/backend/Makefile#L62

Hope it helps :)

GuilleDF avatar Sep 24 '24 14:09 GuilleDF

@caioq We managed to get it working by modifying the following in the backend/Makefile file:

run:
-	go run server/main.go
+	go run -exec "env DYLD_LIBRARY_PATH=/usr/local/lib" server/main.go

https://github.com/apache/incubator-devlake/blob/9251c42a7599d3b20aae1d0868a25024b3d7bb33/backend/Makefile#L62

Hope it helps :)

Thank you so much! this worked for me!

caioq avatar Sep 24 '24 14:09 caioq