Travis not compiling all cocoapods - cocoapods

for a RubyMotion gem, I use Travis for the tests.
The tests are passing locally but fail on Travis.
The reason is quite simple, all the code from one pod is not fully compiled.
If you look at https://travis-ci.org/bmichotte/ProMotion-XLForm at line 838 (for the actual build), it compile only those files
Build ./Pods.xcodeproj [XLForm - Release]
Compile ./XLForm/XLForm/XL/Helpers/NSExpression+XLFormAdditions.m
Compile ./XLForm/XLForm/XL/Helpers/NSArray+XLFormAdditions.m
Compile ./XLForm/XLForm/XL/Helpers/NSPredicate+XLFormAdditions.m
Compile ./XLForm/XLForm/XL/Helpers/NSObject+XLFormAdditions.m
Compile ./XLForm/XLForm/XL/Helpers/NSString+XLFormAdditions.m
while locally, it compile all files.
I'm not sure who is guilty (cocoapods, rubymotion, motion-cocoapods, ...) ? because it use the exact same version as I am using except xcode (6.1 on Travis, 6.4 locally).
Any idea why this occurs ?

Ok, so after a --trace, I was able to find the issue
The pod I use, use nonnull, null_unspecified and other keywords supported by XCode 6.3+ while the default XCode on Travis is 6.1...
Adding osx_image: xcode6.4 on my .travis.yml corrected the issue...
Now, I only have to get a RubyMotion install on this.

Related

Which build of gcc should I use to correctly build rustlearn crate?

I'm trying to use rustlearn crate in my project. Added the dependency in Cargo.toml.
Since rustlearn requires gcc, I downloaded and installed MinGW64.
I tried the following gcc builds:
x86_64-8.1.0-posix-seh-rt_v6-rev0
x86_64-8.1.0-posix-sjlj-rt_v6-rev0
i686-8.1.0-posix-sjlj-rt_v6-rev0
each time setting a PATH environment variable to the appropriate g++.exe and restarting VSCode.
But everytime I tried to build my Rust package I got a such error:
= note: C:\Rust\PF\machinelearning\target\debug\deps\librustlearn-4ae611e3fd449ac0.rlib(svm.o): In function `ZN6KernelC2EiPKP8svm_nodeRK13svm_parameter':
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:256: undefined reference to `__gxx_personality_sj0'
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:256: undefined reference to `_Unwind_SjLj_Register'
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:258: undefined reference to `_Unwind_SjLj_Resume'
C:\Git-local-repos\rustlearn/dependencies/libsvm/svm.cpp:289: undefined reference to `_Unwind_SjLj_Unregister'
repeated many times.
I realize that the problem is somehow related to exception handling (seh/sjlj).
My system is Windows 7 x86-64, rust toolchain is stable-i686-pc-windows-gnu.
What am I doing wrong?
I found that the right build of MinGW is i686-7.1.0-posix-dwarf-rt_v5-rev2.
I did not run into these errors when I created a MWE.
To me, this looks like you are trying to use gcc to link a *.o that was compiled with g++.
I was unable to replicate your problem. Here's what I did--which resulted in a successfully built project:
I created a new project with cargo new and added the following to Cargo.toml:
rustlearn = "0.5.0"
I ran cargo check to download all the required dependencies.
I edited src/main.rs to include the logistic regression example from here, modified so that it was called in a main() function.
I ran cargo build, which successfully compiled crossbeam, libc, serde, rand, rustlearn, and rustlearn-test--the name of my test package. Several linting warnings were outputted; they were ignored.
I ran cargo run, which successfully ran the program.
FWIW, I'm using the WSL on Windows 10.

Rust compile error on macOS related to GMP

Something like
use super::gmp::mpz::Mpz;
...
pub type MyMPZ = Mpz;
...
fn a() -> Option<MyMPZ>;
It (along with many other Rust files, libs and other dependencies) compiles and runs OK on Ubuntu and even Windows, but on macOS Mojave
I get
expected struct `gmp::mpz::Mpz`, found enum `std::option::Option`
note: expected type `&gmp::mpz::Mpz`
found type `&std::option::Option`
I installed GMP with Brew, but I tried with GMP 6.1.2 built by myself with the same results.
Update 1:
Seems MCVE doesn't make much sense since I have two exact copies of project in same root like root\example1 and root\example2. One copy builds ok, another gives the error message. Tried cargo clean etc numerous times to same effect.
Update 2:
Seems it's definitely some sort of caching issue. Because when I build dependencies, they take custom built 32bit version of gmp.lib from C:\Users\<userName>\.rustup\toolchains\nightly-i686-pc-windows-msvc\lib\rustlib\i686-pc-windows-msvc\lib. So if I checkout dependency and build it separately - tests run there. If I build the whole project, and using my own build dependency crates as .lib I at some point was getting
expected struct `gmp::mpz::Mpz`, found another struct `gmp::mpz::Mpz`
that seems like mixing of GMP 32/64 bit libraries to me.
Ok so it was cargo dependency hell:) - after multiple unsuccessful reinstalls, cleaning etc I finally was able to rebuild by manually downloading and rebuilding and re-referencing local paths of dependencies that were referenced with git. From then on - all was building fine no matter if I referenced locally or via git or crates.

How to install third party library Xcode 7

I installed this library in my project (a command line tool) via Cocoapods, but, even perfectly following all the instructions, Xcode doesn't see the module even if it's in the same workspace of my program
This is my Podfile:
platform :osx, '10.11.5'
use_frameworks!
target 'my_program' do
#no version required, otherwise it throws an error
pod 'Gloss', :git => 'https://github.com/hkellaway/Gloss.git'
end
and, as said, it installs the library without any error and creates a 'my_program.xcworkspace', which is where I should build the program instead of 'my_program.xcodeproj'. The problem is that I can't import the library in the main source file because Xcode thinks that there is no module named 'Gloss' in the workspace (even if there actually is).
What could I do?
Thanks
EDIT
I discovered that command line tools don't support framework. Thanks, Apple.
Anyway, I won't delete the question so that someone having my same struggle can have a quick answer
Did you build after importing Gloss?
xCode gave me an error saying there was 'no such module' until i built the project and it then detected it.

Reference to cocoapods when running unit tests

I've created a brand new static library project for iOS in Xcode 5 called 'MyApi'. After that I create a Podfile adding AFNetworking as a dependency so far so good. Lets say that I need to use AFNetworking in my MyApi.h file, #import . Finally I want to run tests on my code. I start by adding #import "MyApi.h" in my MyApiTests.m. If I hit CMD+U to test my code it will complain that the tests can't find AFNetworking. I can solve this by adding link_with "MyApi", "MyApiTests" in my Podfile. But now when I hit Test it will complain about duplicate symbol _OBJC...... (on all AFNetworking classes). I managed to get around this by removing libPods.a in Link Binary With Libraries in the MyApiTests target and everything works fine. But every time I run pod install I will have to do this manual step of removing the libPods.a. Since we don't keep the workspace that cocoa pods creates in our git repo. And since this is running on a jenkins server automatically I can't manually remove the libPods.a file. Can this be done in a better way that works without the manual step?
(Please don't make this a discussion about if you should checkin the xcworkspace).

Link error attempting to build app with Cocoapods using xcodebuild on Jenkins

I'm trying to set up a Jenkins CI instance for our app development project. I have jobs working that run logic and application tests using the Debug configuration but I'm struggling to build the IPA as I get a linkage error during compilation.
ld: library not found for -lPods
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The app uses Cocoapods and I'm building with the Jenkins XCode plugin.
I searched for similar problems and tried/verified a bunch of things:
I am using a workspace.
I'm running pod install before the xcodebuild step.
I've checked that architectures on the project itself, the target and Pods are the same – standard (armv7, armv7s) – as suggested by this answer
I tried various solutions from this GitHub thread
I tried various settings for Derived Data locations as per this answer and similar ones
The Podfile specifies platform :ios, :deployment_target => "6.0"
At that point I'm at a loss for what more to try.
The 'Build Output Directory' setting can also cause this.
Changing the value of the 'Build Output Directory' from a relative path to a fully specified path fixed it for me.
E.g. instead of 'MyOutputDirectory' use '/Users/Shared/Jenkins/home/jobs/JenkinsProject/workspace/MyOutputDirectory'
The problem might be because you have different (custom) build configurations.
Take a look at this:
https://github.com/CocoaPods/CocoaPods/issues/121
Try adding following search path to "Library Search Paths" (For all configs)
$(SYMROOT)/Release$(EFFECTIVE_PLATFORM_NAME)
You can try choose your Pods project and set Build Settings->Build Active Architectures Only->NO for Release and Debug, repeat this action for each target in Pods.
I can't speak to the XCode plugin, so my answer may be considered somewhat unresponsive, but here is how I got it working.
I added a build step that looks like this:
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer/
echo $WORKSPACE
cd "/Users/[jenkins-accountname]/.jenkins/jobs/[jobname]/workspace/[xcode project name]"
pod install
xcrun xcodebuild -workspace [your workspace (not project) name] -scheme [the build scheme to build] clean build -destination "platform=iOS,name=CurtsiPhone" -destination-timeout 120
The -destination and -destination-timeout were key build arguments for success. My project will only build on the phone since it uses specialized libraries, so my phone has to be plugged in so the XCode can find it. You may not need this if your project will build in the simulator, however I only got it working when I explicitly specified a destination.
If the XCode plugin allows you to state extra compile arguments, you should try these.
If you're using XCode 5 then I think this should help
basically update your Gemfile (or create one if it doesn't exist) and add:
gem 'cocoapods', :git => 'http://github.com/CocoaPods/CocoaPods', :branch => 'xcode-5-support'
gem 'xcodeproj', :git => 'http://github.com/CocoaPods/Xcodeproj', :branch => 'redacted-support'
Also if you have things like config.build_settings['ARCHS'] = 'armv7' in your Podfile, don't forget to get rid of it, you'll need to have armv7s too.
Hope this helps, cause it saved me a few days of nightmare.

Resources