Error installing nokogumbo 2.0.5 in Mac M1 - ruby

I'm trying to install nokogumbo in my project using 'gem install nokogumbo' or 'bundle install' but i always get this error
Installing nokogumbo 2.0.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/Users/rafaelpolonio/.rvm/gems/ruby-2.7.6/gems/nokogumbo-2.0.5/ext/nokogumbo
/Users/rafaelpolonio/.rvm/rubies/ruby-2.7.6/bin/ruby -I
/Users/rafaelpolonio/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0 extconf.rb
checking for whether
-I/Users/rafaelpolonio/.rvm/rubies/ruby-2.7.6/lib/ruby/gems/2.7.0/gems/nokogiri-1.13.9-arm64-darwin/ext/nokogiri
is accepted as CFLAGS... yes
checking for whether
-I/Users/rafaelpolonio/.rvm/rubies/ruby-2.7.6/lib/ruby/gems/2.7.0/gems/nokogiri-1.13.9-arm64-darwin/ext/nokogiri/include
is accepted as CFLAGS... yes
checking for whether
1 warning generated.
compiling ./../../gumbo-parser/src/tag.c
compiling ./../../gumbo-parser/src/parser.c
./../../gumbo-parser/src/parser.c:540:10: warning: cast to smaller integer type
'GumboInsertionMode' from 'void *' [-Wvoid-pointer-to-enum-cast]
return (GumboInsertionMode) modes->data[(modes->length - 1)];
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
linking shared-object nokogumbo/nokogumbo.bundle
Undefined symbols for architecture arm64:
"_Nokogiri_wrap_xml_document", referenced from:
_parse_continue in nokogumbo.o
"_cNokogiriXmlSyntaxError", referenced from:
_add_errors in nokogumbo.o
"_htmlNewDocNoDtD", referenced from:
_parse_continue in nokogumbo.o
"_mNokogiri", referenced from:
_Init_nokogumbo in nokogumbo.o
"_xmlAddChild", referenced from:
_build_tree in nokogumbo.o
"_xmlCreateIntSubset", referenced from:
_parse_continue in nokogumbo.o
"_xmlFreeDoc", referenced from:
_parse_cleanup in nokogumbo.o
"_xmlNewCDataBlock", referenced from:
_build_tree in nokogumbo.o
"_xmlNewDocComment", referenced from:
_build_tree in nokogumbo.o
"_xmlNewDocNode", referenced from:
_build_tree in nokogumbo.o
"_xmlNewDocText", referenced from:
_build_tree in nokogumbo.o
"_xmlNewNs", referenced from:
_build_tree in nokogumbo.o
"_xmlNewNsProp", referenced from:
_build_tree in nokogumbo.o
"_xmlSearchNs", referenced from:
_build_tree in nokogumbo.o
"_xmlSetNs", referenced from:
_build_tree in nokogumbo.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [nokogumbo.bundle] Error 1
My nokogiri is 1.10.0 in my Gemfile.lock
I already tried to install in different ways, upgrate the nokogiri to 1.13.9
How can I solve this problem?

Related

Error when trying to build app in Xcode - "Undefined symbols for architecture x86_64"

Trying to build my Kivy app in Xcode. Below are the code/snapshot of the specific errors:
Undefined symbols for architecture x86_64:
"_ffi_tramp_alloc", referenced from:
_ffi_closure_alloc in libffi.a(closures.o)
"_ffi_tramp_free", referenced from:
_ffi_closure_free in libffi.a(closures.o)
"_ffi_tramp_get_addr", referenced from:
_ffi_closure_alloc in libffi.a(closures.o)
_ffi_data_to_code_pointer in libffi.a(closures.o)
"_ffi_tramp_is_supported", referenced from:
_ffi_closure_alloc in libffi.a(closures.o)
_ffi_data_to_code_pointer in libffi.a(closures.o)
_ffi_closure_free in libffi.a(closures.o)
_ffi_tramp_is_present in libffi.a(closures.o)
_dlmmap in libffi.a(closures.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Cross compilation cgo project from Mac x86 for M1

I am trying to cross compile go app which is written in C, Objective-C, and Go.
It works fine on Mac x86, and I am trying to use the cross-compile it for M1.
So simply ran
GOARCH=arm64 /usr/bin/go build -o "~/Example/project/obj/mac-arm64/dummy" -gcflags "-N -l" -ldflags "-w" -race dummy
CC version:
joshiga#joshiga-a01 bin % /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --version
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
CXX version:
joshiga#joshiga-a01 bin % /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ --version
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
$ go version
go version go1.16.9 darwin/amd64
$ go env
GOARCH=arm64
GOOS=darwin
'GOROOT': '/Users/joshiga/ws/dev/main/bora/build/package/COMPONENTS/cayman_go/sb-51450161/macosx-catalina/apple_mac64', 'GODEBUG': 'cgocheck=2', 'GOARCH': 'amd64', 'CGO_ENABLED': '1', ''GO111MODULE': 'off'
I was expecting it to successfully crosscompile and create a binary for ARM. Please
note for x86 Mac it works fine.
joshiga#joshiga-a01 bin % uname -a
Darwin joshiga-a01.vmware.com 20.6.0 Darwin Kernel Version 20.6.0: Tue Oct 12 18:33:42 PDT 2021; root:xnu-7195.141.8~1/RELEASE_X86_64 x86_64
But the got the below error:
Undefined symbols for architecture arm64:
"___tsan_acquire", referenced from:
_runtime.raceacquireg in go.o
_runtime.raceacquirectx in go.o
"___tsan_finalizer_goroutine", referenced from:
_runtime.runfinq in go.o
"___tsan_fini", referenced from:
_runtime.racefini in go.o
"___tsan_free", referenced from:
_runtime.(*mspan).sweep in go.o
"___tsan_func_enter", referenced from:
_racefuncenter in go.o
"___tsan_func_exit", referenced from:
_runtime.racefuncexit in go.o
"___tsan_go_atomic32_compare_exchange", referenced from:
_sync/atomic.CompareAndSwapInt32 in go.o
"___tsan_go_atomic32_fetch_add", referenced from:
_sync/atomic.AddInt32 in go.o
"___tsan_go_atomic32_load", referenced from:
_sync/atomic.LoadInt32 in go.o
"___tsan_go_atomic32_store", referenced from:
_sync/atomic.StoreInt32 in go.o
"___tsan_go_atomic64_compare_exchange", referenced from:
_sync/atomic.CompareAndSwapInt64 in go.o
"___tsan_go_atomic64_fetch_add", referenced from:
_sync/atomic.AddInt64 in go.o
"___tsan_go_atomic64_load", referenced from:
_sync/atomic.LoadInt64 in go.o
"___tsan_go_atomic64_store", referenced from:
_sync/atomic.StoreInt64 in go.o
"___tsan_go_end", referenced from:
_runtime.goexit1 in go.o
_runtime.(*p).destroy in go.o
"___tsan_go_ignore_sync_begin", referenced from:
_runtime.RaceDisable in go.o
_racecallatomic in go.o
"___tsan_go_ignore_sync_end", referenced from:
_runtime.RaceEnable in go.o
_racecallatomic in go.o
"___tsan_go_start", referenced from:
_runtime.racegostart in go.o
"___tsan_init", referenced from:
_runtime.raceinit in go.o
"___tsan_malloc", referenced from:
_runtime.mallocgc in go.o
_runtime.gfget in go.o
_runtime.stackalloc in go.o
"___tsan_map_shadow", referenced from:
_runtime.raceinit in go.o
_runtime.racemapshadow in go.o
"___tsan_proc_create", referenced from:
_runtime.(*p).init in go.o
"___tsan_proc_destroy", referenced from:
_runtime.(*p).destroy in go.o
"___tsan_read", referenced from:
_runtime.raceread in go.o
"___tsan_read_pc", referenced from:
_runtime.racereadpc in go.o
"___tsan_read_range", referenced from:
_runtime.racereadrange in go.o
_runtime.racereadrangepc1 in go.o
"___tsan_release", referenced from:
_runtime.racereleaseg in go.o
"___tsan_release_acquire", referenced from:
_runtime.racereleaseacquireg in go.o
"___tsan_release_merge", referenced from:
_runtime.racereleasemergeg in go.o
"___tsan_write", referenced from:
_runtime.racewrite in go.o
"___tsan_write_pc", referenced from:
_runtime.racewritepc in go.o
"___tsan_write_range", referenced from:
_runtime.racewriterange in go.o
_runtime.racewriterangepc1 in go.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any ideas or suggestions what I could be doing wrong?

libSDL, CMake and Mac OS X lion 2

I'm trying to compile a cmake project on my mac, but it depends on the SDL.
I have alreaday read "LibSDL, CMake and MacOSX Lion", however I couldn't solve this problem.
CMakeList.txt
cmake_minimum_required(VERSION 2.6.4 FATAL_ERROR)
# Give a name to the project.
project(movehead)
# This include enable you to use our CMake framework
find_package(qibuild)
find_package(SDL REQUIRED)
link_directories( /usr/local/lib )
link_libraries (
${SDL_LIBRARY}
SDLmain
)
# Create an executable named movehead,
# with the source file : movehead.cpp
qi_create_bin(movehead movehead.cpp)
# Tell CMake that movehead depends on ALCOMMON.
# This will set the libraries to link movehead with,
# the include paths, and so on
qi_use_lib(movehead ALCOMMON)
Commandline
sudo qibuild make -c naoqi-sdk movehead Active configuration: naoqi-sdk (Debug)
Building movehead in naoqi-sdk (Debug)
Scanning dependencies of target movehead
Linking CXX executable sdk/bin/movehead
ld: warning: ignoring file /usr/local/lib/libSDLmain.a, file was built for archive which is not the architecture being linked (i386)
ld: warning: ignoring file /usr/local/lib/libSDL.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_main", referenced from:
start in crt1.10.6.o
(maybe you meant: _SDL_main)
"_SDL_Init", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_NumJoysticks", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_JoystickEventState", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_JoystickOpen", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_JoystickName", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_JoystickNumAxes", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_PollEvent", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_JoystickGetButton", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_JoystickGetAxis", referenced from:
_SDL_main in movehead.cpp.o
"_SDL_QuitSubSystem", referenced from:
_SDL_main in movehead.cpp.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [sdk/bin/movehead] Error 1
make[1]: *** [CMakeFiles/movehead.dir/all] Error 2
make: *** [all] Error 2
[ERROR]
Error occured when building project movehead
dhcp47-122:movehead yukke150$ sudo qibuild configure -c naoqi-sdk movehead --disable-assembly
usage: qibuild [-h]
lipo -info /usr/local/lib/libSDL.dylib
Non-fat file: /usr/local/lib/libSDL.dylib is architecture: x86_64
lipo -info /usr/local/lib/libSDLmain.a
input file /usr/local/lib/libSDLmain.a is not a fat file
Non-fat file: /usr/local/lib/libSDLmain.a is architecture: x86_64
I think these file are x86_64.
How to fix?
Use the framework distribution of SDL (provided on SDL website) work for me to compile in either x86 or x86_64.
Previously I installed it from brew, so if same (or Mac Port, etc) don't forget to uninstall those first.

Builderror after upgrading to xcode4.3.2 from xcode3.2

We have upgraded our xcode to 4.3 recently.
I am into testing, I need to duplicate target file and integrate FoneMonkey files and execute the target.
I did below changes to orginal target to get it executed successfully:
updated framework serch paths
"$(DEVELOPER_FRAMEWORKS_DIR)"
"$(SRCROOT)/../../Developer/Library/Frameworks"
"$(SRCROOT)"
updated Library search paths
"$(DEVELOPER_FRAMEWORKS_DIR)"
"$(SRCROOT)/../../Developer/Library/Frameworks"
"$(SRCROOT)"
"/users/ezprintsqa/FoneMonkey/lib"
executed below command
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Now build gets executed successfully.
But the duplicate target with Fonemonkey files added gives below errors:
Ld "/Users/ezprintsqa/Library/Developer/Xcode/DerivedData/SnapCards-dtjqrhfvqueyhrbbgjgydberyqdm/Build/Products/Debug-iphonesimulator/SnapCards copy.app/SnapCards copy" normal i386
cd /Users/ezprintsqa/Documents/snapcards
setenv MACOSX_DEPLOYMENT_TARGET 10.6
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk -L/Users/ezprintsqa/Library/Developer/Xcode/DerivedData/SnapCards-dtjqrhfvqueyhrbbgjgydberyqdm/Build/Products/Debug-iphonesimulator -L/Applications/Xcode.app/Contents/Developer/Library/Frameworks -L/Applications/Xcode.app/Contents/Developer/Library/Frameworks/CPlusTest.framework -L/Applications/Xcode.app/Contents/Developer/Library/Frameworks/DTPerformanceSession.framework -L/Applications/Xcode.app/Contents/Developer/Library/Frameworks/InterfaceBuilderKit.framework -L/
.
.
ld: warning: directory not found for option '-L/Users/ezprintsqa/Documents/snapcards/../../Developer/Library/Frameworks'
ld: warning: directory not found for option '-F/Users/ezprintsqa/Documents/snapcards/../../Developer/Library/Frameworks'
Undefined symbols for architecture i386:
"_SCNetworkReachabilitySetCallback", referenced from:
-[Reachability startNotifier] in Reachability.o
"_SCNetworkReachabilityScheduleWithRunLoop", referenced from:
-[Reachability startNotifier] in Reachability.o
"_SCNetworkReachabilityUnscheduleFromRunLoop", referenced from:
-[Reachability stopNotifier] in Reachability.o
"_SCNetworkReachabilityCreateWithName", referenced from:
+[Reachability reachabilityWithHostName:] in Reachability.o
"_SCNetworkReachabilityCreateWithAddress", referenced from:
+[Reachability reachabilityWithAddress:] in Reachability.o
"_SCNetworkReachabilityGetFlags", referenced from:
-[Reachability currentReachabilityStatus] in Reachability.o
-[Reachability isReachable] in Reachability.o
-[Reachability isConnectionRequired] in Reachability.o
-[Reachability isConnectionOnDemand] in Reachability.o
-[Reachability isInterventionRequired] in Reachability.o
-[Reachability isReachableViaWWAN] in Reachability.o
-[Reachability isReachableViaWiFi] in Reachability.o
...
"_OBJC_CLASS_$_SenTestSuite", referenced from:
objc-class-ref in libFoneMonkeyOCUnit.5.5b.a(FoneMonkey+OCUnit.o)
"_OBJC_CLASS_$_SenTestObserver", referenced from:
objc-class-ref in libFoneMonkeyOCUnit.5.5b.a(FoneMonkey+OCUnit.o)
"_OBJC_CLASS_$_SenTestLog", referenced from:
objc-class-ref in libFoneMonkeyOCUnit.5.5b.a(FoneMonkey+OCUnit.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can some one please help me with below issues:
The folder /Users/ezprintsqa/Library/Developer/ is not available now after upgrading to 4.3, but here this path is being configured (how can i change this)?
The _objc_class issues.
Thanks in Advance.
By removing SenTesting.framework from Xcode the issue was solved.

Compiling C/C++ application using SDL in OS X, linking problem

I'm trying to compile a C/C++ program that uses SDL on a OS X 10.6.8 but I'm having some errors on the linking stage, the code compiles but fails to like due to some missing symbols. The error is:
Undefined symbols for architecture x86_64:
"_CFBundleGetMainBundle", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
_main in libSDLmain.a(SDLMain.o)
"_CFBundleCopyBundleURL", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
"_CFURLCreateCopyDeletingLastPathComponent", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
"_CFURLGetFileSystemRepresentation", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
"_CFRelease", referenced from:
-[SDLMain setupWorkingDirectory:] in libSDLmain.a(SDLMain.o)
...
"_OBJC_CLASS_$_NSAutoreleasePool", referenced from:
objc-class-ref in libSDLmain.a(SDLMain.o)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
make: *** [dist/linwarrior] Error 1
I checked with the file command and the libraries are either x86_64 only or universal with both i386 and x86_64 versions.
Is there a way for me to determine what exactly is causing this error? A way to check the libs that are being included or any way to help debug the problem?
I don't know if it helps but this is what my Makefile creates, I removed file names to make it short, and the KNT flag is just something I'm using for preprocessor conditions:
/opt/local/bin/g++-mp-4.5 -DKNT=1 -Wp,-M,-MP,-MT,-MF, -std=c++0x -Wall -I source -O1 -funroll-loops -c -o
Thanks.

Resources