Segmentation fault when compiling mysql2 with mingw - ruby-on-rails

When I try to create a Rails server this is what I get. It instantly runs over 500+ lines of code and comes back with this message. This is my first Ruby on Rails project. I am pretty new to coding as well. Would love some help if possible. Thank you!
C:/Ruby200-x64/lib/ruby/gems/2.0.0/extensions/x64-mingw32/2.0.0/mysql2-0.3.15/my
sql2/mysql2.so: [BUG] Segmentation fault
ruby 2.0.0p451 (2014-02-24) [x64-mingw32]
0 enumerator.so
1 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/encdb.so
2 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/iso_8859_1.so
3 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/trans/transdb.so
4 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/rbconfig.rb
5 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/compatibility.rb
6 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/defaults.rb
7 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/deprecate.rb
8 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/errors.rb
9 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/version.rb
10 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/requirement.rb
11 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/platform.rb
12 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/basic_specification.rb
13 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/stub_specification.rb
14 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/util/stringio.rb
15 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/specification.rb
16 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/exceptions.rb
17 C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/defaults/operating_system.rb
18 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/utf_16le.so
19 C:/Ruby200-x64/lib/ruby/2.0.0/x64-mingw32/enc/trans/utf_16_32.so
20 C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb
537 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_sup
port/core_ext/module.rb
538 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/r
ecord_identifier.rb
539 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers/record_tag_helper.rb
540 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers/rendering_helper.rb
541 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers/translation_helper.rb
542 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/actionpack-4.0.0/lib/action_view/h
elpers.rb
543 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.0.1/lib/sprocket
s/rails/helper.rb
544 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/engine/co
nfiguration.rb
545 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/applicati
on/configuration.rb
546 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sprockets-rails-2.0.1/lib/sprocket
s/railtie.rb
547 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/railties-4.0.0/lib/rails/all.rb
548 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0/lib/active_sup
port/string_inquirer.rb
549 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2/version.r
b
550 C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/mysql2-0.3.15/lib/mysql2/error.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
C:\Users\MVParker\Documents\Sites\simple_cms>

Following the answer from Dave Schweisguth, about the ruby bug, and doing the steps described by Heesob Park's comment, I could get mysql2 gem to work. Thank you guys for sharing this.
Quote from Heesob comment:
The libmysql.lib included in the MySQL Connector/C 64 bit is not
compatible with the mingw64-gcc compiler.
You need to generate mingw64 compatible libmysql.lib file.
To create an compatible libmysql.lib file, I did the following steps:
(I'm running Win8.1 x64 with Ruby 2.0.0p481 [x64-mingw32])
1) Downloaded this zip file https://structure-svm-map.googlecode.com/files/svm-map-win.zip and extracted it to a c:\tmp\svm-map
2) Downloaded Mysql C/Connector 6.1 from http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.1.3-winx64.zip and extracted it to c:\tmp\mysql
3) Open CMD Prompt
4) cd \tmp\svm-map\python-mingw-lib
5) gendef.exe \tmp\mysql\lib\libmysql.dll
6) move libmysql.def \tmp\mysql\lib
7) cd \tmp\mysql\lib
8) \Ruby200-x64\DevKit\mingw\bin\dlltool -v --dllname libmysql.dll --def libmysql.def --output-lib libmysql.lib
9) gem install mysql2 -- --with-mysql-dir=c:\tmp\mysql
That´s it! Mysql2 gem running on Rails x64 on Windows 8.1! =)

I googled "x64-mingw32 mysql2 Segmentation fault" and found this: https://bugs.ruby-lang.org/issues/8591
Looks like there is a bug in mysql2. A comment on the Ruby issue gives a workaround, regenerating libmysql.lib with your compiler. Please report back and let us know if it works.

Related

MikTex, package miktex-latex could not be installed

I "upgraded" from Windows 10 to Windows 11, and my MikTex developed problems. It still works, but gives this warning:
======================================================================
starting package maintenance...
installation directory: C:\Users\ccc31\AppData\Local\Programs\MiKTeX
package repository: https://mirror2.sandyriver.net/pub/ctan/systems/win32/miktex/tm/packages/
package repository digest: 01f4511dd3ba7934c7348b504d466b34
going to download 1262 bytes
going to install 4 file(s) (1 package(s))
downloading https://mirror2.sandyriver.net/pub/ctan/systems/win32/miktex/tm/packages/miktex-latex.tar.lzma...
0.00 MB, 0.03 Mbit/s
Unfortunately, the package miktex-latex could not be installed.
Please check the log file:
C:\Users\ccc31\AppData\Local\MiKTeX\miktex\log\pdflatex.log
======================================================================
I noticed from my settings file it says the OS is Windows 10. Here is a portion of my settings file:
ReportDate: 2023-01-31 16:00:55
CurrentVersion: 20.7
SetupDate: 2022-12-19 12:42:00
SetupVersion: 20.6.29
Configuration: Regular
GitInfo: d26133b / 2020-07-31 18:20:50
OS: Windows 10 Home, 64-bit, build 22621
SharedSetup: no
LinkTargetDirectory: C:\Program Files\MiKTeX\miktex\bin\x64
PathOkay: yes
LastUpdateCheck: 2023-01-31 15:48:30
LastUpdate: 2023-01-31 15:49:21
LastUpdateDb: 2023-01-31 15:50:42
SystemAdmin: yes
RootPrivileges: no
AdminMode: no
In trying to troubleshoot this problem, I noticed that I had Miktex in \Program Files and also in AppData\Local\Programs. I am a long time user of latexpdf, so it wouldn't surprise me to learn that I had installed it multiple times in multiple locations.
Any hints on how to diagnose the warning, and how to fix it? Thanks.

Rails 7, vips on M1 MacBook Air

I'm unable to use Rails 7.0.3.1 with vips on an M1 MacBook Air due to the error:
rails aborted!
LoadError: Could not open library 'glib-2.0.0': dlopen(glib-2.0.0, 0x0005): tried: 'glib-2.0.0' (no such file), '/usr/local/lib/glib-2.0.0' (no such file), '/usr/lib/glib-2.0.0' (no such file), '/Users/brody/Code/tms.next-tms.com.wip2/glib-2.0.0' (no such file).
Could not open library '/opt/local/lib/libglib-2.0.0.dylib': dlopen(/opt/local/lib/libglib-2.0.0.dylib, 0x0005): tried: '/opt/local/lib/libglib-2.0.0.dylib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
I'm using ffi 1.15.1 and can see it searching correctly in /opt/local/lib, but the homebrew package builds binaries for x86_64 rather than arm64e even while using the --build-from-source option (brew install vips --build-from-source).
Has anyone got this working?
I ran into the same issue (with libglib-2.0.0) but then I figured that brew poured glib--2.74.5.arm64_monterey.bottle so why does it find 2.0.0? In my case it was (a dated version of) Navicat linking an old glib
~$ ls -l /usr/local/lib/libglib*
0 lrwxr-xr-x 1 chaos staff 73B Dec 11 11:23 /usr/local/lib/libglib-2.0.0.dylib -> /Applications/Navicat Premium.app/Contents/Frameworks/libglib-2.0.0.dylib
This wasn't the only file however, Navicat linked a total of 71 dylib files. I removed all those symlinks and then the error disappeared

Xcode11 : Unable to install “AppName”

If you try to run the app on a real device
The following error appears and cannot be executed.
Why does this happen?
Are there any settings that should be reviewed?
Issue Details
Unable to install "AppName"
Domain: com.apple.dtdevicekit
Code: -402653103
--
App installation failed
Domain: com.apple.dtdevicekit
Code: -402653103
Failure Reason: Could not inspect the application package.
User Info: {
DVTRadarComponentKey = 487927;
"com.apple.dtdevicekit.stacktrace" = (
0 DTDeviceKitBase 0x0000000122d066e7 DTDKCreateNSError + 109
1 DTDeviceKitBase 0x0000000122d06de9 DTDK_AMDErrorToNSError + 792
2 DTDeviceKitBase 0x0000000122d4656a __90-[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:]_block_invoke + 164
3 DVTFoundation 0x0000000108a03156 DVTInvokeWithStrongOwnership + 73
4 DTDeviceKitBase 0x0000000122d46301 -[DTDKMobileDeviceToken installApplicationBundleAtPath:withOptions:andError:withCallback:] + 1589
5 IDEiOSSupportCore 0x0000000122bcea25 __118-[DVTiOSDevice(DVTiPhoneApplicationInstallation) processAppInstallSet:appUninstallSet:installOptions:completionBlock:]_block_invoke.352 + 4523
6 DVTFoundation 0x0000000108b343ba __DVT_CALLING_CLIENT_BLOCK__ + 7
7 DVTFoundation 0x0000000108b35a92 __DVTDispatchAsync_block_invoke + 809
8 libdispatch.dylib 0x00007fff588ea5f8 _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x00007fff588eb63d _dispatch_client_callout + 8
10 libdispatch.dylib 0x00007fff588f18e0 _dispatch_lane_serial_drain + 602
11 libdispatch.dylib 0x00007fff588f2396 _dispatch_lane_invoke + 385
12 libdispatch.dylib 0x00007fff588fa6ed _dispatch_workloop_worker_thread + 598
13 libsystem_pthread.dylib 0x00007fff58b2b611 _pthread_wqthread + 421
14 libsystem_pthread.dylib 0x00007fff58b2b3fd start_wqthread + 13
);
}
--
Tried
Provisioning profile has been recreated.
Installed the created profile on the device.
Cleaned the project.
Deleted data in ~ / Library / Developer / Xcode / DerivedData.
Environment
Xcode : 11.2.1
macOS : 10.14.6 Mojave
Device : iPhoneX
iOS : 13.1.2
Try to build for another device, then retry with the first one.
I know this is not a real solution but that was the only what worked for me.
Also I made a bug report with Apple feedback Assistant, I will update you if the gave a proper solution or response.
Update #1:
After Apple checked my sysdiagnose it was the following for me:
The app is malformed. The file at "$(PRODUCT_MODULE_NAME).app/Frameworks/SwiftyJSON.framework/Info.plist" is missing. Frameworks must be valid bundles with an Info.plist.
My current fix:
Clean Build Folder
Remove Derived Data (use DevCleaner)
Commit all changes to git
Delete Xcode project folder
Discard uncommitted changes
Pod install
Rebuild and cross fingers
As a 0. element I will insist you to make your coffee and take a snack ...
Update #2:
Now I fell into a hole where nothing above helped.
But for me, it looks like the issues framework is SwiftyJSON.
I made an issue, maybe someone has a proper solution.
Update #3:
I managed to build my project using Xcode Version 11.0 (11A420a) while using the latest command line tools from Xcode 11.3 (11C29).
Update #4:
I still got this mess after changing branches, this is the latest fix order for me, which works like 90% of the time ... the other 10% is due to a missed step I guess.
Clean Build Folder
Remove Derived Data (use DevCleaner)
Pod deintegrate
Pod install
Rebuild and cross fingers
Hello rebuilding(clean) the App helped me.
I face same issue. I checked i was using production professional profile then i select automatically manage sign.
It's work for me.
I'm on Apple M1, Device iOS 14.6, xcode 12.5.1
In my case Deleting project, Derived data, clean project, deinit & init pod, Delete project folder & clone it again nothing was worked out. But when I removed SwiftyJSON pod & install pod then install app on Device it was working. Then I add SwiftyJSON pod again & install pod so it was working fine. It's strange.
Before removing SwiftyJSON I had got Firebase/Crashlytics pod error which was suggesting me to run this command pod repo update.
I also faced this problem at many times:
Best solution: Try to get fresh clone of the project.
Some times below steps will work:
git reset
git checkout .
git clean -fdx
pod cache clean --all
pod install
It was an error that occurred due to a bug in the framework.
If you reinstall the problematic framework correctly
The error has disappeared.
Thank you very much.

iOS Cydia THEOS, make install, Could not find deb package

I followed the instructions here and it happens in both tweak and app:
http://iphonedevwiki.net/index.php/Theos/Setup#Creating_a_Project
But I don't see any .deb files
RoverMR-2:testapp rover$ find . -name "deb"
Here are several relevant command output logs:
https://gist.github.com/anonymous/42b4a086d6b7ee792b08
I just see this in packages:
RoverMR-2:testapp rover$ ls -la .theos/packages/
total 8
drwxr-xr-x 3 rover staff 102 Apr 30 11:12 .
drwxr-xr-x 4 rover staff 136 Apr 30 11:12 ..
-rw-r--r-- 1 rover staff 1 Apr 30 11:12 com.mysite.testapp-0.0.1
RoverMR-2:testapp rover$ make package
/Users/rover/Documents/Dev/Cydia/Theos/apps/testapp/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Making all for application testapp...
Copying resource directories into the application wrapper...
Compiling main.m...
Compiling testappApplication.mm...
Compiling RootViewController.mm...
Linking application testapp...
Stripping testapp...
Signing testapp...
Making stage for application testapp...
RoverMR-2:testapp rover$
RoverMR-2:testapp rover$ ls
Makefile RootViewController.h _ main.m testappApplication.mm
Resources RootViewController.mm control obj theos
RoverMR-2:testapp rover$
the error:
RoverMR-2:testapp rover$ make install
/Users/rover/Documents/Dev/Cydia/Theos/tweaks/testtweak/theos/makefiles/targets/Darwin/iphone.mk:41: Deploying to iOS 3.0 while building for 6.0 will generate armv7-only binaries.
Could not find "./com.yourcompany.testtweak_0.0.1-10_iphoneos-arm.deb" to install. Aborting.
I posted an issue about this https://github.com/DHowett/theos/issues/120
Type make package install all at once in the tweak's directory.

How do i point to an older keg with homebrew?

I have the following:
kamil:~/Sites/sc-1.9.3#sc: (develop)$ brew info mongo
mongodb: stable 2.2.0-x86_64
http://www.mongodb.org/
/usr/local/Cellar/mongodb/2.0.1-x86_64 (18 files, 120M)
/usr/local/Cellar/mongodb/2.2.0-x86_64 (20 files, 170M) *
I want to run 2.0.1 again, but everything points to newest version:
kamilski81:~/Sites:ruby-1.9.3:$ ll /usr/local/bin/mongod
kamilski81 wheel 41 Sep 22 13:55 /usr/local/bin/mongod -> ../Cellar/mongodb/2.2.0-x86_64/bin/mongod
Is there an eloguent way to point to the older version of mongo?
Use the brew switch:
$ brew switch mongo 2.0.1

Resources