PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0
Showing posts with label build. Show all posts
Showing posts with label build. Show all posts

Tuesday, November 1, 2022

[FIXED] How do I create a release build in Xcode?

 November 01, 2022     build, ios, macos, release, xcode     No comments   

Issue

Why is it that when I build an application, Xcode creates a debug build? I want to create a release build. How can I do this?


Solution

It is done over building an Archive version.

First connect a iOS device to your Mac. Then select that device as target in Xcode.

Now click on the tab "Product" and click on "Archive"



Answered By - Helge Becker
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, September 27, 2022

[FIXED] How to update the content of an existing yaml file with Pipeline Utility Steps plugin

 September 27, 2022     build, continuous-deployment, continuous-integration, jenkins, jenkins-pipeline     No comments   

Issue

In my jenkins pipeline I am reading data stored in yaml file using Pipeline Utility Steps plugin

I can read data from file, now I want to update the value and write it back to the file, like this:

pipeline {
agent any

stages {

    stage('JOb B ....'){
        steps{
            script{
               def datas = readYaml file:"${WORKSPACE}/Version.yml"
               echo datas.MAJOR_VERSION //output is 111

               datas = ['MAJOR_VERSION': '222']
               writeYaml file:"${WORKSPACE}/Version.yml", data: datas
            }
        }//steps
    }//stage

}//stages

}//pipeline

But I am getting error - Version.yml already exist:

java.nio.file.FileAlreadyExistsException: /var/lib/jenkins/workspace/t-cicd-swarm-example_hdxts-job-B/Version.yml already exist.
at org.jenkinsci.plugins.pipeline.utility.steps.conf.WriteYamlStep$Execution.run(WriteYamlStep.java:175)
at org.jenkinsci.plugins.pipeline.utility.steps.conf.WriteYamlStep$Execution.run(WriteYamlStep.java:159)
at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

It seems it can only write a new file and it cannot overwrite the existing file. How to update the content of an existing yaml file from my script shown above?


Solution

It looks like you need to delete or rename the original file before you overwrite it because the writeYaml method doesn't have an overwrite flag.

sh '''
  if [ -e Version.yaml ]; then
    rm -f Version.yaml
  fi
'''


Answered By - Rich Duncan
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Monday, September 12, 2022

[FIXED] How to detect sse availability in CMake

 September 12, 2022     build, cmake, cross-platform, sse     No comments   

Issue

In a CMakeLists.txt file, is there a way to detect the highest level of SSE available, and save it to CMAKE_CXX_FLAGS? In other words, I'd like to be able to write something like:

FindSSE()  # defines SSE_FLAGS
set(CMAKE_CXX_FLAGS ${SSE_FLAGS})

For example, if the platform supports up to SSE level 3, then FindSSE() would set SSE_FLAGS to -msse3.


Solution

This might be overkill, but the OptimizeForArchitecture.cmake from vc on gitorious will provide a list of optimizations based on the architecture.

You could either use that script directly or trim it down to the code you need.

A better solution would be to make a small cmake test script that uses SSE instructions and check if each variant compiles/runs.

EDIT: More specifically, there's also FindSSE.cmake in various places, although it still uses the somewhat clunky method of parsing /proc/cpuinfo



Answered By - jkerian
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, August 21, 2022

[FIXED] How to make CMake use environment variable LD_LIBRARY_PATH and C_INCLUDE_DIRS

 August 21, 2022     build, cmake, environment-variables     No comments   

Issue

Is there a way to pass C_INCLUDE_DIRS and LD_LIBRARY_PATH from cmake command line or is there a way to set env so that CMAKE can find and use them?


Solution

It is not fully clear what you intend to do with these variables. Here are some possibilities:

  1. Inside a CMake script you can read environment variables using the syntax $ENV{<VARIABLE_NAME>}. So in your CMakeLists.txt you can have something like

    message( "Found environment variable LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}" )
    
  2. If you want to add the location contained in this variable to be available to your CMake target executables and libraries then you can use the link_directories() command as

    link_directories( $ENV{LD_LIBRARY_PATH} )
    
  3. Or if you have someone else's project and you want to instruct CMake to look for libraries in some additional directories you can use CMAKE_PREFIX_PATH or CMAKE_LIBRARY_PATH. For example to pass these variables in a command line you could do

    cmake -D CMAKE_PREFIX_PATH=/path/to/custom/location
    


Answered By - user6764549
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, August 19, 2022

[FIXED] how to change the environments in angular

 August 19, 2022     angular, api, bitbucket, build, environment-variables     No comments   

Issue

In my project I have 3 environment files (dev, staging, production). And I want to change the them for each dist folder (when deploying to dev I need the envi dev link to take the data from.. same for staging and prod) The files contains these

export const environment = {
  production: true,
  hmr: false,
  backend: false,
  staging: false,
  apiKey: 'prodKey',
  API_URL: "my backend link"
};

Of course the production is false in dev and staging envs.. I also added in angular.json this (same for staging)

"configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "src/environments/environment.ts",
                  "with": "src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb",
                  "maximumError": "10kb"
                }
              ],
              "outputPath": "dist/production"
            },

But when I do build I usually commment a file and use the other to do build and deploy as here in my api file

import { environment } from 'src/environments/environment';

// import { environment } from "src//environments/environment.stage";
// import { environment } from "src//environments/environment.prod";

const API_URL = environment.API_URL;

commmands are: ng build and ng build --configuration=staging and ng build --prod

But I dont want to keep commenting the API envir.. as above, I want it to change automatically after I do build and change in dist files for each environment so I can deploy normally to git and do normal pipeline.

Any idea? Thanks


Solution

Leave all imports as

import { environment } from 'src/environments/environment';

Extend the configurations object in angular.json

extending the configurations object:

... // angular.json
configurations": {
    "production" {...} // leave as it is,
    "dev": {
        "fileReplacements": [
            {
                "replace": "src/environments/environment.ts",
                "with": "src/environments/environment.dev.ts"
            }
        ]
    },
    "staging": {
        "fileReplacements": [
            {
                "replace": "src/environments/environment.ts",
                "with": "src/environments/environment.staging.ts"
            }
        ]
    }
}


Answered By - Andrew Allen
Answer Checked By - David Goodson (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, July 17, 2022

[FIXED] How to turn off warning/error bars on APK build

 July 17, 2022     build, flutter, warnings     No comments   

Issue

I am using a Hero animation in my App. During the transition, the text receives a thick yellow underline. I'm pretty sure this is a overflow warning (or something similar), but it persists even when I run flutter build apk and flutter install, i.e. it exists in production builds.

My app functions fine, so I'd like to hide these. How do I do so?


Solution

During the transition, the text receives a thick yellow underline.

That is because Hero transition is done trough Overlay, which is rendered outside of Scaffold or other Material widgets.

The problem ? It means during transition, there's no widget that introduce a valid Theme (Scaffold, Dialog, Material do for example). So it fallback to a default Theme. And that Theme has yellow underline with a big font.

The solution : Wrap your Hero child into a widget introducing Theme or in Theme itself.



Answered By - Rémi Rousselet
Answer Checked By - Willingham (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Saturday, July 16, 2022

[FIXED] How to build a MultiStage Deployment in Visual Studio Tem Services?

 July 16, 2022     azure-devops, build, continuous-deployment, devops, web-deployment     No comments   

Issue

What I Have

I have a ASP.NET MVC Web application project.Its one of the basic ones that you get while creating a new project.I have 3 stages of deployment.

  • Test
  • Staging
  • Prod

All these are on IIS running on VMs. I tried to create a build and release. I am able to build and I am able to do a release for test environment.

Problem

The main issue is I want the dlls/views from test environment to go to staging environment after successful testing and hence staging to prod.

What I tried

I created a clone of test. Option selected is after environment.

My doubt is When I create a release to test it will automatically go to staging if approval is set to off.

If I have a approval process turned on then lets say a developer fixes issues and pushes code to test environment. Lets say I push code 20 times in a day then approver has to reject it 19 times and has to approve 20th time to successfully deploy to staging.

Is there anything like I click on test and say take release to staging. Then there will be some approver who either approves or rejects this.

I want a proper way of how I should set up pipeline with proper options. I want to deploy to a virtual machine.

PS: I am very new to VSTS and still exploring. Any good article which does exactly the same or somewhat similar will be of a great help.


Solution

If you want to manually decide when to deploy the Staging environment, then you just need to specify Manual only trigger for the Staging environment pre-deployment conditions (you can also specify Pre-deployment approvals etc in pre-deployment settings).

enter image description here

So when a new release is created, Test environment it deployed after release created, when Test environment finish deploying, you can manually deploy Staging Environment.

enter image description here

Note: files generated or updated from Test environment cannot persist to Staging Environment. And there are some options you can get the files from Test environment to Staging Environment:

  • Option 1: use the same agent to deploy the two environments

    You can deploy the two environments by same agent, so that in the end of Test environment, you can add a task to copy the dlls/views into a directory. Then add another task at the beginning of Staging Environment to copy the dlls/views from certain directory to the working directory.

  • Option 2: store the files into the place where it can be access from different agent machines

    You can also store dlls/views in the place where all the agent machines can access. Such as you can store the file into Git repo hosted in GitHub or bitbucket etc. Then clone the git repo in Staging environment.



Answered By - Marina Liu
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Wednesday, July 13, 2022

[FIXED] How to serve react app on server with sub-directory homepage on an existing domain?

 July 13, 2022     build, reactjs, web-deployment     No comments   

Issue

I am new to webdev. I want to deploy a react-app on our lab's server. i want other lab members to access this app with https://ourlab.org:PORT_NUM/myApp

On the lab server by sshing to it: under my home directory, i have this myApp folder. I give package.json this "homepage":"https://ourlab.org/myApp" field and then run npm run build, and then run npx serve -s build

it gives me

| Serving! │

│ - Local: http://localhost:5000 │

│ - On Your Network: http://159.89.xxx.xxx:5000 |

I expect I could access the app at url https://ourlab.org:5000/myApp on my local computer. But my browser does not get response.

BTW could someone please explain how this "homepage" works with more details?


Solution

when you run serve, you are serving the app from your local computer. If you want to serve the app from your lab-server find the document root on that server, create there a directory "myApp" and copy the content of the build directory from your computer into that directory on your lab server.

The build directory is the result of running ´npm run build´ assuming you have created your app with create-react-app.



Answered By - Michael
Answer Checked By - Senaida (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Tuesday, July 12, 2022

[FIXED] How to print messages after make done with cmake?

 July 12, 2022     build, cmake, makefile, message, post     No comments   

Issue

I'm trying to print messages after building process done using CMake.

I just want to inform the user after make command is done without any error.

How can I do it? I tried add_custom_target() but I cannot choose when to run.

Also, I tried add_custom_command(), again it doesn't give me the right result.

Any idea?

Thank you for your idea in advance.


Solution

You could, indeed, do the following:

add_custom_target( FinalMessage ALL
    ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Compilation is over!"
    COMMENT "Final Message" )
add_dependencies( FinalMessage ${ALL_TARGETS} )

That custom target depending on the list of all the targets you previously defined, you make sure it will be run last.



Answered By - xStan
Answer Checked By - David Marino (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Sunday, June 26, 2022

[FIXED] How to compile OpenJDK with OpenJ9 on Linux without a NUMA error?

 June 26, 2022     build, compiler-errors, configure, java, openj9     No comments   

Issue

Hello Stackoverflowers!
I am trying to build the OpenJDK with OpenJ9 on Linux, but when I run the configure script, I get the error:

configure: error: Could not find numa! 

Normally it should have just created the config and let me build, because I don't have multiple CPUs.

I have already googled the error message and looked trough and followed the documentation on the projects Github(https://github.com/ibmruntimes/openj9-openjdk-jdk17/blob/openj9/doc/building.md and https://github.com/eclipse-openj9/openj9/blob/master/doc/build-instructions/Build_Instructions_V17.md).

Here is the command I used:

bash configure --with-boot-jdk=/home/USER/bootjdk16

Here is the complete output if needed:

configure: Configuration created at Sun Nov 21 14:08:05 CET 2021.
checking for basename... /usr/bin/basename
checking for dirname... /usr/bin/dirname
checking for file... /usr/bin/file
checking for ldd... /usr/bin/ldd
checking for bash... /usr/bin/bash
checking for cat... /usr/bin/cat
checking for chmod... /usr/bin/chmod
checking for cp... /usr/bin/cp
checking for cut... /usr/bin/cut
checking for date... /usr/bin/date
checking for gdiff... [not found]
checking for diff... /usr/bin/diff
checking for echo... echo [builtin]
checking for expr... /usr/bin/expr
checking for find... /usr/bin/find
checking for gunzip... /usr/bin/gunzip
checking for pigz... [not found]
checking for gzip... /usr/bin/gzip
checking for head... /usr/bin/head
checking for ln... /usr/bin/ln
checking for ls... /usr/bin/ls
checking for gmkdir... [not found]
checking for mkdir... /usr/bin/mkdir
checking for mktemp... /usr/bin/mktemp
checking for mv... /usr/bin/mv
checking for gawk... /usr/bin/gawk
checking for printf... printf [builtin]
checking for rm... /usr/bin/rm
checking for rmdir... /usr/bin/rmdir
checking for sh... /usr/bin/sh
checking for sort... /usr/bin/sort
checking for tail... /usr/bin/tail
checking for gtar... [not found]
checking for tar... /usr/bin/tar
checking for tee... /usr/bin/tee
checking for touch... /usr/bin/touch
checking for tr... /usr/bin/tr
checking for uname... /usr/bin/uname
checking for wc... /usr/bin/wc
checking for xargs... /usr/bin/xargs
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for a sed that does not truncate output... /usr/bin/sed
checking for df... /usr/bin/df
checking for nice... /usr/bin/nice
checking for greadlink... [not found]
checking for readlink... /usr/bin/readlink
checking for cygpath... [not found]
checking for wslpath... [not found]
checking for lsb_release... [not found]
checking for cmd.exe... [not found]
checking for cmp... /usr/bin/cmp
checking for uniq... /usr/bin/uniq
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking openjdk-build os-cpu... linux-x86_64
checking openjdk-build C library... gnu
checking openjdk-target os-cpu... linux-x86_64
checking openjdk-target C library... gnu
checking compilation type... native
checking for top-level directory... /home/USER/openj9-openjdk-jdk17
checking if custom source is suppressed (openjdk-only)... disabled, default
checking for --enable-debug... disabled, default
checking which debug level to use... release
checking which variants of the JVM to build... server
checking for m4... /usr/bin/m4
checking for cmake... /usr/bin/cmake
checking for CRIU support... no (default)
checking for cuda... no (default)
checking for ddr... yes (default for xa64)
checking if demos should be included in jdk image... no
checking checking for numa... no
configure: error: Could not find numa! 
configure exiting with result code 1

Thank you in advance!


Solution

It looks like I didn't install the package "numactl" for some reason.

Just double check if you have those packages installed with (On Archbased)

sudo pacman -Q  numactl

(On Debainbased)

sudo dpkg -l numactl-devel

Credit: Stephen C



Answered By - LaserSami
Answer Checked By - Marie Seifert (PHPFixing Admin)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

[FIXED] How to compile Qt webengine (5.11) on Windows with proprietary codecs

 June 26, 2022     build, compiler-errors, qt, qtwebengine, visual-studio     No comments   

Issue

I have a lot of trouble compiling Qt webengine to enable proprietary codecs, documentation is not very clear. I followed others instructions on stackoverflow but it doesn't work. I got error like:

Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?

OR

Needs VS 2015 Update 3 with Cumulative Servicing Release or higher
Qt WebEngine will not be built.

OR

Could not detect Windows SDK Version ('WindowsSDKVersion' environment variable is not set).
Qt Webengine on Windows requires a Windows SDK version 10.0.10586 or newer.
QtWebEngine will not be built.

OR

Needs Visual Studio 2017 or Higher
Qt WebEngine will not be built.

OR

C1905: Front end and back end not compatible (must target same processor).
LNK1257: code generation failed

Solution

I had all of those problems for the last 5 days.

I'm doing a step by step instruction if you don't know how to begin with compiling Qt webengine (with or without proprietary codecs). If you have already done some of the steps, you can freely skip them.

Please if you see any error, if have one by doing this or if some instruction is not clear, tell me so I can update

1. Install Visual Studio 2017

Go to https://www.visualstudio.com/fr/downloads/ and download Visual Studio 2017.

Visual Sutdio Qt webengine minimum prerequisities

When this window comes, check Desktop Development for C++ and be sure that VC++ toolset 2015.3v v14.00 (v140) and SDK Windows 10 (10.0.xxxxx.x) are checked.

Install and wait until it finishes.

2. Install Qt sources qt webengine

Open MaintenanceTool.exe present into the Qt folder

Add or delete module

Qt webengine minimum prerequisities

Be sure to check at least: MSVC 2015 32-bit, MSVC 2015 64-bit, MSVC 2017 64-bit, Sources, Qt WebEngine

Install and wait until it finishes.

3. Install Qt webengine compile prerequisities

(Original instructions copied from Sébastien Bémelmans on this thread and a bit modified)

Download:

  • Python 2 (2.7.15 actually, Python 3 is not supported) from https://www.python.org/downloads/windows/
  • Perl (Strawberry vesion) from http://strawberryperl.com/
  • Bison and flex from https://sourceforge.net/projects/winflexbison/ (Rename win-bison.exe to bison.exe and win-flex.exe to flex.exe)
  • Gperf from http://gnuwin32.sourceforge.net/packages/gperf.htm

Be sure to add every .exe to System path, and restart the computer.

4. Compile Qt webengine with proprietary-codecs (or without)

Open cmd.exe (with administrator rights).

type cd + Path to the Microsoft Visual Studio folder where vcvarsall.bat is located:

cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build"


For compilation into 32-bits:

Type vcvars32.bat into command line

For compilation into 64-bits:

Type vcvars64.bat into command line


Go to the path where Sources of Qt are and enter qtwebengine subdirectory:

cd "C:\Qt\5.11.0\Src\qtwebengine"

For compilation into 32-bits:

Type "C:\Qt\5.11.0\msvc2015\bin\qmake.exe" -- -webengine-proprietary-codecs into command line (note the link is going to msvc 2015 32 bit)

For compilation into 64-bits:

Type "C:\Qt\5.11.0\msvc2017_64\bin\qmake.exe" -- -webengine-proprietary-codecs into command line (note the link is going to msvc 2017 64 bit)


Your console should look like this (32 bit):

Compile Qt webengine proprietary codecs

And the result:

Compile Qt webengine with proprietary codecs


Now you need to call nmake. Type "Path to nmake.exe for version 32 bit or 64 bit" like this:

For compilation into 32-bits:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx86\x86\nmake.exe" into command line (note the x86 into the path)

For compilation into 64-bits:

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\Hostx64\x64\nmake.exe" into command line (note the x64 into the path)


Your command line should now output a lot of things. Compiling qt webengine requires lot of memory and space (around 90 Go on my computer and 60% of my 8 GO of RAM). Be sure to have place and free memory. It is long processing too

Compiling Qt webengine proprietary codecs



Answered By - Dardan Iljazi
Answer Checked By - Katrina (PHPFixing Volunteer)
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg

Friday, February 11, 2022

[FIXED] Getting started with builds for webapps

 February 11, 2022     automation, build, deployment, git, lamp     No comments   

Issue

I work with LAMP, git, and OSX on a small team. We build websites and webapps. I'm very interested in learning about builds, continuous integration, unit testing, minifying JS/CSS, deployments, and automation - but don't know where to start!

It feels like one of those learned-through-osmosis-things with a high barrier of entry that can only be circumvented by the luxury of a large team that "knows what it's doing already".

Where's a good place to start? I'm interested in:

  • Specific Tools & Programs
  • Lynda Courses/Videos/Podcasts/ect
  • Books

Solution

A book well worth reading, that will outline the different processes and models important to think about is "Continuous Delivery", from the Martin Fowler Signature Series:

Continuous Delivery - Martin Fowler signature series

It will cover all the "theory" and is seriously enlightening, before you get bogged down with getting going with it.



Answered By - SaxonMatt
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Older Posts Home

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
All Comments
Atom
All Comments

Copyright © PHPFixing