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

ios builds fail with "unrecognized asm int $3" #1127

Closed
berkus opened this issue Dec 12, 2017 · 7 comments
Closed

ios builds fail with "unrecognized asm int $3" #1127

berkus opened this issue Dec 12, 2017 · 7 comments

Comments

@berkus
Copy link
Contributor

berkus commented Dec 12, 2017

Description

error: cannot compile inline asm
:1:2: error: invalid instruction
int $3
^

Steps to reproduce

Build using Catch 2.0.1 for ios/armv7

Because not all ios devices are x86. The offending code is:

#ifdef CATCH_PLATFORM_MAC

    #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */

Direct link to the horrible mess: here

Extra information

  • Catch version: v2.0.1
  • Operating System: macOS Sierra, building for iPhoneSDK -miphone-os-min=9.0
  • Compiler+version: Apple LLVM version 9.0.0 (clang-900.0.39.2)
@avelenko
Copy link

I confirm seeing this.

@berkus
Copy link
Contributor Author

berkus commented Mar 9, 2018

It was fixed by #1084

@berkus berkus closed this as completed Mar 9, 2018
@horenmar
Copy link
Member

Good to know, thanks.

@kk-engineer
Copy link

What is the resolution?
What are the steps to resolve this issue on new M1 Mac?

@berkus
Copy link
Contributor Author

berkus commented Jan 5, 2021

@BharatiyaKaran for M1 macs I think Catch2 authors need to provide a proper inline asm. int 3 is x86-specific.

Currently it relies on platform (mac or ios) to pick the right variant, but m1 macs act more like ios in this regard by using aarch64 asm just like iphone.

@kk-engineer
Copy link

Thanks berkus: Got the resolution from some other place on internet:
Here is the correct #define for M1 Mac

//#define CATCH_TRAP() asm("int $3\n" : : ) /* NOLINT */
#define CATCH_TRAP() asm(".inst 0xd4200000")

@berkus
Copy link
Contributor Author

berkus commented Jan 6, 2021

@BharatiyaKaran I believe it should be the same as in CATCH_PLATFORM_IPHONE.

keenon added a commit to keenon/opensim-core that referenced this issue Dec 21, 2021
aymanhab pushed a commit to opensim-org/opensim-core that referenced this issue Dec 21, 2021
* * Fix inline assemble in catch.hpp dependency for ARM Macs

See original change in catchorg/Catch2#1127
aymanhab pushed a commit to opensim-org/opensim-core that referenced this issue Jan 18, 2022
* * Fix inline assemble in catch.hpp dependency for ARM Macs

See original change in catchorg/Catch2#1127
aymanhab added a commit to opensim-org/opensim-core that referenced this issue Feb 3, 2022
#3125)

* minor refactor to reduce num calls to get size of Array property

* Avoid duplicate transformation to Ground frame when computing path length

* remove_unused_variable

* Remove macros that are replaceable by Vec3 operators

* Inline usage of Macro in WrapEllipsoid

* More refactoring, use det for determinant, vec operators instead of loops, inline method CalcDistanceSquaredPointToLine

* Update continuous_integration.yml

Do not use cached dependencies built before osx upgrade on github

* Remove rather than comment out function that was moved to header and inlined.

* Update GeometryPath.cpp

Reuse variable for wrapSetSize

* Update continuous_integration.yml

Undo cache change since we verified build succeeds without it.

* Use normSqr for consistency

* Use UnitVec3 instead of Vec3 for plane normal

* Avoid tweaking tangent points of WrapCylinder when single object wrapping, allow for optimization if disableVisualization is true. Fix test cases accordingly

* Add MocoAngularVelocityTrackingGoal to bindings; add option for quaternion table in MocoOrientationTrackingGoal

* Complete fixes for setRotationReference(); update changelog

* fix load issue with scale tool  (#3110)

* fix load issue scale tool load issue if model or marker set file is given as an absolute path, and the tool was created from a setup file. update error message to better reflect possible issues.

* update CHANGELOG

* Add extendPostScale() to DeGrooteFregly2016Muscle (#3108)

* Add extendPostScale() to DeGrooteFregly2016Muscle

* Update changelog

* Update continuous_integration.yml (#3115)

* Update continuous_integration.yml

Allow fresh build on osx to use latest github Action environment

* Update continuous_integration.yml

set CMake variable for OSX_DEPLOYMENT to 11

* Update continuous_integration.yml

Restore mac osx-10.15 and target 10.10 for deployment

* Fix inline assemble in catch.hpp dependency for ARM Macs (#3118)

* * Fix inline assemble in catch.hpp dependency for ARM Macs

See original change in catchorg/Catch2#1127

* Avoid tweaking tangent points of WrapCylinder when single object wrapping, allow for optimization if disableVisualization is true. Fix test cases accordingly

* disableVisualization when creating MocoProblem for Model

* Avoid messages about missing files if visualization is off.

* fix comments per PR review

* Disable visualization for all internal models used by MccoProblem

* Fix typo/mistake in variable name

* Couple other places to disable visualization for models internal to Moco and MocoInverse

* improve comments per feedback on PR

* Use finer grain includes per PR review

* Retire Mtx::CrossProduct wrapper method for Vec3 operator

* Remove now unused methods for CrossProduct, Interpolation, Translation, Rotation of data

* Fix case for pathname of UnitVec.h

* Use norm for Mtx::Magnitude

* Remove redundant call to disableVisualization

* Remove Mtx::Angle and inline references to it.

* Replace Mtx::Normalize with Vec3.normalize

* Update standard input for testMocoInverse

This reverts commit fa4daa8.

* Minor rearrangement per feedback on PR

* Eliminate Mtx class, move remaining 2 functions to WrapMath

* Inline replace DotProduct with operator, and remove from WrapMath.h, remove unused test case

* Rename Normalize to NormalizeOrZero

* Update WrapMath.h

Test removal of zeroing output vector to bring NormalizeOrZero closer to normalize

* Remove unused methods in WrapMath class, for consistency restore all WrapMath::NormalizeOrZero instances

* Remove unused methods in WrapMath class, for consistency restore all WrapMath::NormalizeOrZero instances

* Update std again based on latest wrapping code update

* Update ModelProcessor.h

Undo disableVisualization per feedback on PR

Co-authored-by: Nicholas Bianco <nbianco@stanford.edu>
Co-authored-by: carmichaelong <carmichaelong@users.noreply.github.com>
Co-authored-by: Keenon Werling <keenonwerling@gmail.com>
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

No branches or pull requests

4 participants