{"id":34553038,"url":"https://github.com/fardream/gmsk","last_synced_at":"2026-03-12T21:02:47.693Z","repository":{"id":143508238,"uuid":"615577412","full_name":"fardream/gmsk","owner":"fardream","description":"An unofficial golang binding for MOSEK","archived":false,"fork":false,"pushed_at":"2024-08-02T00:13:20.000Z","size":546,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-25T19:21:01.956Z","etag":null,"topics":["go","golang","mathematical-modelling","optimization","optimization-tools"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fardream.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-18T03:33:04.000Z","updated_at":"2024-08-02T00:12:49.000Z","dependencies_parsed_at":"2025-12-24T08:07:36.527Z","dependency_job_id":null,"html_url":"https://github.com/fardream/gmsk","commit_stats":null,"previous_names":[],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/fardream/gmsk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardream%2Fgmsk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardream%2Fgmsk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardream%2Fgmsk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardream%2Fgmsk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fardream","download_url":"https://codeload.github.com/fardream/gmsk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fardream%2Fgmsk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30444290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-12T20:23:30.529Z","status":"ssl_error","status_checked_at":"2026-03-12T20:23:14.027Z","response_time":114,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","mathematical-modelling","optimization","optimization-tools"],"created_at":"2025-12-24T08:06:16.805Z","updated_at":"2026-03-12T21:02:44.599Z","avatar_url":"https://github.com/fardream.png","language":"Go","readme":"# GMSK\n\n`gmsk` is an unofficial wrapper for MOSEK, the conic optimizer from [MOSEK ApS](https://www.mosek.com).\n\nFor Detailed Documentation, See [![Go Reference](https://pkg.go.dev/badge/github.com/fardream/gmsk.svg)](https://pkg.go.dev/github.com/fardream/gmsk)\n\n## Examples\n\nSee [Examples](https://pkg.go.dev/github.com/fardream/gmsk#pkg-examples) section on [![Go Reference](https://pkg.go.dev/badge/github.com/fardream/gmsk.svg)](https://pkg.go.dev/github.com/fardream/gmsk) for many examples reproduced from C api code.\n\n_Hello World_ example from C api is provided below.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/fardream/gmsk\"\n)\n\n// This is reproduced from MOSEK C example hellowworld.c\n// However, the response code is checked here.\nfunc main() {\n\tcheckOk := func(err error) {\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"failed: %s\", err.Error())\n\t\t}\n\t}\n\n\ttask, err := gmsk.MakeTask(nil, 0, 0)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer gmsk.DeleteTask(task)\n\n\tcheckOk(task.AppendVars(1))\n\tcheckOk(task.PutCJ(0, 1.0))\n\tcheckOk(task.PutVarBound(0, gmsk.BK_RA, 2.0, 3.0))\n\tcheckOk(task.PutObjSense(gmsk.OBJECTIVE_SENSE_MINIMIZE))\n\t_, res := task.OptimizeTrm()\n\tcheckOk(res)\n\tresult := make([]float64, 1)\n\tresult, res = task.GetXx(gmsk.SOL_ITR, result)\n\n\tfmt.Printf(\"Solution x = %.6f\\n\", result[0])\n}\n```\n\n## Setup MOSEK c api for gmsk\n\nGMSK requires the C api for MOSEK, which can be obtained from [MOSEK's website](https://www.mosek.com).\nTo actually build the package, a recent enough C toolchain, and the environment should be properly set up.\n\n### Set up on Linux\n\nOn linux, this can be achieved by setting `CPATH` environment variable and `LIBRARY_PATH`\n\n```shell\n# prepend mosek header folder to CPATH, replace {version} and {arch} with the one you have installed\nexport CPATH=${MSKHOME}/mosek/{version}/tools/platform/{arch}/h${CPATH:+\":${CPATH}\"}\n# prepend mosek lib folder to LIBRARY_PATH\nexport LIBRARY_PATH=${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin${LIBRARY_PATH:+\":${LIBRARY_PATH}\"}\nexport LD_LIBRARY_PATH=${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin${LD_LIBRARY_PATH:+\":${LD_LIBRARY_PATH}\"}\n```\n\nAlternatively, this can set up for cgo specifically\n\n```shell\nexport CGO_CFLAGS=\"-I${MSKHOME}/mosek/{version}/tools/platform/{arch}/h\"\nexport CGO_LDFLAGS=\"-L${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin\"\n```\n\n**IF** `LD_LIBRARY_PATH` doesn't include MOSEK's binary folder when running the code, the binary can be set up by adding MOSEK's binary folder to `rpath`, for example, the `CGO_LDFLAGS` can be updated to add `rpath`\n\n```shell\nexport CGO_LDFLAGS=\"-L${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin -Wl,-rpath=${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin\"\n```\n\n### Setup on macOS\n\nFollow the installation instructions on MOSEK's website - remember to run `install.py`. Note unless System Integrity Protect (SIP) is turned off on macOS, the environment variable `LD_LIBRARY_PATH` (and macOS specific `DYLD_LIBRARY_PATH`) will **NOT** work.\n\nWhen building, the setup is similar to linux\n\n```shell\n# prepend mosek header folder to CPATH, replace {version} and {arch} with the one you have installed\nexport CPATH=${MSKHOME}/mosek/{version}/tools/platform/{arch}/h${CPATH:+\":${CPATH}\"}\n# prepend mosek lib folder to LIBRARY_PATH\nexport LIBRARY_PATH=${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin${LIBRARY_PATH:+\":${LIBRARY_PATH}\"}\n```\n\nor\n\n```shell\nexport CGO_CFLAGS=\"-I${MSKHOME}/mosek/{version}/tools/platform/{arch}/h\"\nexport CGO_LDFLAGS=\"-L${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin\"\n```\n\nHowever, the binary may not be able to find `libmosek` at runtime. Besides default search path, macOS will also look for dynlib in the rpaths of the binary - however, it only does so if the load path of the dynlib starts with `@rpath` - which is controlled by the `LC_ID_DYLIB` of the dynlib (in this case, `libmosek64`).\n\nSo there are two options\n\n1. Use `rpath`. First add `rpath` to the linker line\n\n   ```shell\n   export CGO_LDFLAGS=\"-L${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin -Wl,-headerpad,128 -Wl,-rpath,${MSKHOME}/mosek/{version}/tools/platform/{arch}/bin\" #\n   ```\n\n   Then check `LC_ID_DYNLIB` on the `libmosek64.dynlib`, and update it with `install_name_tool` (which is part of Apple's development suite). For example, for 10.0 version of the library\n\n   ```shell\n   install_name_tool -id @rpath/libmosek64.10.0.dynlib path/to/libmosek64.10.0.dynlib\n   ```\n\n1. Change `LC_ID_DYNLIB` to the full absolute path of `libmosek64`.\n   ```shell\n   install_name_tool -id /abspath/to/libmosek64.10.0.dynlib path/to/libmosek64.10.0.dynlib\n   ```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffardream%2Fgmsk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffardream%2Fgmsk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffardream%2Fgmsk/lists"}