osrf / homebrew-simulation

Homebrew tap for osrf simulation software
Apache License 2.0
56 stars 75 forks source link

ogre formulae don't compile on Macs with M1 arm processor #1628

Closed scpeters closed 1 year ago

scpeters commented 3 years ago

I tried compiling ogre1.9, ogre2.1, and ogre2.2 on a Mac mini with the new M1 processor and it failed to compile. I think we need to apply https://github.com/OGRECave/ogre-next/commit/ff013388249c4f51537e09f9f84b51e51d77cf10 to our formulae.

cd /tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/build/OgreMain && /opt/homebrew/Library/Homebrew/shims/mac/super/clang++ -DBOOST_ALL_NO_LIB -DFREEIMAGE_LIB -DOGRE_NONCLIENT_BUILD -DOgreMain_EXPORTS -D_MT -D_USRDLL -D__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES=0 -I/tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/include -I/tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/build/include -I/tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/include/OSX -I/opt/homebrew/include/freetype2 -I/tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696 -I/tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/include/Threading -I/tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/src/nedmalloc -stdlib=libc++ -O3 -DNDEBUG -arch x86_64 -mmacosx-version-min=10.7 -fPIC   -pthread -MD -MT OgreMain/CMakeFiles/OgreMain.dir/src/OgrePass.cpp.o -MF CMakeFiles/OgreMain.dir/src/OgrePass.cpp.o.d -o CMakeFiles/OgreMain.dir/src/OgrePass.cpp.o -c /tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/src/OgrePass.cpp
In file included from /tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/src/OgreOptimisedUtilSSE.cpp:39:
In file included from /tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/src/OgreSIMDHelper.h:76:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/xmmintrin.h:13:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier '__builtin_ia32_emms'; did you mean '__builtin_isless'?
    __builtin_ia32_emms();
    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/c++/v1/math.h:649:12: note: '__builtin_isless' declared here
    return isless(__lcpp_x, __lcpp_y);
           ^
/Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'
#define isless(x, y) __builtin_isless((x),(y))
                     ^
In file included from /tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/src/OgreOptimisedUtilSSE.cpp:39:
In file included from /tmp/ogre1.9-20210930-35690-ugtmev/sinbad-ogre-108ab0bcc696/OgreMain/src/OgreSIMDHelper.h:76:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/xmmintrin.h:13:
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0
    __builtin_ia32_emms();
    ~~~~~~~~~~~~~~~~~~~~^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:129:19: error: use of undeclared identifier '__builtin_ia32_packsswb'
    return (__m64)__builtin_ia32_packsswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:159:19: error: use of undeclared identifier '__builtin_ia32_packssdw'
    return (__m64)__builtin_ia32_packssdw((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:189:19: error: use of undeclared identifier '__builtin_ia32_packuswb'
    return (__m64)__builtin_ia32_packuswb((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:216:19: error: use of undeclared identifier '__builtin_ia32_punpckhbw'
    return (__m64)__builtin_ia32_punpckhbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:239:19: error: use of undeclared identifier '__builtin_ia32_punpckhwd'
    return (__m64)__builtin_ia32_punpckhwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:260:19: error: use of undeclared identifier '__builtin_ia32_punpckhdq'
    return (__m64)__builtin_ia32_punpckhdq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:287:19: error: use of undeclared identifier '__builtin_ia32_punpcklbw'
    return (__m64)__builtin_ia32_punpcklbw((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:310:19: error: use of undeclared identifier '__builtin_ia32_punpcklwd'
    return (__m64)__builtin_ia32_punpcklwd((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:331:19: error: use of undeclared identifier '__builtin_ia32_punpckldq'
    return (__m64)__builtin_ia32_punpckldq((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: use of undeclared identifier '__builtin_ia32_paddb'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: error: first argument of MTE builtin function must be a pointer ('__v8qi' (vector of 8 'char' values) invalid)
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: use of undeclared identifier '__builtin_ia32_paddw'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:373:19: error: first argument of MTE builtin function must be a pointer ('__v4hi' (vector of 4 'short' values) invalid)
    return (__m64)__builtin_ia32_paddw((__v4hi)__m1, (__v4hi)__m2);
                  ^                    ~~~~~~~~~~~~
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: use of undeclared identifier '__builtin_ia32_paddd'; did you mean '__builtin_arm_addg'?
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:352:19: note: '__builtin_arm_addg' declared here
    return (__m64)__builtin_ia32_paddb((__v8qi)__m1, (__v8qi)__m2);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:394:19: error: first argument of MTE builtin function must be a pointer ('__v2si' (vector of 2 'int' values) invalid)
    return (__m64)__builtin_ia32_paddd((__v2si)__m1, (__v2si)__m2);
                  ^                    ~~~~~~~~~~~~
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [OgreMain/CMakeFiles/OgreMain.dir/src/OgreOptimisedUtilSSE.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [OgreMain/CMakeFiles/OgreMain.dir/all] Error 2
make: *** [all] Error 2

HOMEBREW_VERSION: 3.2.14-35-g9b42a10
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9b42a104ee51fd2c45f91a72fc18bbad73b1aa5a
Last commit: 2 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: c2af2f98b5e6c98abfd7065e0eed12600bb45b80
Core tap last commit: 45 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_BOOTSNAP: set
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 13.0.0 build 1300
Git: 2.30.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.6-arm64
CLT: 13.0.0.0.1.1630607135
Xcode: N/A
Rosetta 2: false

HOMEBREW_CC: clang
HOMEBREW_CXX: clang++
MAKEFLAGS: -j8
CMAKE_PREFIX_PATH: /opt/homebrew/opt/icu4c:/opt/homebrew/opt/openssl@1.1:/opt/homebrew/opt/readline:/opt/homebrew/opt/sqlite:/opt/homebrew
CMAKE_INCLUDE_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Headers
CMAKE_LIBRARY_PATH: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk/System/Library/Frameworks/OpenGL.framework/Versions/Current/Libraries
CMAKE_FRAMEWORK_PATH: /opt/homebrew/opt/python@3.9/Frameworks
PKG_CONFIG_PATH: /opt/homebrew/opt/icu4c/lib/pkgconfig:/opt/homebrew/opt/libpng/lib/pkgconfig:/opt/homebrew/opt/freetype/lib/pkgconfig:/opt/homebrew/opt/libpthread-stubs/lib/pkgconfig:/opt/homebrew/opt/libxau/lib/pkgconfig:/opt/homebrew/opt/libxdmcp/lib/pkgconfig:/opt/homebrew/opt/libxcb/lib/pkgconfig:/opt/homebrew/opt/libx11/lib/pkgconfig:/opt/homebrew/opt/libzzip/lib/pkgconfig:/opt/homebrew/opt/openssl@1.1/lib/pkgconfig:/opt/homebrew/opt/readline/lib/pkgconfig:/opt/homebrew/opt/sqlite/lib/pkgconfig:/opt/homebrew/opt/xz/lib/pkgconfig:/opt/homebrew/opt/python@3.9/lib/pkgconfig:/opt/homebrew/opt/tbb/lib/pkgconfig:/opt/homebrew/opt/xorgproto/share/pkgconfig
PKG_CONFIG_LIBDIR: /usr/lib/pkgconfig:/opt/homebrew/Library/Homebrew/os/mac/pkgconfig/11
HOMEBREW_GIT: git
HOMEBREW_SDKROOT: /Library/Developer/CommandLineTools/SDKs/MacOSX11.sdk
ACLOCAL_PATH: /opt/homebrew/share/aclocal
PATH: /opt/homebrew/Library/Homebrew/shims/mac/super:/opt/homebrew/opt/cmake/bin:/opt/homebrew/opt/icu4c/bin:/opt/homebrew/opt/doxygen/bin:/opt/homebrew/opt/libpng/bin:/opt/homebrew/opt/freetype/bin:/opt/homebrew/opt/pkg-config/bin:/opt/homebrew/opt/libzzip/bin:/opt/homebrew/opt/gdbm/bin:/opt/homebrew/opt/openssl@1.1/bin:/opt/homebrew/opt/sqlite/bin:/opt/homebrew/opt/xz/bin:/opt/homebrew/opt/python@3.9/bin:/usr/bin:/bin:/usr/sbin:/sbin
scpeters commented 3 years ago

potential fix in #1643

jasonbyun8 commented 2 years ago

I can compile ogre1.9, but not for 2.1 & 2.2 because of the same issue. Is this somewhat expected?

In file included from /tmp/ogre2.2-20220209-55630-1l82eok/ogre-next-312bf406a77244afe230930e67e3e5d52a119507/OgreMain/src/OgreArchive.cpp:29: In file included from /tmp/ogre2.2-20220209-55630-1l82eok/ogre-next-312bf406a77244afe230930e67e3e5d52a119507/OgreMain/include/OgreStableHeaders.h:44: In file included from /tmp/ogre2.2-20220209-55630-1l82eok/ogre-next-312bf406a77244afe230930e67e3e5d52a119507/OgreMain/include/OgreCommon.h:35: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/xmmintrin.h:13: /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:5: error: use of undeclared identifier 'builtin_ia32_emms'; did you mean 'builtin_isless'? builtin_ia32_emms(); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/c++/v1/math.h:649:12: note: 'builtin_isless' declared here return isless(__lcpp_x, __lcpp_y); ^ /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/usr/include/math.h:545:22: note: expanded from macro 'isless'

define isless(x, y) __builtin_isless((x),(y))

                 ^

In file included from /tmp/ogre2.2-20220209-55630-1l82eok/ogre-next-312bf406a77244afe230930e67e3e5d52a119507/OgreMain/src/OgreArchive.cpp:29: In file included from /tmp/ogre2.2-20220209-55630-1l82eok/ogre-next-312bf406a77244afe230930e67e3e5d52a119507/OgreMain/include/OgreStableHeaders.h:44: In file included from /tmp/ogre2.2-20220209-55630-1l82eok/ogre-next-312bf406a77244afe230930e67e3e5d52a119507/OgreMain/include/OgreCommon.h:35: In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/xmmintrin.h:13: /Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:33:25: error: too few arguments to function call, expected 2, have 0 __builtin_ia32_emms();


/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:50:19: error: use of undeclared identifier '__builtin_ia32_vec_init_v2si'
    return (__m64)__builtin_ia32_vec_init_v2si(__i, 0);
                  ^
/Library/Developer/CommandLineTools/usr/lib/clang/13.0.0/include/mmintrin.h:67:12: error: use of undeclared identifier '__builtin_ia32_vec_ext_v2si'
    return __builtin_ia32_vec_ext_v2si((__v2si)__m, 0);
           ^
scpeters commented 2 years ago

ogre 2.1, 2.2 were not fixed by https://github.com/osrf/homebrew-simulation/pull/1646

scpeters commented 2 years ago

I see the following patches on ogre-next that mention "Apple Silicon" in the commit message:

I don't have an m1 machine, so I can't test this

jasonbyun8 commented 2 years ago

It's my first time to participate the issue, am I supposed to compile the suggested repo from scratch?

scpeters commented 2 years ago

It's my first time to participate the issue, am I supposed to compile the suggested repo from scratch?

I can see two ways to test these patches:

jasonbyun8 commented 2 years ago

I tried the second approach and ended up getting this. debug.txt

scpeters commented 2 years ago
==> Applying c39b6df49618773357da0b54437f351b57168d12.patch
patch -g 0 -f -p1 -i /private/tmp/ogre2.1--patch-20220216-21676-qpy924/c39b6df49618773357da0b54437f351b57168d12.patch
patching file OgreMain/src/OgreOptimisedUtil.cpp
patching file OgreMain/src/OgreOptimisedUtilSSE.cpp
patching file OgreMain/src/OgrePlatformInformation.cpp
Hunk #1 FAILED at 177.
1 out of 1 hunk FAILED -- saving rejects to file OgreMain/src/OgrePlatformInformation.cpp.rej
patching file OgreMain/src/OgreSIMDHelper.h
Hunk #1 FAILED at 31.
Hunk #2 succeeded at 42 (offset -31 lines).
1 out of 2 hunks FAILED -- saving rejects to file OgreMain/src/OgreSIMDHelper.h.rej
/opt/homebrew/Library/Homebrew/ignorable.rb:29:in `block in raise'
BuildError: Failed executing: patch -g 0 -f -p1 -i /private/tmp/ogre2.1--patch-20220216-21676-qpy924/c39b6df49618773357da0b54437f351b57168d12.patch

that means the patch did not apply properly

jasonbyun8 commented 2 years ago

https://github.com/tmefmd/homebrew-simulation/blob/9803a0234693ac901b967c08954529b9e1fb83ef/Formula/ogre2.1.rb#L48

Can you confirm what I added is correct?

jasonbyun8 commented 2 years ago

I still want to test things out but I am not sure how can I get sha256 and use the link from ogre-next -- sorry this is my first time to work on this so I need some input to learn about this :). If I see the patch you made (https://github.com/osrf/homebrew-simulation/pull/1646/files) I can see something like

url "https://github.com/scpeters/ogre/commit/c39b6df49618773357da0b54437f351b57168d12.patch?full_index=1" sha256 "fa8dc20d5978d1ff1402a4df890a6fa0ca1fec6ec73f00154f7484820516b071"

What is a good way of extracting those info. to test out new patches?

jasonbyun8 commented 2 years ago

I tried this

" # fix for m1 arch -- adapted from OGRECave/ogre-next@ff01338 patch do url "https://github.com/OGRECave/ogre-next/commit/ff013388249c4f51537e09f9f84b51e51d77cf10.patch?full_index=1" sha256 "1f0752700e3c1679d2f75eb5d0b773c10a0249e6fae657b388df9b321e29b8ce" end

# fix for m1 arch -- adapted from OGRECave/ogre-next@23d8261
patch do
  url "https://github.com/OGRECave/ogre-next/commit/23d82616a785f6aa26f58d5bf38a7114e2c00f88.patch?full_index=1"
  sha256 "cf0a5d72a1271ee1c1606ac6cc21ef39dc708a3adce5b9838a2a037dc98466c6"
end"

But ended up getting Error: ogre2.1: SHA256 mismatch Expected: cf0a5d72a1271ee1c1606ac6cc21ef39dc708a3adce5b9838a2a037dc98466c6 Actual: ade27e55e7be5510f5eeb95f17c9ba90e61575ad610cc35f24179d061b1756a1

The way I tried to get sha256 was

  1. Check out the commit of interest : git checkout 23d8261
  2. Zip the entire branch: tar -czf ogre-next-23d8261.tar.gz ogre-next
  3. Type “shasum -a 256 ogre-next-23d8261.tar.gz” to get the sh256 number -> You expect to see “cf0a5d72a1271ee1c1606ac6cc21ef39dc708a3adce5b9838a2a037dc98466c6 ogre-next-23d8261.tar.gz”
jasonbyun8 commented 2 years ago

I was able to add the patches you suggested but still ended up with errors. Any help will be appreciated.

Although it raises the errors, but ogre2.1/2.2 complies after ignoring those errors.

Also after this I can install ignition gazebo 5 but cannot run it with these errors;

I cannot find any available 'ign' command:

Kakcalu13 commented 2 years ago

Oh cool, I'm on M1 now and I come to the exact same issue as you guys are having.

I tried this

" # fix for m1 arch -- adapted from OGRECave/ogre-next@ff01338 patch do url "https://github.com/OGRECave/ogre-next/commit/ff013388249c4f51537e09f9f84b51e51d77cf10.patch?full_index=1" sha256 "1f0752700e3c1679d2f75eb5d0b773c10a0249e6fae657b388df9b321e29b8ce" end

# fix for m1 arch -- adapted from OGRECave/ogre-next@23d8261
patch do
  url "https://github.com/OGRECave/ogre-next/commit/23d82616a785f6aa26f58d5bf38a7114e2c00f88.patch?full_index=1"
  sha256 "cf0a5d72a1271ee1c1606ac6cc21ef39dc708a3adce5b9838a2a037dc98466c6"
end"

But ended up getting Error: ogre2.1: SHA256 mismatch Expected: cf0a5d72a1271ee1c1606ac6cc21ef39dc708a3adce5b9838a2a037dc98466c6 Actual: ade27e55e7be5510f5eeb95f17c9ba90e61575ad610cc35f24179d061b1756a1

The way I tried to get sha256 was

  1. Check out the commit of interest : git checkout 23d8261
  2. Zip the entire branch: tar -czf ogre-next-23d8261.tar.gz ogre-next
  3. Type “shasum -a 256 ogre-next-23d8261.tar.gz” to get the sh256 number -> You expect to see “cf0a5d72a1271ee1c1606ac6cc21ef39dc708a3adce5b9838a2a037dc98466c6 ogre-next-23d8261.tar.gz”

I think it has to be in your local instead. I'm not too sure, but have you tried that?

jasonbyun8 commented 2 years ago

You can check my latest comment but I was able to compile the ogre 2.1 or 2.2 after ignoring some failed patches.

iche033 commented 2 years ago

for those tesing ignition on macOS, there is a wiki from our external contributor that provides more info on how to get Ignition running: https://github.com/srmainwaring/ign-rendering/wiki

Kakcalu13 commented 2 years ago

@tmefmd Were you able to get it run on your computer? If so, what's your secret?

jasonbyun8 commented 2 years ago

@tmefmd Were you able to get it run on your computer? If so, what's your secret?

I was able to compile the ogre 2.1/2.2 but not ignition gazebo, since for now ign gazebo GUI is not supported on Mac. Maybe @iche033 confirm this?

iche033 commented 2 years ago

The gui should work now that https://github.com/ignitionrobotics/ign-gui/pull/323 is merged. However, it still needs the changes from this ign-gazebo PR https://github.com/ignitionrobotics/ign-gazebo/pull/1225

jasonbyun8 commented 2 years ago

@iche033 Does this work for M1 mac as well? It seems that the suggested tutorial is for intel based ones. Also I just followed https://github.com/srmainwaring/ign-rendering/wiki and I cannot install ogre 2.2 ⇒ I resolved the issue, your ogre2.2.rb worked for me https://github.com/osrf/homebrew-simulation/blob/86e9a94dbbb3aac7e6d9ddd26343e5c8363f1072/Formula/ogre2.2.rb

(update) Now ignition-gazebo7 can be compiled in my m1 mac through brew install, and ogre 1.9 is installed without an issue. But if I run ign gazebo -v4 -g, I ended up with an error below;

ign gazebo currently only works with the -s argument on macOS. See https://github.com/ignitionrobotics/ign-gazebo/issues/44 for more info.

And if I run ign gazebo -v4 -s I will have an error as below; (base) ➜ ignition git:(stable) ign gazebo -v4 -s [Msg] Ignition Gazebo Server v7.0.0~pre1 [Err] [Server.cc:109] Failed to find world [] [Dbg] [ign.cc:356] Shutting down ign-gazebo-server

Kakcalu13 commented 2 years ago

Hold up, you can compiled gazebo 7 on m1? Care to share your secret? ;)

@iche033 Does this work for M1 mac as well? It seems that the suggested tutorial is for intel based ones. Also I just followed https://github.com/srmainwaring/ign-rendering/wiki and I cannot install ogre 2.2

I put a separate path for M1. See here

When this wiki says,
cd /usr/local/Homebrew/Library/Taps/osrf/homebrew-simulation

It's for Mac with intel. This M1's location is now /opt/homebrew/Library/Taps/osrf/homebrew-simulation

From this link: https://github.com/ignitionrobotics/ign-gazebo/issues/1362#issuecomment-1080679122

Anyway,

I'm sure others will be very grateful if you share your secret about the ign gazebo7. :pray:

jasonbyun8 commented 2 years ago

Hold up, you can compiled gazebo 7 on m1? Care to share your secret? ;)

@iche033 Does this work for M1 mac as well? It seems that the suggested tutorial is for intel based ones. Also I just followed https://github.com/srmainwaring/ign-rendering/wiki and I cannot install ogre 2.2

I put a separate path for M1. See here

When this wiki says,
cd /usr/local/Homebrew/Library/Taps/osrf/homebrew-simulation

It's for Mac with intel. This M1's location is now /opt/homebrew/Library/Taps/osrf/homebrew-simulation

From this link: ignitionrobotics/ign-gazebo#1362 (comment)

Anyway,

I'm sure others will be very grateful if you share your secret about the ign gazebo7. 🙏

What I just did is brew install with homebrew-simulation tap being added brew install ignition-gazebo7

iche033 commented 2 years ago

And if I run ign gazebo -v4 -s I will have an error as below; (base) ➜ ignition git:(stable) ign gazebo -v4 -s [Msg] Ignition Gazebo Server v7.0.0~pre1 [Err] [Server.cc:109] Failed to find world [] [Dbg] [ign.cc:356] Shutting down ign-gazebo-server

how about trying ign gazebo -v 4 shapes.sdf? There was an issue with launching sim without a world name: https://github.com/ignitionrobotics/ign-gazebo/pull/1463

jasonbyun8 commented 2 years ago

And if I run ign gazebo -v4 -s I will have an error as below; (base) ➜ ignition git:(stable) ign gazebo -v4 -s [Msg] Ignition Gazebo Server v7.0.0~pre1 [Err] [Server.cc:109] Failed to find world [] [Dbg] [ign.cc:356] Shutting down ign-gazebo-server

how about trying ign gazebo -v 4 shapes.sdf? There was an issue with launching sim without a world name: ignitionrobotics/ign-gazebo#1463

(edit) I revised the link since I was using the wrong one

I think the ignition-gazebo7 in the homebrew bottle does not have changes made from this PR, hopefully this is being merged soon https://github.com/ignitionrobotics/ign-gazebo/pull/1225/files

I also checked that the current collection-garden.yaml does not have that either so I had to manually update those files to get this working with graphics. But it works without an issue on my machine now.

Screen Shot 2022-05-03 at 11 01 38 PM
Kakcalu13 commented 2 years ago

Oh my! Let me try this too!

jasonbyun8 commented 2 years ago

@scpeters I think we can close this now, as the patches are updated in the repo and ogre compiles as expected

Kakcalu13 commented 2 years ago

@scpeters I think we can close this now, as the patches are updated in the repo and ogre compiles as expected

I tried this few days ago and I did not have any luck.

Also, this follows the issue: https://github.com/gazebosim/gz-launch/pull/161

Fortress is the latest stable atm. Are you able to load Fortress/Citadel on M1?

jasonbyun8 commented 2 years ago

@scpeters I think we can close this now, as the patches are updated in the repo and ogre compiles as expected

I tried this few days ago and I did not have any luck.

Also, this follows the issue: gazebosim/gz-launch#161

Fortress is the latest stable atm. Are you able to load Fortress/Citadel on M1?

That PR fixes https://github.com/gazebosim/gz-sim/issues/1362#issuecomment-1116416577, and it is nothing to do with ogre compilation

jasonbyun8 commented 2 years ago

It should also work with Fortress, but you need to make a modification on the source code since https://github.com/gazebosim/gz-sim/pull/1225 and https://github.com/gazebosim/gz-launch/pull/161 are not merged yet.

Kakcalu13 commented 2 years ago

I wonder, what is your OS version on M1? I'm currently using macOS Monterey. I've been following each steps, PR, and fixes. None of them worked for me.

jasonbyun8 commented 2 years ago

The latest version of Monterey.

Kakcalu13 commented 2 years ago

The latest version of Monterey.

That's good. So now I have a hope :P

Question for you though, how did you past the GUI issue? https://github.com/gazebosim/gz-gui/pull/323 didn't fix the issue for me. This is only one that prevents colcon build to complete. Everything worked out (with std output, ofc but that isn't an error)

The output:

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[2]: *** [include/gz/gui/CMakeFiles/ignition-gui7.dir/__/__/__/src/Dialog.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
20 errors generated.
make[2]: *** [include/gz/gui/CMakeFiles/ignition-gui7.dir/__/__/__/src/DragDropModel.cc.o] Error 1
20 errors generated.
make[2]: *** [include/gz/gui/CMakeFiles/ignition-gui7.dir/__/__/__/src/Helpers.cc.o] Error 1
20 errors generated.
make[2]: *** [include/gz/gui/CMakeFiles/ignition-gui7.dir/__/__/__/src/Application.cc.o] Error 1
20 errors generated.
make[2]: *** [include/gz/gui/CMakeFiles/ignition-gui7.dir/__/__/__/src/Conversions.cc.o] Error 1
make[1]: *** [include/gz/gui/CMakeFiles/ignition-gui7.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
warning: Tag 'TCL_SUBST' at line 237 of file '/Users/station1/workspace/build/ignition-gui7/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1044 of file '/Users/station1/workspace/build/ignition-gui7/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'LATEX_SOURCE_CODE' at line 1757 of file '/Users/station1/workspace/build/ignition-gui7/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'RTF_SOURCE_CODE' at line 1839 of file '/Users/station1/workspace/build/ignition-gui7/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOCBOOK_PROGRAMLISTING' at line 1937 of file '/Users/station1/workspace/build/ignition-gui7/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'CLASS_DIAGRAMS' at line 2130 of file '/Users/station1/workspace/build/ignition-gui7/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
make: *** [all] Error 2
make: INTERNAL: Exiting with 9 jobserver tokens available; should be 8!
---
Failed   <<< ignition-gui7 [4.09s, exited with code 2]
Aborted  <<< ignition-sensors7 [5.14s]

Summary: 12 packages finished [29.7s]
  1 package failed: ignition-gui7

All other packages were ran by --select-package and it gave me no issue. GUI does.

How did you manage to get through this?

Kakcalu13 commented 2 years ago

I ran brew install ignition-gui7 just to hope that it worked.

Surprisingly, it went through but it end up having an error. Are you familiar with this error?

station1@Station1s-Mini workspace % brew install ignition-gui7
==> Cloning https://github.com/ignitionrobotics/ign-msgs.git
Updating /Users/station1/Library/Caches/Homebrew/ignition-msgs9--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 03a7434 Migrate build files (#249)
==> Cloning https://github.com/ignitionrobotics/ign-plugin.git
Updating /Users/station1/Library/Caches/Homebrew/ignition-plugin2--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 8426cd6 Suppress a new Jammy warning (#85)
==> Cloning https://github.com/ignitionrobotics/ign-rendering.git
Updating /Users/station1/Library/Caches/Homebrew/ignition-rendering7--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 5832255b Migrate IgnHlms to GzHlms (#631)
==> Cloning https://github.com/ignitionrobotics/ign-transport.git
Updating /Users/station1/Library/Caches/Homebrew/ignition-transport12--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 703f52cf Migrate CMake Files (#310)
==> Cloning https://github.com/ignitionrobotics/ign-gui.git
Updating /Users/station1/Library/Caches/Homebrew/ignition-gui7--git
==> Checking out branch main
Already on 'main'
Your branch is up to date with 'origin/main'.
HEAD is now at 9b65b810 Update name and logo on UI, examples and API docs (#398)
==> Installing ignition-gui7 from osrf/simulation
==> Installing dependencies for osrf/simulation/ignition-gui7: ignition-msgs9, ignition-plugin2, ignition-rendering7 and ignition-transport12
==> Installing osrf/simulation/ignition-gui7 dependency: ignition-msgs9
==> cmake .. -DBUILD_TESTING=Off -DCMAKE_INSTALL_RPATH=@loader_path/../lib
Last 15 lines from /Users/station1/Library/Logs/Homebrew/ignition-msgs9/01.cmake:
CMake Error at /opt/homebrew/share/cmake/ignition-cmake3/cmake3/IgnConfigureBuild.cmake:63 (message):
  -- END BUILD ERRORS

Call Stack (most recent call first):
  CMakeLists.txt:84 (ign_configure_build)

CMake Error at /opt/homebrew/share/cmake/ignition-cmake3/cmake3/IgnConfigureBuild.cmake:68 (message):
  Errors encountered in build.  Please see BUILD ERRORS above.
Call Stack (most recent call first):
  CMakeLists.txt:84 (ign_configure_build)

-- Configuring incomplete, errors occurred!
See also "/tmp/ignition-msgs9-20220525-46726-t89kcy/build/CMakeFiles/CMakeOutput.log".

If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):
  https://github.com/osrf/homebrew-simulation/issues

station1@Station1s-Mini workspace %

But this worked when you ran this colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_MACOSX_RPATH=FALSE -DCMAKE_INSTALL_NAME_DIR=$(pwd)/install/lib

See here output on ign msg 9 after using colcon build:

station1@Station1s-Mini workspace % colcon build --merge-install --packages-select ignition-msgs9
Starting >>> ignition-msgs9
--- stderr: ignition-msgs9
warning: Tag 'TCL_SUBST' at line 237 of file '/Users/station1/workspace/build/ignition-msgs9/api_tagfile.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1044 of file '/Users/station1/workspace/build/ignition-msgs9/api_tagfile.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'LATEX_SOURCE_CODE' at line 1757 of file '/Users/station1/workspace/build/ignition-msgs9/api_tagfile.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'RTF_SOURCE_CODE' at line 1839 of file '/Users/station1/workspace/build/ignition-msgs9/api_tagfile.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOCBOOK_PROGRAMLISTING' at line 1937 of file '/Users/station1/workspace/build/ignition-msgs9/api_tagfile.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'CLASS_DIAGRAMS' at line 2125 of file '/Users/station1/workspace/build/ignition-msgs9/api_tagfile.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'TCL_SUBST' at line 237 of file '/Users/station1/workspace/build/ignition-msgs9/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1044 of file '/Users/station1/workspace/build/ignition-msgs9/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'LATEX_SOURCE_CODE' at line 1757 of file '/Users/station1/workspace/build/ignition-msgs9/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'RTF_SOURCE_CODE' at line 1839 of file '/Users/station1/workspace/build/ignition-msgs9/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'DOCBOOK_PROGRAMLISTING' at line 1937 of file '/Users/station1/workspace/build/ignition-msgs9/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'CLASS_DIAGRAMS' at line 2125 of file '/Users/station1/workspace/build/ignition-msgs9/api.dox' has become obsolete.
         To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
---
Finished <<< ignition-msgs9 [2.60s]

Summary: 1 package finished [2.90s]
  1 package had stderr output: ignition-msgs9
station1@Station1s-Mini workspace %

What's the difference between msg9 on brew and msg9 on GitHub's main branch?

Do you know anything about this? @iche033 @srmainwaring @jasonbyun8

I believe that GUI is only thing that is being blocked for others include myself. Physics is actually fixed by https://github.com/gazebosim/gz-sim/issues/1362#issuecomment-1115780880

Side note, I'm still dying for gazebo to be on m1 :P haven't tried it once since 3 months ago now

iche033 commented 2 years ago

I don't think the gui brew bottle will work since we haven't made a release with https://github.com/gazebosim/gz-gui/pull/323 yet. So you'll need to build from source.

In your build error output, you have

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

the actual errors should be shown before these lines. Do you see the files / line numbers that are causing the compile errors?

Kakcalu13 commented 2 years ago

My apologies, I didn't get this notification until I open my email.

Log is a very long one. Looks like it was trying to find gz-gui instead of ign-gui? Not sure if I'm right about this.

Here full_log.txt

Also, the gui is on main as well

Screen Shot 2022-05-26 at 9 09 26 AM

the change is already on this as u can see I got it from yday. That PR is merged on March 4

srmainwaring commented 2 years ago

@Kakcalu13 it might be a Qt version conflict issue. Some includes are being pulled in from

/opt/homebrew/opt/qt@5/lib/QtCore.framework/Headers/

and others

/opt/homebrew/include/QtCore/

which could mean you have qt6 (installed as qt) linked. This may cause conflicts as brew will link qt into /opt/homebrew/include which may be resolved before /opt/homebrew/opt/qt@5.

Check with brew info qt and try unlinking with brew unlink qt.

Kakcalu13 commented 2 years ago

brew info qt returns this output:

station1@Station1s-Mini workspace % brew info qt
qt: stable 6.3.0 (bottled), HEAD
Cross-platform application and UI framework
https://www.qt.io/
/opt/homebrew/Cellar/qt/6.2.3_1 (12,278 files, 489.1MB) *
  Poured from bottle on 2022-03-28 at 11:34:21
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/qt.rb
License: GFDL-1.3-only and GPL-2.0-only and GPL-3.0-only and LGPL-2.1-only and LGPL-3.0-only
==> Dependencies
Build: cmake ✔, ninja ✘, node ✘, pkg-config ✔
Required: assimp ✔, brotli ✔, dbus ✔, double-conversion ✔, freetype ✔, glib ✔, hunspell ✔, icu4c ✔, jasper ✔, jpeg ✔, libb2 ✔, libmng ✔, libpng ✔, libtiff ✔, md4c ✔, pcre2 ✔, python@3.9 ✔, sqlite ✔, webp ✔, zstd ✔
==> Requirements
Build: Xcode ✔
==> Options
--HEAD
    Install HEAD version
==> Analytics
install: 30,830 (30 days), 147,800 (90 days), 630,771 (365 days)
install-on-request: 16,217 (30 days), 81,136 (90 days), 288,690 (365 days)
build-error: 95 (30 days)
station1@Station1s-Mini workspace % 

Apparently, I have qt6! I unlinked it and it worked!!! No more errors. It was qt6 all the time!

Just ONE more thing...are you familiar with this issue?

[GUI] [Dbg] [Application.cc:576] Applying config
[GUI] [Wrn] [Component.hh:189] Trying to deserialize component with data type [N3sdf3v135WorldE], which doesn't have `operator>>`. Component will not be deserialized.
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/WorldStats/WorldStats.qml:53:3: QML RowLayout: Binding loop detected for property "x"
[GUI] [Wrn] [Application.cc:811] [QT] file::/EntityContextMenuPlugin/EntityContextMenuPlugin.qml:52:3: QML RenderWindowOverlay: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.
[GUI] [Wrn] [Application.cc:811] [QT] file::/EntityContextMenuPlugin/EntityContextMenuPlugin.qml:67:3: QML EntityContextMenu: Detected anchors on an item that is managed by a layout. This is undefined behavior; use Layout.alignment instead.
[GUI] [Wrn] [Application.cc:811] [QT] qUncompress: Z_DATA_ERROR: Input data is corrupted
[GUI] [Wrn] [Application.cc:811] [QT] Attempted to deserialize QShader with unknown version 0.
[GUI] [Wrn] [Application.cc:811] [QT] ShaderEffect: Failed to deserialize QShader from :/qt-project.org/imports/QtGraphicalEffects/shaders/gammaadjust.frag
[GUI] [Wrn] [Application.cc:811] [QT] ShaderEffect: shader preparation failed for qrc:/qt-project.org/imports/QtGraphicalEffects/shaders/gammaadjust.frag

[GUI] [Dbg] [MinimalScene.cc:641] Creating ign-renderering interface for Metal
[GUI] [Dbg] [MinimalScene.cc:794] Creating render thread interface for Metal
[GUI] [Msg] Loading plugin [ignition-rendering-ogre2]
Error while loading the library [/Users/station1/workspace/install/lib/ign-rendering-7/engine-plugins/libignition-rendering-ogre2.dylib]: dlopen(/Users/station1/workspace/install/lib/ign-rendering-7/engine-plugins/libignition-rendering-ogre2.dylib, 0x0005): Library not loaded: @rpath/libOgreMain.2.2.6.dylib
  Referenced from: /opt/homebrew/Cellar/ogre2.2/2.2.6+20211021~312bf40_1/lib/libOgreHlmsPbs.2.2.6.dylib
  Reason: tried: '/usr/local/lib/libOgreMain.2.2.6.dylib' (no such file), '/usr/lib/libOgreMain.2.2.6.dylib' (no such file)Library not loaded: @rpath/libOgreMain.2.2.6.dylib
  Referenced from: /opt/homebrew/Cellar/ogre2.2/2.2.6+20211021~312bf40_1/lib/libOgreHlmsUnlit.2.2.6.dylib
  Reason: tried: '/usr/local/lib/libOgreMain.2.2.6.dylib' (no such file), '/usr/lib/libOgreMain.2.2.6.dylib' (no such file)Library not loaded: @rpath/libOgreHlmsUnlit.2.2.6.dylib
  Referenced from: /opt/homebrew/Cellar/ogre2.2/2.2.6+20211021~312bf40_1/lib/libOgreOverlay.2.2.6.dylib
  Reason: tried: '/usr/local/lib/libOgreHlmsUnlit.2.2.6.dylib' (no such file), '/usr/lib/libOgreHlmsUnlit.2.2.6.dylib' (no such file)
[GUI] [Err] [RenderEngineManager.cc:470] Failed to load plugin [ignition-rendering-ogre2] : couldn't load library on path [/Users/station1/workspace/install/lib/ign-rendering-7/engine-plugins/libignition-rendering-ogre2.dylib].
[GUI] [Msg] Loading plugin [ignition-rendering-ogre2]
Error while loading the library [/Users/station1/workspace/install/lib/ign-rendering-7/engine-plugins/libignition-rendering-ogre2.dylib]: dlopen(/Users/station1/workspace/install/lib/ign-rendering-7/engine-plugins/libignition-rendering-ogre2.dylib, 0x0005): Library not loaded: @rpath/libOgreMain.2.2.6.dylib
  Referenced from: /opt/homebrew/Cellar/ogre2.2/2.2.6+20211021~312bf40_1/lib/libOgreHlmsPbs.2.2.6.dylib
  Reason: tried: '/usr/local/lib/libOgreMain.2.2.6.dylib' (no such file), '/usr/lib/libOgreMain.2.2.6.dylib' (no such file)Library not loaded: @rpath/libOgreMain.2.2.6.dylib
  Referenced from: /opt/homebrew/Cellar/ogre2.2/2.2.6+20211021~312bf40_1/lib/libOgreHlmsUnlit.2.2.6.dylib
  Reason: tried: '/usr/local/lib/libOgreMain.2.2.6.dylib' (no such file), '/usr/lib/libOgreMain.2.2.6.dylib' (no such file)Library not loaded: @rpath/libOgreHlmsUnlit.2.2.6.dylib
  Referenced from: /opt/homebrew/Cellar/ogre2.2/2.2.6+20211021~312bf40_1/lib/libOgreOverlay.2.2.6.dylib
  Reason: tried: '/usr/local/lib/libOgreHlmsUnlit.2.2.6.dylib' (no such file), '/usr/lib/libOgreHlmsUnlit.2.2.6.dylib' (no such file)
[GUI] [Err] [RenderEngineManager.cc:470] Failed to load plugin [ignition-rendering-ogre2] : couldn't load library on path [/Users/station1/workspace/install/lib/ign-rendering-7/engine-plugins/libignition-rendering-ogre2.dylib].
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
[GUI] [Wrn] [Application.cc:811] [QT] file::/Gazebo/GazeboDrawer.qml:147:3: QML Dialog: Binding loop detected for property "implicitHeight"
Screen Shot 2022-05-26 at 4 58 53 PM
Kakcalu13 commented 2 years ago

export OGRE2_RESOURCE_PATH=/opt/homebrew/opt/ogre2.2/lib/OGRE-2.2/OGRE Doesn't do the trick

srmainwaring commented 2 years ago

Apparently, I have qt6! I unlinked it and it worked!!! No more errors. It was qt6 all the time!

Great! Getting there.

Looks like a library search path problem. If you've used the MACOSX_RPATH flags when building, i.e. something like:

$ colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_MACOSX_RPATH=FALSE -DCMAKE_INSTALL_NAME_DIR=$(pwd)/install/lib

then in addition to sourcing the ~/gz_ws/install/setup.zsh you may need to set some additional environment variables. I keep them in a script called set_gz_env.sh (update paths for M1 brew installation, build folder etc.):

#--------------------------------------------------------------------------
# Usage
# 
# $ source ./set_gz_env.sh
# 

#--------------------------------------------------------------------------
# set environment for Dart and Qt: https://ignitionrobotics.org/docs/fortress/install_osx_src

# dartsim@6.10.0
export CMAKE_PREFIX_PATH=/usr/local/opt/dartsim@6.10.0:${CMAKE_PREFIX_PATH}
export DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH}:/usr/local/opt/dartsim@6.10.0/lib:/usr/local/opt/octomap/local
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/local/opt/dartsim@6.10.0/lib/pkgconfig

# qt5
export CMAKE_PREFIX_PATH=/usr/local/opt/qt@5:${CMAKE_PREFIX_PATH}

#--------------------------------------------------------------------------
# Set Ogre environment variables

unset OGRE_RESOURCE_PATH
export OGRE_RESOURCE_PATH=/usr/local/opt/ogre1.9/lib/OGRE

unset OGRE2_RESOURCE_PATH
export OGRE2_RESOURCE_PATH=/usr/local/opt/ogre2.2/lib/OGRE-2.2/OGRE

#--------------------------------------------------------------------------
# Set Ignition environment variables

# Set the render emgine to use when running tests with 'make test'
export RENDER_ENGINE_VALUES=ogre2

# used by ros_ign
export IGNITION_VERSION=garden

# ignition-transport
# if set to 1 this displays all transport messages
export IGN_VERBOSE=0
export IGN_IP=127.0.0.1

export IGN_CONFIG_PATH=\
$HOME/Code/osrf/gz_garden_ws/install/share/ignition

#--------------------------------------------------------------------------
# Use brew version of ruby to avoid SIP issues
export PATH=/usr/local/opt/ruby/bin:$PATH
Kakcalu13 commented 2 years ago
$ colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_MACOSX_RPATH=FALSE -DCMAKE_INSTALL_NAME_DIR=$(pwd)/install/lib

Yeah, I used that one.

I've updated the set_gz_env.sh to m1

#--------------------------------------------------------------------------
# Usage
# 
# $ source ./set_gz_env.sh
# 

#--------------------------------------------------------------------------
# set environment for Dart and Qt: https://ignitionrobotics.org/docs/fortress/install_osx_src

# dartsim@6.10.0
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/opt/homebrew/opt/dartsim@5

export DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH}:/opt/homebrew/opt/dartsim@6.10.0/lib:/opt/homebrew/opt/octomap/

export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/opt/homebrew/opt/dartsim@6.10.0/lib/pkgconfig

export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/opt/homebrew/opt/dartsim@6.10.0/lib/pkgconfig

# qt5
export CMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@5:${CMAKE_PREFIX_PATH}

#--------------------------------------------------------------------------
# Set Ogre environment variables

unset OGRE_RESOURCE_PATH
export OGRE_RESOURCE_PATH=/opt/homebrew/opt/ogre1.9/lib/OGRE

unset OGRE2_RESOURCE_PATH
export OGRE2_RESOURCE_PATH=/opt/homebrew/opt/ogre2.2/lib/OGRE-2.2/OGRE

#--------------------------------------------------------------------------
# Set Ignition environment variables

# Set the render emgine to use when running tests with 'make test'
export RENDER_ENGINE_VALUES=ogre2

# used by ros_ign
export IGNITION_VERSION=garden

# ignition-transport
# if set to 1 this displays all transport messages
export IGN_VERBOSE=0
export IGN_IP=127.0.0.1

export IGN_CONFIG_PATH=\
$HOME/Code/osrf/gz_garden_ws/install/share/ignition

#--------------------------------------------------------------------------
# Use brew version of ruby to avoid SIP issues
export PATH=/opt/homebrew/opt/ruby/bin:$PATH

and deleted build/ log/ install/ then re-run it. Looks like it doesn't fix the ogre issue :(

srmainwaring commented 2 years ago

Hmm. On an intel mac I install my own build of ogre2 into /usr/local/Cellar/ogre2.2/2.2.6 and we find libOgreMain at /usr/local/Cellar/ogre2.2/2.2.6/lib/libOgreMain.2.2.6.dylib and symbolically linked internally at /usr/local/Cellar/ogre2.2/2.2.6/lib/OGRE-2.2/libOgreMain.dylib and when installed (with brew link) also at /usr/local/lib/libOgreMain.2.2.6.dylib.

Are the libraries installed into the corresponding placed on an M1, and are all these locations available in the DYLD load path (including the one at /opt/homebrew/lib)?

Kakcalu13 commented 2 years ago

Yeah, it's the correct path. See here

Screen Shot 2022-05-27 at 8 28 44 AM

M1 and Intel are different but it's easier to remember once you replace with /usr/local with /opt/homebrew/

BTW I wonder if RENDER_ENGINE_VALUES should be ogre2 instead of ogre2 metal?

Kakcalu13 commented 2 years ago

Silly question, but which directory do you export for libignition-rendering-ogre2.dylib from your computer?

srmainwaring commented 2 years ago

@Kakcalu13 I can help you at last with running Gazebo on a M1 mac as I've upgraded my ageing MacBookPro to a newer model. After some tweaking of build settings I have Gazebo Garden running natively on my M1. Both Gazebo and ogre2.2 are built from source (custom build in the case of ogre2.2)

I initially used the osrf/simulation ogre2.2.rb patch provided by @iche033. Everything built ok, and I was able to get the examples in gz-rendering running, but kept seeing the issue you raised with libOgreMain not being found when trying to run the gz-sim gui. In the end I added the same build flags to disable the RPATH and set the install directory for ogre as I am using for the gz libs. Below is an excerpt from my build script with the cmake config.

# set up variables
    name=ogre2.2
    version=2.2.6
    prefix=/opt/homebrew/Cellar/${name}/${version}

# configure
    cmake .. \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DOGRE_GLSUPPORT_USE_GLX:BOOL=FALSE \
        -DOGRE_BUILD_LIBS_AS_FRAMEWORKS:BOOL=FALSE \
        -DOGRE_FULL_RPATH:BOOL=FALSE \
        -DOGRE_BUILD_RENDERSYSTEM_GL3PLUS:BOOL=TRUE \
        -DOGRE_BUILD_SAMPLES2:BOOL=TRUE \
        -DOGRE_BUILD_SAMPLES_AS_BUNDLES:BOOL=FALSE \
        -DOGRE_BUILD_TESTS:BOOL=TRUE \
        -DOGRE_BUILD_TOOLS:BOOL=TRUE \
        -DOGRE_INSTALL_SAMPLES:BOOL=TRUE \
        -DOGRE_INSTALL_TOOLS:BOOL=TRUE \
        -DOGRE_PLUGIN_LIB_PREFIX='' \
        -DCMAKE_CXX_STANDARD=11 \
        -DCMAKE_CXX_FLAGS='-I/opt/homebrew/include -F/Library/Frameworks -Wno-deprecated-copy -Wno-gnu-inline-cpp-without-extern -Wno-deprecated-declarations -Wno-missing-braces -Wno-unused-variable -Wno-cast-qual -Wno-constant-conversion -Wno-unused-private-field -Wno-unused-command-line-argument' \
        -DOGRE_LIB_DIRECTORY=lib/OGRE-2.2 \
        -DCMAKE_INSTALL_PREFIX=$prefix \
        -DCMAKE_FIND_FRAMEWORK=LAST \
        -DCMAKE_VERBOSE_MAKEFILE=OFF \
        -DCMAKE_MACOSX_RPATH:BOOL=FALSE \
        -DCMAKE_INSTALL_NAME_DIR=$prefix/lib

The last two flags -DCMAKE_MACOSX_RPATH:BOOL=FALSE and -DCMAKE_INSTALL_NAME_DIR=$prefix/lib seem to make the difference. I have not disabled SIP.

@jasonbyun8 and @iche033 I'd be interested to understand what you did differently to get Gazebo running on your M1 machines using a brew installed version of ogre2.2.

My installation is still a little rough around the edges; there are some segmentation faults on exit and not all the examples are running (however sensors_demo.sdf is).

Kakcalu13 commented 2 years ago

@Kakcalu13 I can help you at last with running Gazebo on a M1 mac as I've upgraded my ageing MacBookPro to a newer model. After some tweaking of build settings I have Gazebo Garden running natively on my M1.

🤩 Welcome to the M1 gang!

Below is an excerpt from my build script with the cmake config.

# set up variables
    name=ogre2.2
    version=2.2.6
    prefix=/opt/homebrew/Cellar/${name}/${version}

# configure
    cmake .. \
        -DCMAKE_BUILD_TYPE=RelWithDebInfo \
        -DOGRE_GLSUPPORT_USE_GLX:BOOL=FALSE \
        -DOGRE_BUILD_LIBS_AS_FRAMEWORKS:BOOL=FALSE \
        -DOGRE_FULL_RPATH:BOOL=FALSE \
        -DOGRE_BUILD_RENDERSYSTEM_GL3PLUS:BOOL=TRUE \
        -DOGRE_BUILD_SAMPLES2:BOOL=TRUE \
        -DOGRE_BUILD_SAMPLES_AS_BUNDLES:BOOL=FALSE \
        -DOGRE_BUILD_TESTS:BOOL=TRUE \
        -DOGRE_BUILD_TOOLS:BOOL=TRUE \
        -DOGRE_INSTALL_SAMPLES:BOOL=TRUE \
        -DOGRE_INSTALL_TOOLS:BOOL=TRUE \
        -DOGRE_PLUGIN_LIB_PREFIX='' \
        -DCMAKE_CXX_STANDARD=11 \
        -DCMAKE_CXX_FLAGS='-I/opt/homebrew/include -F/Library/Frameworks -Wno-deprecated-copy -Wno-gnu-inline-cpp-without-extern -Wno-deprecated-declarations -Wno-missing-braces -Wno-unused-variable -Wno-cast-qual -Wno-constant-conversion -Wno-unused-private-field -Wno-unused-command-line-argument' \
        -DOGRE_LIB_DIRECTORY=lib/OGRE-2.2 \
        -DCMAKE_INSTALL_PREFIX=$prefix \
        -DCMAKE_FIND_FRAMEWORK=LAST \
        -DCMAKE_VERBOSE_MAKEFILE=OFF \
        -DCMAKE_MACOSX_RPATH:BOOL=FALSE \
        -DCMAKE_INSTALL_NAME_DIR=$prefix/lib

The last two flags -DCMAKE_MACOSX_RPATH:BOOL=FALSE and -DCMAKE_INSTALL_NAME_DIR=$prefix/lib seem to make the difference. I have not disabled SIP.

Is this for set_gz_env.sh on the first part? Did you use set_gz_env.sh at all during your installment on your M1? What are the steps exactly on your end?

I've been using gazebo on docker on M1. I'd like to have to run Gazebo natively one day! Still hasn't gotten it

srmainwaring commented 2 years ago

Is this for set_gz_env.sh on the first part? Did you use set_gz_env.sh at all during your installment on your M1?

The script sets up a number of environment variables. They could go in .zprofile but I prefer to keep them separate so I can switching between different development builds. It's not used during the installation, just for running.

We could add a 'getting started on M1 macs' entry on the Gazebo Community project pages, provided we can come back to edit the top entry to keep it current.

I'd like to have to run Gazebo natively one day! Still hasn't gotten it

I expect that you are very close, and it's probably just the library search path (i.e. rpath issues) that is causing problems if you have the libraries compiling.

I've been using gazebo on docker on M1.

Would be interested to know more about your set up, would you mind documenting your environment? (which VM you're running, any config tips and tricks). Did you manage to get hardware acceleration running? Perhaps another good topic for the community pages as we're getting a little off topic for this thread.

Kakcalu13 commented 2 years ago

Would be interested to know more about your set up, would you mind documenting your environment? (which VM you're running, any config tips and tricks). Did you manage to get hardware acceleration running? Perhaps another good topic for the community pages as we're getting a little off topic for this thread.

I'm more than happy to share about docker on M1. You just need to use ARM platform, apparently. I can share the Dockerfiles if interested. I made the Dockerfile for FEAGI which is also an open source.

I just used the latest docker, see here:

Screen Shot 2022-07-05 at 9 04 04 AM

I used arm64 platform. This is all you need to install Gazebo Citadel on M1 using docker. I've tested Citadel only though

iche033 commented 2 years ago

@jasonbyun8 and @iche033 I'd be interested to understand what you did differently to get Gazebo running on your M1 machines using a brew installed version of ogre2.2.

hmm I just tried rebuilding everything with the latest branches and seems to be working ok. I didn't have to set these two flags though: -DCMAKE_MACOSX_RPATH:BOOL=FALSE, -DCMAKE_INSTALL_NAME_DIR=$prefix/lib.

my ogre2.2 is built with the patch from my PR, https://github.com/osrf/homebrew-simulation/pull/1823, and also setting -DCMAKE_MACOSX_RPATH=FALSE.

here's my colcon build cmd:

colcon build --cmake-args -DBUILD_TESTING=OFF -DCMAKE_MACOSX_RPATH=FALSE -DCMAKE_INSTALL_NAME_DIR=$(pwd)/install/lib  --merge-install --packages-up-to gz-sim7 --cmake-clean-cache
Kakcalu13 commented 2 years ago

I start all over and just do few commands:

mkdir -p workspace_new/src && cd workspace_new/src
wget https://raw.githubusercontent.com/ignition-tooling/gazebodistro/master/collection-garden.yaml
vcs import < collection-garden.yaml
cd ..
colcon build --cmake-args -DBUILD_TESTING=OFF -DCMAKE_MACOSX_RPATH=FALSE -DCMAKE_INSTALL_NAME_DIR=$(pwd)/install/lib  --merge-install --packages-up-to gz-sim7 --cmake-clean-cache

gui7 returns error but this seems a lot better than before though. If I remember right, I had like 6 unprocessed but now this time, it's just 3

Error below:

Finished <<< gz-rendering7 [2min 58s]
Starting >>> gz-gui7
--- stderr: gz-gui7                          
CMake Deprecation Warning at /Users/station1/feagi/docker/ign-gazebo/install/share/cmake/gz-cmake3/cmake3/GzUtils.cmake:222 (message):
  Ign prefixed package name [IgnProtobuf] is deprecated! Automatically using
  the Gz prefix instead: [GzProtobuf]
Call Stack (most recent call first):
  CMakeLists.txt:36 (gz_find_package)

CMake Warning at /Users/station1/feagi/docker/ign-gazebo/install/share/cmake/gz-cmake3/cmake3/GzUtils.cmake:231 (find_package):
  By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "Qt5", but
  CMake did not find one.

  Could not find a package configuration file provided by "Qt5" with any of
  the following names:

    Qt5Config.cmake
    qt5-config.cmake

  Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
  to a directory containing one of the above files.  If "Qt5" provides a
  separate development package or SDK, be sure it has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:86 (gz_find_package)

CMake Error at /Users/station1/feagi/docker/ign-gazebo/install/share/cmake/gz-cmake3/cmake3/GzConfigureBuild.cmake:73 (message):
  -- BUILD ERRORS: These must be resolved before compiling.
Call Stack (most recent call first):
  CMakeLists.txt:103 (gz_configure_build)

CMake Error at /Users/station1/feagi/docker/ign-gazebo/install/share/cmake/gz-cmake3/cmake3/GzConfigureBuild.cmake:75 (message):
  --    Missing dependency [Qt5] (Components: Core, Quick, QuickControls2,
  Widgets)
Call Stack (most recent call first):
  CMakeLists.txt:103 (gz_configure_build)

CMake Error at /Users/station1/feagi/docker/ign-gazebo/install/share/cmake/gz-cmake3/cmake3/GzConfigureBuild.cmake:77 (message):
  -- END BUILD ERRORS

Call Stack (most recent call first):
  CMakeLists.txt:103 (gz_configure_build)

CMake Error at /Users/station1/feagi/docker/ign-gazebo/install/share/cmake/gz-cmake3/cmake3/GzConfigureBuild.cmake:82 (message):
  Errors encountered in build.  Please see BUILD ERRORS above.
Call Stack (most recent call first):
  CMakeLists.txt:103 (gz_configure_build)

---
Failed   <<< gz-gui7 [1.03s, exited with code 1]
Aborted  <<< sdformat13 [3min 18s]                                           

Summary: 10 packages finished [4min 47s]
  1 package failed: gz-gui7
  1 package aborted: sdformat13
  12 packages had stderr output: gz-cmake3 gz-common5 gz-fuel_tools8 gz-gui7 gz-math7 gz-msgs9 gz-plugin2 gz-rendering7 gz-tools2 gz-transport12 gz-utils2 sdformat13
  3 packages not processed

This error looks familiar but then I remember we discussed about qt5 and qt6. Check if I have qt6

brew info qt

which I do again. So I unlink qt6

brew unlink qt

So I tried again by export qt5

export CMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@5:${CMAKE_PREFIX_PATH}
colcon build --cmake-args -DBUILD_TESTING=OFF -DCMAKE_MACOSX_RPATH=FALSE -DCMAKE_INSTALL_NAME_DIR=$(pwd)/install/lib  --merge-install --packages-up-to gz-sim7 --cmake-clean-cache

And it completed without any issue!

So I export all important parts like this,

export PATH=/usr/local/opt/ruby/bin:$PATH
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/opt/homebrew/opt/dartsim@5
unset OGRE_RESOURCE_PATH
export OGRE_RESOURCE_PATH=/usr/local/opt/ogre1.9/lib/OGRE

unset OGRE2_RESOURCE_PATH
export OGRE2_RESOURCE_PATH=/usr/local/opt/ogre2.2/lib/OGRE-2.2/OGRE
unset OGRE_RESOURCE_PATH
export OGRE_RESOURCE_PATH=/usr/local/opt/ogre1.9/lib/OGRE

unset OGRE2_RESOURCE_PATH
export OGRE2_RESOURCE_PATH=/usr/local/opt/ogre2.2/lib/OGRE-2.2/OGRE

The result is this:

Screen Shot 2022-07-12 at 9 13 46 AM

Why isn't export dart working? Do you see something off or missing on my end?

srmainwaring commented 2 years ago

Why isn't export dart working

From https://gazebosim.org/docs/garden/install_osx_src#source-installation-on-macos, you also need:

# dartsim@6.10.0
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/usr/local/opt/dartsim@6.10.0
export DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH}:/usr/local/opt/dartsim@6.10.0/lib:/usr/local/opt/octomap/local
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/local/opt/dartsim@6.10.0/lib/pkgconfig

Although I think that DYLD_FALLBACK_LIBRARY_PATH is ignored if you have SIP enabled.

Kakcalu13 commented 2 years ago

Before I start with colcon build, I took the set_gz_env.sh which has that:

# dartsim@6.10.0
export CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}:/opt/homebrew/opt/dartsim@5

export DYLD_FALLBACK_LIBRARY_PATH=${DYLD_FALLBACK_LIBRARY_PATH}:/opt/homebrew/opt/dartsim@6.10.0/lib:/opt/homebrew/opt/octomap/

export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/opt/homebrew/opt/dartsim@6.10.0/lib/pkgconfig

export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/opt/homebrew/opt/dartsim@6.10.0/lib/pkgconfig

I tried again using that prior to run colcon after delete install, log, and build folders. I ran colcon build --merge-install (I got it from the tutorial link you mentioned)

now it's giving me a different error

station1@Station1s-Mini workspace_new % ign gazebo -s                                                                                                                  
The `gazebo` verb is deprecated. Please use `sim` instead.
Library error for [/Users/station1/workspace_new/install/lib/libgz-sim7-gz.7.0.0~pre1.dylib]: dlopen(/Users/station1/workspace_new/install/lib/libgz-sim7-gz.7.0.0~pre1.dylib, 0x0009): Library not loaded: @rpath/libgz-sim7-gui.7.dylib
  Referenced from: /Users/station1/workspace_new/install/lib/libgz-sim7-gz.7.0.0~pre1.dylib
  Reason: tried: '/usr/local/lib/libgz-sim7-gui.7.dylib' (no such file), '/usr/lib/libgz-sim7-gui.7.dylib' (no such file)

If this script was executed with /usr/bin/ruby, this error may be caused by
macOS System Integrity Protection. One workaround is to use a different
version of ruby, for example:
    brew install ruby
and add the following line to your shell profile:
    export PATH=/usr/local/opt/ruby/bin:$PATH
If you are using a colcon workspace, please ensure that the setup script
has properly set the DYLD_LIBRARY_PATH environment variables.

I noticed it tried to run Mac intel path like this: Reason: tried: '/usr/local/lib/libgz-sim7-gui.7.dylib'

The error is from the ign gazebo -s but M1 doesn't use /usr/local/

I checked my set_gz_env.sh, it doesn't say anything about /usr/local

What is it that I missed the step? What is your full steps? Assuming my M1 is a brand new